Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
liberhe committed Jan 7, 2024
2 parents 5302a74 + cd86cdb commit 47e2390
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");


/**
Expand Down Expand Up @@ -163,18 +163,21 @@ public BaseResponse<String> 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()));
Expand Down

0 comments on commit 47e2390

Please sign in to comment.