Skip to content

Commit

Permalink
Test: 스웨거 문서 테스트
Browse files Browse the repository at this point in the history
서버에서 스웨거 경로 지정 시
"/" 경로로 리다이렉트되는 현상 원인 파악중
  • Loading branch information
haeyonghahn committed Jul 30, 2023
1 parent 7c0c6c7 commit 3c6a85c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,54 +39,44 @@ public WebSecurityCustomizer webSecurityCustomizer() {
"/static/css/**",
"/static/scss/**",
"/swagger-ui/**",
"/swagger-resources/**",
"/v3/api-docs/**",
"/api/v1/tokens/temp");
"/swagger-resources/**");
}

// @Bean
// public SecurityFilterChain httpSecurity(HttpSecurity http) throws Exception {
// return http
// .cors()
// .configurationSource(corsConfigurationSource())
// .and()
// .authorizeHttpRequests()
// .antMatchers("/").permitAll()
// .antMatchers("/health-check").permitAll()
// .antMatchers("/static/js/**").permitAll()
// .antMatchers("/static/images/**").permitAll()
// .antMatchers("/static/css/**").permitAll()
// .antMatchers("/static/scss/**").permitAll()
// .antMatchers("/swagger-ui/**").permitAll()
// .antMatchers("/swagger-resources/**").permitAll()
// .antMatchers("/v3/api-docs/**").permitAll()
// .antMatchers("/api/v1/doc/**").permitAll()
// .antMatchers("/api/v1/tokens/temp").permitAll()
// .anyRequest().authenticated()
// .and()
// .httpBasic().disable()
// .rememberMe().disable()
// .csrf().disable()
// .logout().disable()
// .requestCache().disable()
// .formLogin().disable()
// .headers().disable()
// .sessionManagement()
// .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
// .and()
// .oauth2Login()
// .authorizationEndpoint().baseUri("/oauth2/authorization")
// .authorizationRequestRepository(httpCookieOAuthAuthorizationRequestRepository)
// .and()
// .successHandler(customOAuth2SuccessHandler)
// .failureHandler(customOAuth2FailureHandler)
// .and()
// .exceptionHandling()
// .and()
// .addFilterBefore(jwtAuthenticationFilter, OAuth2AuthorizationRequestRedirectFilter.class)
// .addFilterBefore(exceptionHandlerFilter, JwtAuthenticationFilter.class)
// .build();
// }
@Bean
public SecurityFilterChain httpSecurity(HttpSecurity http) throws Exception {
return http
.cors()
.configurationSource(corsConfigurationSource())
.and()
.authorizeHttpRequests()
.antMatchers("/").permitAll()
.antMatchers("/health-check").permitAll()
.antMatchers("/api/v1/tokens/temp").permitAll()
.anyRequest().authenticated()
.and()
.httpBasic().disable()
.rememberMe().disable()
.csrf().disable()
.logout().disable()
.requestCache().disable()
.formLogin().disable()
.headers().disable()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.oauth2Login()
.authorizationEndpoint().baseUri("/oauth2/authorization")
.authorizationRequestRepository(httpCookieOAuthAuthorizationRequestRepository)
.and()
.successHandler(customOAuth2SuccessHandler)
.failureHandler(customOAuth2FailureHandler)
.and()
.exceptionHandling()
.and()
.addFilterBefore(jwtAuthenticationFilter, OAuth2AuthorizationRequestRedirectFilter.class)
.addFilterBefore(exceptionHandlerFilter, JwtAuthenticationFilter.class)
.build();
}

@Bean
public CorsConfigurationSource corsConfigurationSource() {
Expand Down

This file was deleted.

19 changes: 9 additions & 10 deletions src/main/resources/application-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ jwt:
access-token: 1800
refresh-token: 604800

#spring:
# security:
# oauth2:
# client:
# registration:
# google:
# client-id: ${GOOGLE_CLIENT_ID}
# client-secret: ${GOOGLE_CLIENT_SECRET}
# redirect-uri: ${GOOGLE_REDIRECT_URI}
# scope: profile,email
spring:
security:
oauth2:
client:
registration:
google:
client-id: ${GOOGLE_CLIENT_ID}
client-secret: ${GOOGLE_CLIENT_SECRET}
scope: profile,email
mvc:
static-path-pattern: /static/**

0 comments on commit 3c6a85c

Please sign in to comment.