Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Plan
Issues
27
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
ARSnova
ARSnova Backend
Commits
34a4d337
Commit
34a4d337
authored
5 years ago
by
Daniel Gerhardt
Browse files
Options
Downloads
Patches
Plain Diff
WIP: Restrict access to /management endpoint to ROLE_ADMIN
parent
f363f4d5
No related merge requests found
Pipeline
#29569
failed with stages
in 40 seconds
This commit is part of merge request
!140
. Comments created here will be created in the context of that merge request.
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/thm/arsnova/config/SecurityConfig.java
+20
-0
20 additions, 0 deletions
src/main/java/de/thm/arsnova/config/SecurityConfig.java
with
20 additions
and
0 deletions
src/main/java/de/thm/arsnova/config/SecurityConfig.java
+
20
−
0
Edit
View file @
34a4d337
...
@@ -32,6 +32,7 @@ import org.pac4j.oidc.client.OidcClient;
...
@@ -32,6 +32,7 @@ import org.pac4j.oidc.client.OidcClient;
import
org.pac4j.oidc.config.OidcConfiguration
;
import
org.pac4j.oidc.config.OidcConfiguration
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.AdviceMode
;
import
org.springframework.context.annotation.AdviceMode
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -145,6 +146,25 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -145,6 +146,25 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
}
}
}
}
@Configuration
@Order
(
3
)
@Profile
(
"!test"
)
public
class
ManagementHttpSecurityConfig
extends
HttpSecurityConfig
{
private
final
String
managementPath
;
public
ManagementHttpSecurityConfig
(
final
WebEndpointProperties
webEndpointProperties
)
{
managementPath
=
webEndpointProperties
.
getBasePath
();
}
@Override
protected
void
configure
(
final
HttpSecurity
http
)
throws
Exception
{
super
.
configure
(
http
);
http
.
antMatcher
(
managementPath
);
http
.
authorizeRequests
().
anyRequest
().
hasRole
(
"ADMIN"
);
http
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
);
}
}
@Configuration
@Configuration
@Order
(
2
)
@Order
(
2
)
@Profile
(
"!test"
)
@Profile
(
"!test"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment