public class SigningKeyResolverAdapter extends java.lang.Object implements SigningKeyResolver
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, String)
method
implementations delegate to the
resolveSigningKeyBytes(JwsHeader, Claims)
and resolveSigningKeyBytes(JwsHeader, String)
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, String)
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.
构造器和说明 |
---|
SigningKeyResolverAdapter() |
限定符和类型 | 方法和说明 |
---|---|
java.security.Key |
resolveSigningKey(JwsHeader header,
Claims claims)
Returns the signing key that should be used to validate a digital signature for the Claims JWS with the specified
header and claims.
|
java.security.Key |
resolveSigningKey(JwsHeader header,
java.lang.String plaintext)
Returns the signing key that should be used to validate a digital signature for the Plaintext JWS with the
specified header and plaintext payload.
|
byte[] |
resolveSigningKeyBytes(JwsHeader header,
Claims claims)
Convenience method invoked by
resolveSigningKey(JwsHeader, Claims) that obtains the necessary signing
key bytes. |
byte[] |
resolveSigningKeyBytes(JwsHeader header,
java.lang.String payload)
Convenience method invoked by
resolveSigningKey(JwsHeader, String) that obtains the necessary signing
key bytes. |
public java.security.Key resolveSigningKey(JwsHeader header, Claims claims)
SigningKeyResolver
resolveSigningKey
在接口中 SigningKeyResolver
header
- the header of the JWS to validateclaims
- the claims (body) of the JWS to validatepublic java.security.Key resolveSigningKey(JwsHeader header, java.lang.String plaintext)
SigningKeyResolver
resolveSigningKey
在接口中 SigningKeyResolver
header
- the header of the JWS to validateplaintext
- the plaintext body 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, java.lang.String payload)
resolveSigningKey(JwsHeader, String)
that obtains the necessary signing
key bytes. This implementation simply throws an exception: if the JWS parsed is a plaintext JWS, you must
override this method or the resolveSigningKey(JwsHeader, String)
method instead.header
- the parsed JwsHeader
payload
- the parsed String plaintext payload