Skip to content

Commit

Permalink
only retrieve either a single key or a collection of keys from the si…
Browse files Browse the repository at this point in the history
…gning key resolver

this allows existing subclasses of the SigningKeyResolverAdaptor to work un-modified with these changes
the new methods are only necessary to override if you wish to take advantage of the ability to supply a collection of keys
  • Loading branch information
thepeachbeetle committed Jul 26, 2017
1 parent 08edd6f commit c1e9e9e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,20 @@ public Jwt parse(String jwt) throws ExpiredJwtException, MalformedJwtException,
Key key = this.signingKeyResolver.resolveSigningKey(jwsHeader, claims);
if (key != null)
keys.add(key);
Collection<Key> keyList = this.signingKeyResolver.resolveSigningKeys(jwsHeader, claims);
if (!Objects.isEmpty(keyList))
keys.addAll(keyList);
else {
Collection<Key> keyList = this.signingKeyResolver.resolveSigningKeys(jwsHeader, claims);
if (!Objects.isEmpty(keyList))
keys.addAll(keyList);
}
} else {
Key key = this.signingKeyResolver.resolveSigningKey(jwsHeader, payload);
if (key != null)
keys.add(key);
Collection<Key> keyList = this.signingKeyResolver.resolveSigningKeys(jwsHeader, payload);
if (!Objects.isEmpty(keyList))
keys.addAll(keyList);
else {
Collection<Key> keyList = this.signingKeyResolver.resolveSigningKeys(jwsHeader, payload);
if (!Objects.isEmpty(keyList))
keys.addAll(keyList);
}
}
}

Expand Down

0 comments on commit c1e9e9e

Please # to comment.