Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sadilchamishka committed Oct 17, 2023
1 parent 38a41d8 commit 43bb4e5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,11 @@ public static void clearOAuthCache(String consumerKey, AuthenticatedUser authori
/**
* Clear OAuth cache based on the application, authorized user, scope list and token binding reference.
*
* @param consumerKey Client id of the application the token issued to.
* @param authorizedUser Authorized user.
* @param scope Scope list.
* @param tokenBindingReference Token binding reference.
* @param consumerKey Client id of the application the token issued to.
* @param authorizedUser Authorized user.
* @param scope Scope list.
* @param tokenBindingReference Token binding reference.
* @param authorizedOrganization Authorized organization.
*/
public static void clearOAuthCache(String consumerKey, AuthenticatedUser authorizedUser, String scope,
String tokenBindingReference, String authorizedOrganization) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private void insertAccessToken(String accessToken, String consumerKey, AccessTok
}

String authorizedOrganization = accessTokenDO.getAuthzUser().getAccessingOrganization();
if (StringUtils.isEmpty(authorizedOrganization)) {
if (StringUtils.isBlank(authorizedOrganization)) {
authorizedOrganization = OAuthConstants.AuthorizedOrganization.NONE;
}
insertTokenPrepStmt.setString(19, authorizedOrganization);
Expand Down Expand Up @@ -461,7 +461,7 @@ public AccessTokenDO getLatestAccessToken(String consumerKey, AuthenticatedUser
}
String tenantDomain = getUserResidentTenantDomain(authzUser);
String authorizedOrganization = authzUser.getAccessingOrganization();
if (StringUtils.isEmpty(authorizedOrganization)) {
if (StringUtils.isBlank(authorizedOrganization)) {
authorizedOrganization = OAuthConstants.AuthorizedOrganization.NONE;
}
int tenantId = OAuth2Util.getTenantId(tenantDomain);
Expand Down Expand Up @@ -711,7 +711,7 @@ private AccessTokenDO getLatestAccessTokenByState(Connection connection, String
String tenantDomain = getUserResidentTenantDomain(authzUser);

String authorizedOrganization = authzUser.getAccessingOrganization();
if (StringUtils.isEmpty(authorizedOrganization)) {
if (StringUtils.isBlank(authorizedOrganization)) {
authorizedOrganization = OAuthConstants.AuthorizedOrganization.NONE;
}

Expand Down Expand Up @@ -3057,7 +3057,7 @@ private String getUserResidentTenantDomain(AuthenticatedUser authenticatedUser)
return OAuth2ServiceComponentHolder.getInstance().getOrganizationManager()
.resolveTenantDomain(authenticatedUser.getUserResidentOrganization());
} catch (OrganizationManagementException e) {
throw new IdentityOAuth2Exception("Error occurred while resolving tenant domain by organization ID: " +
throw new IdentityOAuth2Exception("Error occurred while resolving tenant domain of organization ID: " +
authenticatedUser.getUserResidentOrganization(), e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ private void updateCacheIfEnabled(AccessTokenDO newTokenBean, String scope, Oaut
try {
userId = tokenToCache.getAuthzUser().getUserId();
authorizedOrganization = tokenToCache.getAuthzUser().getAccessingOrganization();
if (StringUtils.isEmpty(authorizedOrganization)) {
if (StringUtils.isBlank(authorizedOrganization)) {
authorizedOrganization = OAuthConstants.AuthorizedOrganization.NONE;
}
} catch (UserIdNotFoundException e) {
Expand Down

0 comments on commit 43bb4e5

Please sign in to comment.