Changed permission management to a safer one
This commit is contained in:
@@ -30,11 +30,9 @@ public class WebSecurityConfig {
|
|||||||
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||||
// 2. Allow public endpoints BEFORE any authenticated() calls
|
// 2. Allow public endpoints BEFORE any authenticated() calls
|
||||||
.requestMatchers("/athlete/create", "/", "/public").permitAll()
|
.requestMatchers("/athlete/create", "/", "/public").permitAll()
|
||||||
.requestMatchers("/coach/**").permitAll()
|
.requestMatchers("/coach/**").hasRole("coach")
|
||||||
// 3. Authenticated endpoints
|
|
||||||
.requestMatchers("/users/sync").authenticated()
|
|
||||||
.requestMatchers("/admin/**").hasRole("admin")
|
.requestMatchers("/admin/**").hasRole("admin")
|
||||||
.requestMatchers("/user/**").hasRole("user")
|
.requestMatchers("/athlete/**").hasRole("athlete")
|
||||||
.anyRequest().authenticated())
|
.anyRequest().authenticated())
|
||||||
.oauth2ResourceServer(oauth2 -> oauth2
|
.oauth2ResourceServer(oauth2 -> oauth2
|
||||||
.jwt(jwt -> jwt.jwtAuthenticationConverter(jwtToken -> {
|
.jwt(jwt -> jwt.jwtAuthenticationConverter(jwtToken -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user