Skip to content

Commit

Permalink
Fix issues in adding backward compatibility to last password update c…
Browse files Browse the repository at this point in the history
…laim
  • Loading branch information
ChanikaRuchini committed Nov 8, 2021
1 parent 65d5ffa commit 3daa818
Showing 1 changed file with 8 additions and 16 deletions.
Expand Up @@ -260,24 +260,16 @@ private boolean hadPasswordExpired(String tenantDomain, String tenantAwareUserna
String passwordLastChangedTime;
String claimURI = PasswordPolicyConstants.LAST_CREDENTIAL_UPDATE_TIMESTAMP_CLAIM;
try {
ClaimManager claimManager = userRealm.getClaimManager();
if (claimManager.getClaim(claimURI) != null) {
passwordLastChangedTime = getLastPasswordUpdateTime(userStoreManager, claimURI, tenantAwareUsername);
if (passwordLastChangedTime == null) {
claimURI = PasswordPolicyConstants.LAST_CREDENTIAL_UPDATE_TIMESTAMP_CLAIM_NON_IDENTITY;
if (claimManager.getClaim(claimURI) != null) {
passwordLastChangedTime =
getLastPasswordUpdateTime(userStoreManager, claimURI, tenantAwareUsername);
}
}
} else if (claimManager
.getClaim(PasswordPolicyConstants.LAST_CREDENTIAL_UPDATE_TIMESTAMP_CLAIM_NON_IDENTITY) != null) {
passwordLastChangedTime = getLastPasswordUpdateTime(userStoreManager, claimURI, tenantAwareUsername);
if (passwordLastChangedTime == null) {
ClaimManager claimManager = userRealm.getClaimManager();
claimURI = PasswordPolicyConstants.LAST_CREDENTIAL_UPDATE_TIMESTAMP_CLAIM_NON_IDENTITY;
passwordLastChangedTime = getLastPasswordUpdateTime(userStoreManager, claimURI, tenantAwareUsername);
} else {
throw new AuthenticationFailedException("Error occurred while loading user claim - " + claimURI);
if (claimManager.getClaim(claimURI) != null) {
passwordLastChangedTime =
getLastPasswordUpdateTime(userStoreManager, claimURI, tenantAwareUsername);
}
}
} catch (UserStoreException e){
} catch (UserStoreException e) {
throw new AuthenticationFailedException("Error occurred while loading user claim - " + claimURI, e);
}

Expand Down

0 comments on commit 3daa818

Please sign in to comment.