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