Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fixed config
Browse files Browse the repository at this point in the history
  • Loading branch information
osoohynn committed Aug 26, 2024
1 parent e27f9ea commit f432ae5
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.example.crescendoserver.global.config.security;

import com.example.crescendoserver.global.security.jwt.filter.JwtAuthenticationFilter;
import com.example.crescendoserver.global.security.jwt.filter.JwtExceptionFilter;
import com.example.crescendoserver.global.security.jwt.handler.JwtAccessDeniedHandler;
import com.example.crescendoserver.global.security.jwt.handler.JwtAuthenticationEntryPoint;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -16,10 +20,10 @@
@RequiredArgsConstructor
@EnableWebSecurity
public class SecurityConfig {
// private final JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;
// private final JwtAccessDeniedHandler jwtAccessDeniedHandler;
// private final JwtAuthenticationFilter jwtAuthenticationFilter;
// private final JwtExceptionFilter jwtExceptionFilter;
private final JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;
private final JwtAccessDeniedHandler jwtAccessDeniedHandler;
private final JwtAuthenticationFilter jwtAuthenticationFilter;
private final JwtExceptionFilter jwtExceptionFilter;

@Bean
public PasswordEncoder passwordEncoder() {
Expand All @@ -36,10 +40,10 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.rememberMe(AbstractHttpConfigurer::disable)
.logout(AbstractHttpConfigurer::disable)

// .exceptionHandling((configurer) -> configurer
// .accessDeniedHandler(jwtAccessDeniedHandler)
// .authenticationEntryPoint(jwtAuthenticationEntryPoint)
// )
.exceptionHandling((configurer) -> configurer
.accessDeniedHandler(jwtAccessDeniedHandler)
.authenticationEntryPoint(jwtAuthenticationEntryPoint)
)

.authorizeHttpRequests((configurer) -> configurer
.requestMatchers(HttpMethod.POST, "/auth/signup", "/auth/login", "/auth/reissue").anonymous()
Expand All @@ -52,8 +56,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.requestMatchers(HttpMethod.GET, "/chat").permitAll()
)

// .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
// .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class)
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class)
.build();
}
}

0 comments on commit f432ae5

Please sign in to comment.