Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Formula Team Management
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jitka Viceníková
Formula Team Management
Commits
3670840c
There was an error fetching the commit references. Please try again later.
Commit
3670840c
authored
1 year ago
by
Andrej Zabka
Browse files
Options
Downloads
Patches
Plain Diff
Updated forgotten security settings
parent
73fe8671
No related branches found
No related tags found
2 merge requests
!54
Merge develop into main
,
!53
Security fix for final defence
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/java/cz/muni/pa165/config/SecurityConfig.java
+2
-4
2 additions, 4 deletions
core/src/main/java/cz/muni/pa165/config/SecurityConfig.java
with
2 additions
and
4 deletions
core/src/main/java/cz/muni/pa165/config/SecurityConfig.java
+
2
−
4
View file @
3670840c
...
...
@@ -19,7 +19,6 @@ public class SecurityConfig {
@Bean
public
SecurityFilterChain
filterChain
(
HttpSecurity
http
)
throws
Exception
{
http
.
csrf
().
disable
();
http
.
authorizeHttpRequests
(
x
->
x
.
requestMatchers
(
"/swagger-ui/**"
,
"/v3/api-docs/**"
,
"/seed"
,
"/clear"
).
permitAll
()
...
...
@@ -28,7 +27,7 @@ public class SecurityConfig {
.
requestMatchers
(
"/carComponent/**"
).
hasAnyAuthority
(
"SCOPE_test_5"
,
"SCOPE_test_1"
)
.
requestMatchers
(
"/car"
,
"/car/**"
,
"/driver/**"
,
"/driver"
).
hasAuthority
(
"SCOPE_test_5"
)
.
requestMatchers
(
"/engineer"
,
"/engineer/**"
,
"/department"
,
"/department/**"
).
hasAuthority
(
"SCOPE_test_5"
)
.
anyRequest
().
permit
All
()
.
anyRequest
().
deny
All
()
)
.
oauth2ResourceServer
(
OAuth2ResourceServerConfigurer:
:
opaqueToken
)
;
...
...
@@ -49,13 +48,13 @@ public class SecurityConfig {
.
authorizationUrl
(
"https://oidc.muni.cz/oidc/authorize"
)
.
tokenUrl
(
"https://oidc.muni.cz/oidc/token"
)
.
scopes
(
new
Scopes
()
//.addString("openid", "idk")
.
addString
(
"test_5"
,
"manager scope"
)
.
addString
(
"test_1"
,
"engineer scope"
)
)
)
)
);
var
managerScopeRequirement
=
new
SecurityRequirement
().
addList
(
"OAuth2"
,
"test_5"
);
var
engineerScopeRequirement
=
new
SecurityRequirement
().
addList
(
"OAuth2"
,
"test_1"
);
...
...
@@ -87,7 +86,6 @@ public class SecurityConfig {
openApi
.
getPaths
().
get
(
"/engineer"
).
getPost
().
addSecurityItem
(
managerScopeRequirement
);
openApi
.
getPaths
().
get
(
"/engineer/{id}"
).
getGet
().
addSecurityItem
(
managerScopeRequirement
);
openApi
.
getPaths
().
get
(
"/engineer/{id}"
).
getDelete
().
addSecurityItem
(
managerScopeRequirement
);
openApi
.
getPaths
().
get
(
"/carComponent"
).
getPost
().
addSecurityItem
(
engineerScopeRequirement
);
};
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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