Skip to content

Commit

Permalink
[Feat] api 경로 설정 및 security filter 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyunio committed Oct 5, 2024
1 parent 9d4591d commit 0f1b46c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/main/java/com/appcenter/BJJ/BjjApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

//API의 기본 서버 url을 애플리케이션의 루트 경로로 설정
@OpenAPIDefinition(servers = {
@Server(url = "https://bjj.inuappcenter.kr", description = "Default Server URL")
@Server(url = "/", description = "Default Server URL")
})
@SpringBootApplication
public class BjjApplication {
public static void main(String[] args) {
SpringApplication.run(BjjApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(BjjApplication.class, args);
}
}
3 changes: 2 additions & 1 deletion src/main/java/com/appcenter/BJJ/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti

.authorizeHttpRequests(authorize -> authorize
.requestMatchers("swagger-ui/**", "v3/**", "/h2-console/**").permitAll()
.requestMatchers("/sign-up/**").permitAll()
.requestMatchers("api/member/sign-up/**").permitAll()
.requestMatchers("oauth2/authorization/**").permitAll()
.anyRequest().authenticated())
.sessionManagement(session -> session
.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.addFilterBefore(new JwtFilter(jwtProvider), UsernamePasswordAuthenticationFilter.class);

http.oauth2Login(oauth -> oauth
//사용자 정보를 가져오기 위한 함수
.userInfoEndpoint(point -> point.userService(oAuth2UserService))
.successHandler(oAuth2SuccessHandler));
return http.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
@RequiredArgsConstructor
public class OAuth2UserServiceExt extends DefaultOAuth2UserService {
private final MemberRepository memberRepository;

@Override
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
log.info("OAuth2UserServiceExt-loadUser 진입");
Expand Down

0 comments on commit 0f1b46c

Please sign in to comment.