Skip to content

Commit

Permalink
!HOTFIX: API 연동 버그 수정
Browse files Browse the repository at this point in the history
원인 : 경로 매핑을 잘못하였음
추가적으로 테스트를 위해 H2 의존성 모두 열어두고 스프링 시큐리티 걸리지 않게 설정
  • Loading branch information
limjustin committed Nov 19, 2024
1 parent 76c7458 commit 2155dae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 9 additions & 6 deletions MEME-AUTH/src/main/java/org/meme/auth/config/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
package org.meme.auth.config;

import lombok.RequiredArgsConstructor;
import org.meme.auth.service.PrincipalDetailsService;
import org.meme.auth.jwt.JwtAccessDeniedHandler;
import org.meme.auth.jwt.JwtAuthenticationEntryPoint;
import org.meme.auth.jwt.JwtCustomAuthenticationFilter;
import org.meme.auth.service.PrincipalDetailsService;
import org.springframework.boot.autoconfigure.security.servlet.PathRequest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;


import static org.springframework.security.config.http.SessionCreationPolicy.*;
import static org.springframework.security.config.http.SessionCreationPolicy.STATELESS;

@RequiredArgsConstructor
@EnableWebSecurity
Expand All @@ -44,18 +45,20 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.authenticationEntryPoint(authenticationEntryPoint) // 401
.accessDeniedHandler(accessDeniedHandler) // 403
)
.headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin)) // H2 데이터베이스 웹 콘솔 허용
.authorizeHttpRequests((authorizeHttpRequests) ->
authorizeHttpRequests
.requestMatchers("/api/v1/signup/model").permitAll()
.requestMatchers("/api/v1/signup/artist").permitAll()
.requestMatchers("/api/v1/reissue").permitAll()
.requestMatchers("/api/v1/check/*").permitAll()

.requestMatchers("/api/v1/auth/artist/extra").permitAll()
.requestMatchers("/api/v1/auth/logout").permitAll()
.requestMatchers("/api/v1/auth/withdraw").permitAll()
.requestMatchers("/api/v2/**").permitAll()
.requestMatchers("/auth/**").permitAll()

.requestMatchers("/api/v2/**").permitAll() // API version update
.requestMatchers(PathRequest.toH2Console()).permitAll() // H2 데이터베이스 경로 허용
);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
import org.meme.auth.service.AuthService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static org.meme.auth.common.BaseResponseDto.SuccessResponse;

@Slf4j(topic = "MEME-AUTH")
@RequiredArgsConstructor
@RestController("/api/v2")
@RequestMapping("/api/v2")
@RestController
public class AuthController {

private final AuthService authService;
Expand Down

0 comments on commit 2155dae

Please sign in to comment.