Change response status when token is expired

This commit is contained in:
Dmitrii Cravcenco
2023-10-12 13:26:01 +03:00
parent fe3ad761e7
commit 0b98fe3db4
4 changed files with 12 additions and 28 deletions

View File

@@ -19,7 +19,6 @@ public class SecurityConfiguration {
private final JwtAuthenticationFilter jwtAuthFilter;
private final AuthenticationProvider authenticationProvider;
// private final Http401UnauthorizedEntryPoint entryPoint;
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
@@ -30,7 +29,6 @@ public class SecurityConfiguration {
.anyRequest().authenticated()
)
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
// .exceptionHandling((e) -> e.authenticationEntryPoint(entryPoint))
.authenticationProvider(authenticationProvider)
.addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class); // will be executed before UsernamePasswordAuthenticationFilter