Skip to content

Commit

Permalink
Merge pull request #63 from yomankum-project/fix/62-security
Browse files Browse the repository at this point in the history
fix(security): spring security config
  • Loading branch information
hyungzin0309 authored Mar 3, 2024
2 parents 2c21c00 + 9126862 commit 0af4b5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/main/java/com/account/yomankum/config/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.account.yomankum.config;

import com.account.yomankum.security.jwt.JwtFilter;
import com.account.yomankum.security.oauth.filter.CustomOAuth2AuthorizationCodeGrantFilter;
import com.account.yomankum.security.oauth.filter.CustomOAuth2AuthorizationRequestResolver;
import com.account.yomankum.security.oauth.filter.OAuth2JwtFilter;
import com.account.yomankum.security.oauth.handler.CustomAccessDeniedHandler;
Expand All @@ -27,17 +26,16 @@
class SecurityConfig {

private final CustomOAuth2AuthorizationRequestResolver authorizationRequestResolver;
private final CustomOAuth2AuthorizationCodeGrantFilter oAuth2AuthorizationCodeGrantFilter;
private final CustomDefaultOAuth2UserService oAuth2UserService;
private final CustomAuthenticationEntryPoint authenticationEntryPoint;
private final CustomAccessDeniedHandler accessDeniedHandler;
private final JwtFilter jwtFilter;
private final OAuth2JwtFilter oAuth2JwtFilter;

@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}

@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception {
return authenticationConfiguration.getAuthenticationManager();
Expand All @@ -46,7 +44,6 @@ public AuthenticationManager authenticationManager(AuthenticationConfiguration a
public AuthenticationConfiguration authenticationConfiguration() {
return new AuthenticationConfiguration();
}

@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http
Expand All @@ -62,7 +59,11 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.logout(logout -> logout.logoutSuccessUrl("/api/v1/login").permitAll())

// OAuth2
.addFilterBefore(oAuth2AuthorizationCodeGrantFilter, OAuth2LoginAuthenticationFilter.class)
// .addFilterBefore(new CustomOAuth2AuthorizationCodeGrantFilter(
// clientRegistrationRepository,
// oAuth2AuthorizedClientRepository,
// authenticationManager,
// snsInfo), OAuth2LoginAuthenticationFilter.class)
.addFilterAfter(oAuth2JwtFilter, OAuth2LoginAuthenticationFilter.class)
.exceptionHandling(exception -> exception
.authenticationEntryPoint(authenticationEntryPoint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class CustomOAuth2AuthorizationCodeGrantFilter extends OAuth2Authorizatio

private final SnsInfo snsInfo;

public CustomOAuth2AuthorizationCodeGrantFilter(final ClientRegistrationRepository clientRegistrationRepository, final OAuth2AuthorizedClientRepository authorizedClientRepository, final AuthenticationManager authenticationManager, final SnsInfo snsInfo) {
public CustomOAuth2AuthorizationCodeGrantFilter(ClientRegistrationRepository clientRegistrationRepository, OAuth2AuthorizedClientRepository authorizedClientRepository, AuthenticationManager authenticationManager, SnsInfo snsInfo) {
super(clientRegistrationRepository, authorizedClientRepository, authenticationManager);
this.snsInfo = snsInfo;
}
Expand Down

0 comments on commit 0af4b5c

Please sign in to comment.