Change: public-authenticated routes in auth controller like login, refresh or change-password.
This commit is contained in:
@@ -64,7 +64,10 @@ public class SecurityConfig {
|
|||||||
.accessDeniedHandler(accessDeniedHandler)
|
.accessDeniedHandler(accessDeniedHandler)
|
||||||
)
|
)
|
||||||
.authorizeHttpRequests(auth -> auth
|
.authorizeHttpRequests(auth -> auth
|
||||||
.requestMatchers("/auth/**", "/screenshot").permitAll()
|
.requestMatchers("/auth/login").permitAll()
|
||||||
|
.requestMatchers("/auth/refresh").permitAll()
|
||||||
|
.requestMatchers("/auth/change-password").permitAll()
|
||||||
|
.requestMatchers("/screenshot").permitAll()
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class AuthController {
|
|||||||
return ResponseEntity.ok(authService.register(request));
|
return ResponseEntity.ok(authService.register(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/refresh")
|
@GetMapping("/refresh")
|
||||||
public ResponseEntity<?> refreshToken(@RequestHeader("Authorization") String authHeader) {
|
public ResponseEntity<?> refreshToken(@RequestHeader("Authorization") String authHeader) {
|
||||||
if (authHeader == null || !authHeader.startsWith("Bearer ")) {
|
if (authHeader == null || !authHeader.startsWith("Bearer ")) {
|
||||||
return ResponseEntity.status(401).body(
|
return ResponseEntity.status(401).body(
|
||||||
|
|||||||
Reference in New Issue
Block a user