LocatorAdapter
with
JwtParserBuilder.keyLocator(Locator)
@Deprecated public class SigningKeyResolverAdapter extends Object implements SigningKeyResolver
As of JJWT 0.12.0, various Resolver concepts (including the SigningKeyResolver
) have been
unified into a single Locator
interface. For key location, (for both signing and encryption keys),
use the JwtParserBuilder.keyLocator(Locator)
to configure a parser with your desired Key locator instead
of using a SigningKeyResolver
. Also see LocatorAdapter
for the Adapter pattern parallel of this
class. This SigningKeyResolverAdapter
class will be removed before the 1.0 release.
Previous Documentation
An Adapter implementation of the
SigningKeyResolver
interface that allows subclasses to process only the type of JWS body that
is known/expected for a particular case.
The resolveSigningKey(JwsHeader, Claims)
and resolveSigningKey(JwsHeader, byte[])
method
implementations delegate to the
resolveSigningKeyBytes(JwsHeader, Claims)
and resolveSigningKeyBytes(JwsHeader, byte[])
methods
respectively. The latter two methods simply throw exceptions: they represent scenarios expected by
calling code in known situations, and it is expected that you override the implementation in those known situations;
non-overridden *KeyBytes methods indicates that the JWS input was unexpected.
If either resolveSigningKey(JwsHeader, byte[])
or resolveSigningKey(JwsHeader, Claims)
are not overridden, one (or both) of the *KeyBytes variants must be overridden depending on your expected
use case. You do not have to override any method that does not represent an expected condition.
JwtParserBuilder.keyLocator(Locator)
,
LocatorAdapter
Constructor and Description |
---|
SigningKeyResolverAdapter()
Deprecated.
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Key |
resolveSigningKey(JwsHeader header,
byte[] content)
Deprecated.
Returns the signing key that should be used to validate a digital signature for the content JWS with the
specified header and byte array payload.
|
Key |
resolveSigningKey(JwsHeader header,
Claims claims)
Deprecated.
Returns the signing key that should be used to validate a digital signature for the Claims JWS with the specified
header and claims.
|
byte[] |
resolveSigningKeyBytes(JwsHeader header,
byte[] content)
Deprecated.
Convenience method invoked by
resolveSigningKey(JwsHeader, byte[]) that obtains the necessary signing
key bytes. |
byte[] |
resolveSigningKeyBytes(JwsHeader header,
Claims claims)
Deprecated.
Convenience method invoked by
resolveSigningKey(JwsHeader, Claims) that obtains the necessary signing
key bytes. |
public SigningKeyResolverAdapter()
public Key resolveSigningKey(JwsHeader header, Claims claims)
SigningKeyResolver
resolveSigningKey
in interface SigningKeyResolver
header
- the header of the JWS to validateclaims
- the Claims payload of the JWS to validatepublic Key resolveSigningKey(JwsHeader header, byte[] content)
SigningKeyResolver
resolveSigningKey
in interface SigningKeyResolver
header
- the header of the JWS to validatecontent
- the byte array payload of the JWS to validatepublic byte[] resolveSigningKeyBytes(JwsHeader header, Claims claims)
resolveSigningKey(JwsHeader, Claims)
that obtains the necessary signing
key bytes. This implementation simply throws an exception: if the JWS parsed is a Claims JWS, you must
override this method or the resolveSigningKey(JwsHeader, Claims)
method instead.
NOTE: You cannot override this method when validating RSA signatures. If you expect RSA signatures,
you must override the resolveSigningKey(JwsHeader, Claims)
method instead.
public byte[] resolveSigningKeyBytes(JwsHeader header, byte[] content)
resolveSigningKey(JwsHeader, byte[])
that obtains the necessary signing
key bytes. This implementation simply throws an exception: if the JWS parsed is a content JWS, you must
override this method or the resolveSigningKey(JwsHeader, byte[])
method instead.header
- the parsed JwsHeader
content
- the byte array payloadCopyright © 2014–2025 jsonwebtoken.io. All rights reserved.