Package org.forgerock.json.jose.jwk
Class JWKSet
- java.lang.Object
 - 
- org.forgerock.json.jose.jwt.JWObject
 - 
- org.forgerock.json.jose.jwk.JWKSet
 
 
 
- 
public class JWKSet extends JWObject
Holds a Set of JWKs. 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JWKfindJwk(String kid)Search for a JWK that matches the kid.JWKfindJwk(Algorithm algorithm, String keyUse)Search for a JWK that matches the algorithm and the key usage.JsonValuegetJWKsAsJsonValue()Get the JWKs in the set.List<JWK>getJWKsAsList()Get the JWKs in the set.static JWKSetparse(String json)Parses a JWKSet object from a string json object.static JWKSetparse(JsonValue json)Parses a JWKSet object from a jsonValue object.StringtoJsonString()Prints the JWK Set as a json string.protected static JsonValuetoJsonValue(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 Detail
- 
JWKSet
public JWKSet()
Constructs an empty JWKSet. 
- 
JWKSet
public JWKSet(JWK jwk)
Construct a JWKSet from a single JWK.- Parameters:
 jwk- the jwk to construct the set from
 
- 
JWKSet
public JWKSet(JsonValue jwks)
Construct a JWKSet from a single JWK.- Parameters:
 jwks- contains a list of json web keys
 
 - 
 
- 
Method Detail
- 
getJWKsAsJsonValue
public JsonValue getJWKsAsJsonValue()
Get the JWKs in the set.- Returns:
 - a list of JWKs as JsonValues
 
 
- 
toJsonValue
protected static JsonValue toJsonValue(String json)
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
public static JWKSet parse(String json)
Parses a JWKSet object from a string json object.- Parameters:
 json- string json object- Returns:
 - a JWKSet
 
 
- 
parse
public static JWKSet parse(JsonValue json)
Parses a JWKSet object from a jsonValue object.- Parameters:
 json- an JsonValue object- Returns:
 - a JWKSet
 
 
- 
toJsonString
public String toJsonString()
Prints the JWK Set as a json string.- Returns:
 - A String representing JWK
 
 
- 
findJwk
public JWK findJwk(Algorithm algorithm, String keyUse)
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.
 
 
 - 
 
 -