Package org.forgerock.json.jose.jwk
Class JWKSet
java.lang.Object
org.forgerock.json.jose.jwt.JWObject
org.forgerock.json.jose.jwk.JWKSet
Holds a Set of JWKs.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSearch for a JWK that matches the kid.Return a JWK that matches the JWK predicate.Search for a JWK that matches the algorithm and the key usage.Return a stream of JWK that matches the JWK predicate.Get the JWKs in the set.Get the JWKs in the set.static JWKSet
Parses a JWKSet object from a string json object.static JWKSet
Parses a JWKSet object from a jsonValue object.Prints the JWK Set as a json string.protected static JsonValue
toJsonValue
(String json) Converts a json string to a jsonValue.Methods inherited from class org.forgerock.json.jose.jwt.JWObject
checkListValuesAreOfType, checkValueIsOfType, equals, get, hashCode, isDefined, isValueOfType, keys, put, toJsonValue, toString
-
Constructor Details
-
JWKSet
public JWKSet()Constructs an empty JWKSet. -
JWKSet
Construct a JWKSet from a single JWK.- Parameters:
jwk
- the jwk to construct the set from
-
JWKSet
Construct a JWKSet from a single JWK.- Parameters:
jwks
- contains a list of json web keys
-
JWKSet
Construct a JWKSet from a List of JWKs.- Parameters:
jwkList
- a list of jwks
-
-
Method Details
-
getJWKsAsList
Get the JWKs in the set.- Returns:
- a list of JWKs
-
getJWKsAsJsonValue
Get the JWKs in the set.- Returns:
- a list of JWKs as JsonValues
-
toJsonValue
Converts a json string to a jsonValue.- Parameters:
json
- a json jwk set object string- Returns:
- a json value of the son string
- Throws:
JsonException
- if unable to parse
-
parse
Parses a JWKSet object from a string json object.- Parameters:
json
- string json object- Returns:
- a JWKSet
-
parse
Parses a JWKSet object from a jsonValue object.- Parameters:
json
- an JsonValue object- Returns:
- a JWKSet
-
toJsonString
Prints the JWK Set as a json string.- Returns:
- A String representing JWK
-
findJwk
Search for a JWK that matches the algorithm and the key usage.- Parameters:
algorithm
- the algorithm neededkeyUse
- the key usage. If null, only the algorithm will be used as a search criteria.- Returns:
- A jwk that matches the search criteria. If no JWK found for the key usage, then it searches for a JWK without key usage defined. If still no JWK found, then returns null.
-
findJwk
Search for a JWK that matches the kid.- Parameters:
kid
- Key ID- Returns:
- A jwk that matches the kid. If no JWK found, returns null
-
findJwks
Return a stream of JWK that matches the JWK predicate.- Parameters:
predicate
- for the matching JWK- Returns:
- a stream of JWK matching the predicate.
-
findJwk
Return a JWK that matches the JWK predicate.- Parameters:
predicate
- for the matching JWK- Returns:
- the first matching JWK.
-