remove debug controllers
This commit is contained in:
@@ -1,28 +0,0 @@
|
|||||||
package com.litoralregas.backend_gateway.auth;
|
|
||||||
|
|
||||||
import com.litoralregas.backend_gateway.security.JwtService;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/debug/jwt")
|
|
||||||
public class JwtDebugController {
|
|
||||||
|
|
||||||
private final JwtService jwtService;
|
|
||||||
|
|
||||||
public JwtDebugController(JwtService jwtService) {
|
|
||||||
this.jwtService = jwtService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping
|
|
||||||
public Map<String, Object> debug(@RequestBody String token) {
|
|
||||||
|
|
||||||
return Map.of(
|
|
||||||
"valid", jwtService.isValid(token),
|
|
||||||
"username", jwtService.extractUsername(token),
|
|
||||||
"clientId", jwtService.extractClientId(token),
|
|
||||||
"role", jwtService.extractRole(token)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,6 @@ public class SecurityConfig {
|
|||||||
.csrf(csrf -> csrf.disable())
|
.csrf(csrf -> csrf.disable())
|
||||||
.authorizeHttpRequests(auth -> auth
|
.authorizeHttpRequests(auth -> auth
|
||||||
.requestMatchers("/auth/**").permitAll()
|
.requestMatchers("/auth/**").permitAll()
|
||||||
.requestMatchers("/debug/**").permitAll()
|
|
||||||
.requestMatchers("/admin/**").hasRole("ADMIN")
|
.requestMatchers("/admin/**").hasRole("ADMIN")
|
||||||
.requestMatchers("/api/backend/**").authenticated()
|
.requestMatchers("/api/backend/**").authenticated()
|
||||||
.anyRequest().permitAll()
|
.anyRequest().permitAll()
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.litoralregas.backend_gateway.security;
|
|
||||||
|
|
||||||
import org.springframework.security.core.Authentication;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
public class AuthDebugController {
|
|
||||||
|
|
||||||
@GetMapping("/debug/me")
|
|
||||||
public Object me(Authentication authentication) {
|
|
||||||
if (authentication == null) {
|
|
||||||
return "anonymous";
|
|
||||||
}
|
|
||||||
|
|
||||||
return authentication.getPrincipal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user