Clean security code
This commit is contained in:
@@ -62,7 +62,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
response.setContentType("application/json");
|
||||
|
||||
ErrorResponse errorResponse = new ErrorResponse("Your session has expired. Refresh your token.");
|
||||
ObjectMapper objectMapper = new ObjectMapper(); // You may need to import ObjectMapper
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
response.getWriter().write(objectMapper.writeValueAsString(errorResponse));
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ public class JwtService {
|
||||
private long jwtExpiration;
|
||||
@Value("${application.security.jwt.refresh-token.expiration}")
|
||||
private long refreshExpiration;
|
||||
// private final AuthenticationService authenticationService;
|
||||
|
||||
|
||||
public String extractUsername(String token) {
|
||||
|
||||
@@ -45,22 +45,9 @@ public class SecurityConfiguration {
|
||||
.cors(Customizer.withDefaults())
|
||||
.csrf(AbstractHttpConfigurer::disable)
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
// .requestMatchers("/api/v1/auth/**").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
)
|
||||
.oauth2Login(withDefaults());
|
||||
// .exceptionHandling(exceptionHandling ->
|
||||
// exceptionHandling
|
||||
// .authenticationEntryPoint(authenticationEntryPoint())
|
||||
// )
|
||||
// .oauth2Login(oauth2Login ->
|
||||
// oauth2Login
|
||||
// .loginPage("/login")
|
||||
// .clientRegistrationRepository(clientRegistrationRepository)
|
||||
// .userInfoEndpoint(userInfoEndpoint ->
|
||||
// userInfoEndpoint.userService(oAuth2UserService())
|
||||
// )
|
||||
// .successHandler(jwtAuthenticationSuccessHandler()));
|
||||
|
||||
return http.build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user