Skip to content

Commit

Permalink
[ELY-2104] two calls to introspection endpoint for one request with JWT
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyllarr committed Mar 15, 2021
1 parent 6009530 commit 663f3ef
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,21 @@ public <C extends Credential> C getCredential(Class<C> credentialType) throws Re

@Override
public SupportLevel getEvidenceVerifySupport(Class<? extends Evidence> evidenceType, String algorithmName) throws RealmUnavailableException {
if (exists() && isBearerTokenEvidence(evidenceType)) {
if (isBearerTokenEvidence(evidenceType)) {
return SupportLevel.SUPPORTED;
}

return SupportLevel.UNSUPPORTED;
}

private void setClaims(Attributes claims) throws RealmUnavailableException {
this.claims = claims;
}

private Attributes getClaims() throws RealmUnavailableException {
if (this.claims == null) {
this.claims = validateToken(this.evidence);
validateToken(this.evidence);
}

return this.claims;
}

Expand All @@ -204,7 +207,8 @@ private Attributes validateToken(Evidence evidence) throws RealmUnavailableExcep
}
BearerTokenEvidence tokenEvidence = BearerTokenEvidence.class.cast(evidence);
try {
return strategy.validate(tokenEvidence);
setClaims(strategy.validate(tokenEvidence));
return this.claims;
} catch (RealmUnavailableException rue) {
throw rue;
} catch (Exception unknown) {
Expand Down

0 comments on commit 663f3ef

Please sign in to comment.