Skip to content

Commit

Permalink
Merge pull request #1500 from Skyllarr/WFCORE-5319
Browse files Browse the repository at this point in the history
[ELY-2104] two calls to introspection endpoint for one request with JWT
  • Loading branch information
darranl authored Mar 18, 2021
2 parents 6009530 + 663f3ef commit f7085f3
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 f7085f3

Please sign in to comment.