public class JWSAlgorithmFamilyJWSKeySelector<C extends SecurityContext> extends Object implements JWSKeySelector<C>
JWSKeySelector
that expects an algorithm from a specified
algorithm family.Constructor and Description |
---|
JWSAlgorithmFamilyJWSKeySelector(JWSAlgorithm.Family jwsAlgFamily,
JWKSource<C> jwkSource)
Creates a
JWSKeySelector that matches any algorithm from the
given JWSAlgorithm.Family . |
Modifier and Type | Method and Description |
---|---|
static <C extends SecurityContext> |
fromJWKSetURL(URL jwkSetURL)
Queries the given JWK Set
URL for keys, creating a
JWSAlgorithmFamilyJWSKeySelector based on the RSA or EC key
type, whichever comes back first. |
static <C extends SecurityContext> |
fromJWKSource(JWKSource<C> jwkSource)
Queries the given
JWKSource for keys, creating a
JWSAlgorithmFamilyJWSKeySelector based on the RSA or EC key
type, whichever comes back first. |
JWKSource<C> |
getJWKSource()
Returns the JWK source.
|
List<? extends Key> |
selectJWSKeys(JWSHeader header,
C context)
Selects key candidates for verifying a JWS object.
|
public JWSAlgorithmFamilyJWSKeySelector(JWSAlgorithm.Family jwsAlgFamily, JWKSource<C> jwkSource)
JWSKeySelector
that matches any algorithm from the
given JWSAlgorithm.Family
.public List<? extends Key> selectJWSKeys(JWSHeader header, C context) throws KeySourceException
JWSKeySelector
selectJWSKeys
in interface JWSKeySelector<C extends SecurityContext>
header
- The header of the JWS object. Must not be
null
.context
- Optional context of the JWS object, null
if
not required.KeySourceException
- If a key sourcing exception is
encountered, e.g. on remote JWK
retrieval.public static <C extends SecurityContext> JWSAlgorithmFamilyJWSKeySelector<C> fromJWKSetURL(URL jwkSetURL) throws KeySourceException
URL
for keys, creating a
JWSAlgorithmFamilyJWSKeySelector
based on the RSA or EC key
type, whichever comes back first.C
- The SecurityContext
jwkSetURL
- The JWK Set URL
to query.JWSAlgorithmFamilyJWSKeySelector
.KeySourceException
- if the JWKs cannot be retrieved or no RSA
or EC public JWKs are found.public static <C extends SecurityContext> JWSAlgorithmFamilyJWSKeySelector<C> fromJWKSource(JWKSource<C> jwkSource) throws KeySourceException
JWKSource
for keys, creating a
JWSAlgorithmFamilyJWSKeySelector
based on the RSA or EC key
type, whichever comes back first.C
- The SecurityContext
.jwkSource
- The JWKSource
.JWSAlgorithmFamilyJWSKeySelector
.KeySourceException
- If the JWKs cannot be retrieved or no
RSA or EC public JWKs are found.public JWKSource<C> getJWKSource()
Copyright © 2021 Connect2id Ltd.. All rights reserved.