Fix bug in oauth2Login sample

This commit is contained in:
Joe Grandja 2017-10-10 14:40:11 -04:00
parent da0a7afa38
commit bd4d814e4b
1 changed files with 1 additions and 4 deletions

View File

@ -36,8 +36,6 @@ import java.util.Map;
*/ */
@Controller @Controller
public class MainController { public class MainController {
private WebClient webClient = WebClient.create();
@RequestMapping("/") @RequestMapping("/")
public String index(Model model, @AuthenticationPrincipal OAuth2User user, OAuth2UserAuthenticationToken authentication) { public String index(Model model, @AuthenticationPrincipal OAuth2User user, OAuth2UserAuthenticationToken authentication) {
@ -52,8 +50,7 @@ public class MainController {
String userInfoEndpointUri = authentication.getClientAuthentication().getClientRegistration() String userInfoEndpointUri = authentication.getClientAuthentication().getClientRegistration()
.getProviderDetails().getUserInfoEndpoint().getUri(); .getProviderDetails().getUserInfoEndpoint().getUri();
if (!StringUtils.isEmpty(userInfoEndpointUri)) { // userInfoEndpointUri is optional for OIDC Clients if (!StringUtils.isEmpty(userInfoEndpointUri)) { // userInfoEndpointUri is optional for OIDC Clients
userAttributes = this.webClient userAttributes = WebClient.builder()
.mutate()
.filter(oauth2Credentials(authentication)) .filter(oauth2Credentials(authentication))
.build() .build()
.get() .get()