Skip to content

Commit

Permalink
update: enable cors
Browse files Browse the repository at this point in the history
  • Loading branch information
siwonpada committed Aug 25, 2024
1 parent 5e96f5b commit b88e052
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SecurityConfiguration {
fun securityFilterChain(httpSecurity: HttpSecurity, tokenProvider: TokenProvider): SecurityFilterChain =
httpSecurity
.csrf { csrf -> csrf.disable() }
.cors(Customizer.withDefaults())
.cors { it.disable() }
.headers { headers ->
headers.frameOptions { it.sameOrigin() }
}
Expand All @@ -33,12 +33,14 @@ class SecurityConfiguration {
}
.authorizeHttpRequests { req ->
req.requestMatchers(HttpMethod.GET).permitAll()
req.requestMatchers("/swagger-ui/**" , "v3/api-docs/**").permitAll()
req.requestMatchers("/swagger-ui/**" , "v3/api-docs/**", "/api-docs/**").permitAll()
req.requestMatchers("/auth/login", "/auth/register").permitAll()
req.requestMatchers("/error").permitAll()
req.requestMatchers("/").permitAll()
req.anyRequest().authenticated()
}
.addFilterBefore(JwtFilter(tokenProvider), UsernamePasswordAuthenticationFilter::class.java)
.build()


}
1 change: 0 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ springdoc.default-produces-media-type=application/json
jwt.secret=${JWT_SECRET}
jwt.expiration=${JWT_EXPIRATION}
springdoc.packages-to-scan=me.gistory.newbies_server_24.controllers
springdoc.swagger-ui.disable-swagger-default-url=true
springdoc.swagger-ui.display-request-duration=true
springdoc.swagger-ui.operations-sorter=alpha
springdoc.api-docs.enabled=true
Expand Down

0 comments on commit b88e052

Please sign in to comment.