Skip to content

Commit

Permalink
fix : (#29) cors setting
Browse files Browse the repository at this point in the history
  • Loading branch information
coehgns committed Feb 12, 2025
1 parent 62be160 commit ead4abd
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,28 @@ class GithubOAuth2LoginConfig {
.cors { it.configurationSource(corsConfigurationSource()) }
.csrf { it.disable() }
.oauth2Login { oauth ->
oauth
.successHandler(githubAuthenticationSuccessHandler())
.failureHandler(githubAuthenticationFailureHandler())
.authorizationEndpoint { authorizationEndpoint ->
val defaultResolver =
DefaultOAuth2AuthorizationRequestResolver(
oauth
.successHandler(githubAuthenticationSuccessHandler())
.failureHandler(githubAuthenticationFailureHandler())
.authorizationEndpoint { authorizationEndpoint ->
val defaultResolver =
DefaultOAuth2AuthorizationRequestResolver(
clientRegistrationRepository,
"/oauth2/authorization",
)
defaultResolver.setAuthorizationRequestCustomizer { builder ->
builder.scope("read:org")
"/oauth2/authorization",
)
defaultResolver.setAuthorizationRequestCustomizer { builder ->
builder.scope("read:org")
}
authorizationEndpoint.authorizationRequestResolver(defaultResolver)
}
authorizationEndpoint.authorizationRequestResolver(defaultResolver)
}
}
}

@Bean
fun corsConfigurationSource(): CorsConfigurationSource {
val configuration = CorsConfiguration()
configuration.allowedOrigins = listOf("*")
configuration.allowedMethods = listOf("*")
configuration.allowedOrigins = listOf("http://localhost:5173")
configuration.allowedMethods = listOf("GET", "POST", "PUT", "DELETE", "PATCH")
configuration.allowedHeaders = listOf("*")
configuration.allowCredentials = true

Expand Down

0 comments on commit ead4abd

Please sign in to comment.