SUPPORT-8755: Fix
This commit is contained in:
parent
f86a8afd2f
commit
1a1ca85a63
2 changed files with 11 additions and 4 deletions
|
|
@ -20,14 +20,18 @@ public class TokensStore {
|
|||
}
|
||||
|
||||
public static String getAccessToken(String prnOid) {
|
||||
return accessTokensMap.get(prnOid).getAccessToken();
|
||||
}
|
||||
|
||||
public static boolean validateAccessToken(String prnOid) {
|
||||
ExpiringToken token = accessTokensMap.get(prnOid);
|
||||
if (token == null) {
|
||||
throw new CredentialsExpiredException("No access token for prnOid: " + prnOid);
|
||||
throw new CredentialsExpiredException("No ESIA access token for prnOid: " + prnOid);
|
||||
}
|
||||
else if (token.isExpired()) {
|
||||
throw new CredentialsExpiredException("Access token expired for prnOid: " + prnOid);
|
||||
throw new CredentialsExpiredException("ESIA access token expired for prnOid: " + prnOid);
|
||||
}
|
||||
return token.getAccessToken();
|
||||
return token.getAccessToken() != null;
|
||||
}
|
||||
|
||||
public static void removeExpiredAccessToken() {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,10 @@ public class JwtAuthenticationFilter extends AbstractAuthenticationProcessingFil
|
|||
if (ids.length != 2) {
|
||||
throw new CredentialsExpiredException("Invalid token. User has no ervuId");
|
||||
}
|
||||
TokensStore.getAccessToken(token.getUserAccountId());
|
||||
boolean hasEsiaAccessToken = TokensStore.validateAccessToken(token.getUserAccountId());
|
||||
if (!hasEsiaAccessToken) {
|
||||
throw new CredentialsExpiredException("ESIA access token is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CredentialsExpiredException e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue