Created
August 26, 2022 19:34
-
-
Save stefanozanella/4dfa5d060561d3d4d2817d1c88c22306 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
class WebSecurityConfig { | |
@Bean | |
fun oauth2Configuration(http: HttpSecurity): SecurityFilterChain = | |
http | |
// ... | |
.and() | |
.userInfoEndpoint() | |
.userService(oauth2UserService()) | |
.and().and() | |
.build() | |
private fun oauth2UserService() = DefaultOAuth2UserService().apply { | |
setRequestEntityConverter { request -> | |
RequestEntity.get( | |
request.clientRegistration.providerDetails.userInfoEndpoint.uri, | |
request.accessToken.tokenValue, | |
).build() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment