diff --git a/src/main/java/com/dl/officialsite/oauth2/controller/OAuthProcessController.java b/src/main/java/com/dl/officialsite/oauth2/controller/OAuthProcessController.java index 5ac47ba4..8bc764c1 100644 --- a/src/main/java/com/dl/officialsite/oauth2/controller/OAuthProcessController.java +++ b/src/main/java/com/dl/officialsite/oauth2/controller/OAuthProcessController.java @@ -103,11 +103,11 @@ public void handleAuthorization(@PathVariable("registrationId") String registrat String clientId = oAuthRegistration.getClientId(); String responseType = AUTHORIZATION_CODE; String state = DEFAULT_STATE_GENERATOR.generateKey(); - String redirectUri = expandRedirectUri( - registrationId, - request, - oAuthRegistration, - "bind"); +// String redirectUri = expandRedirectUri( +// registrationId, +// request, +// oAuthRegistration, +// "bind"); /** @@ -163,18 +163,21 @@ public BaseResponse receiveAuthorizationCode( throw new RuntimeException("Failed to get access token id "); } String accessToken = accessTokenResponse.getAccessToken(); + log.info("access token received"); /** * 3. Get user info via access_token */ IUserInfoRetrieveHandler retrieveHandler = this.userInfoRetrieveHandlers.get(registrationId); Assert.notNull(retrieveHandler, "retrieveHandler not found:"+registrationId); IUserInfo userInfo = retrieveHandler.retrieve(registration.getUserInfoUri(), accessToken); + log.info("user info {}", userInfo.getUsername()); Assert.notNull(userInfo, "failed to find userInfo"); /** * 4. Bind userInfo */ IOAuthBindHandler bindHandler = this.bindHandlers.get(registrationId); Assert.notNull(bindHandler, "bindHandler not found:"+registrationId); + bindHandler.bind(UserSecurityUtils.getUserLogin().getAddress(), userInfo); response.addCookie(new Cookie("oauth_"+registrationId, userInfo.getUsername()));