com.nimbusds.jose
Class JWKSet

java.lang.Object
  extended by com.nimbusds.jose.JWKSet

public class JWKSet
extends java.lang.Object

JSON Web Key (JWK) set. Represented by a JSON object that contains an array of JSON Web Keys (JWKs) as the value of its "keys" member. Additional (custom) members of the JWK Set JSON object are also supported.

Example JSON Web Key (JWK) set:

 {
   "keys" : [ { "kty" : "EC",
                "crv" : "P-256",
                "x"   : "MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4",
                "y"   : "4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM",
                "use" : "enc",
                "kid" : "1" },

              { "kty" : "RSA",
                "n"   : "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx
                         4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMs
                         tn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2
                         QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbI
                         SD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqb
                         w0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",
                "e"   : "AQAB",
                "alg" : "RS256",
                "kid" : "2011-04-29" } ]
 }
 

Version:
$version$ (2013-01-08)
Author:
Vladimir Dzhuvinov

Constructor Summary
JWKSet()
          Creates a new empty JSON Web Key (JWK) set.
JWKSet(JWK key)
          Creates a new JSON Web Key (JWK) set with a single key.
JWKSet(java.util.List<JWK> keys)
          Creates a new JSON Web Key (JWK) set with the specified keys.
JWKSet(java.util.List<JWK> keys, java.util.Map<java.lang.String,java.lang.Object> customMembers)
          Creates a new JSON Web Key (JWK) set with the specified keys and additional custom members.
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Object> getAdditionalMembers()
          Gets the additional custom members of this JSON Web Key (JWK) set.
 java.util.List<JWK> getKeys()
          Gets the keys (ordered) of this JSON Web Key (JWK) set.
static JWKSet parse(net.minidev.json.JSONObject json)
          Parses the specified JSON object representing a JSON Web Key (JWK) set.
static JWKSet parse(java.lang.String s)
          Parses the specified string representing a JSON Web Key (JWK) set.
 net.minidev.json.JSONObject toJSONObject()
          Returns a JSON object representation of this JSON Web Key (JWK) set.
 java.lang.String toString()
          Returns the JSON object string representation of this JSON Web Key (JWK) set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JWKSet

public JWKSet()
Creates a new empty JSON Web Key (JWK) set.


JWKSet

public JWKSet(JWK key)
Creates a new JSON Web Key (JWK) set with a single key.

Parameters:
key - The JWK. Must not be null.

JWKSet

public JWKSet(java.util.List<JWK> keys)
Creates a new JSON Web Key (JWK) set with the specified keys.

Parameters:
keys - The JWK list. Must not be null.

JWKSet

public JWKSet(java.util.List<JWK> keys,
              java.util.Map<java.lang.String,java.lang.Object> customMembers)
Creates a new JSON Web Key (JWK) set with the specified keys and additional custom members.

Parameters:
keys - The JWK list. Must not be null.
customMembers - The additional custom members. Must not be null.
Method Detail

getKeys

public java.util.List<JWK> getKeys()
Gets the keys (ordered) of this JSON Web Key (JWK) set.

Returns:
The keys, empty list if none.

getAdditionalMembers

public java.util.Map<java.lang.String,java.lang.Object> getAdditionalMembers()
Gets the additional custom members of this JSON Web Key (JWK) set.

Returns:
The additional custom members, empty map if none.

toJSONObject

public net.minidev.json.JSONObject toJSONObject()
Returns a JSON object representation of this JSON Web Key (JWK) set.

Returns:
The JSON object representation.

toString

public java.lang.String toString()
Returns the JSON object string representation of this JSON Web Key (JWK) set.

Overrides:
toString in class java.lang.Object
Returns:
The JSON object string representation.

parse

public static JWKSet parse(java.lang.String s)
                    throws java.text.ParseException
Parses the specified string representing a JSON Web Key (JWK) set.

Parameters:
s - The string to parse. Must not be null.
Returns:
The JSON Web Key (JWK) set.
Throws:
java.text.ParseException - If the string couldn't be parsed to a valid JSON Web Key (JWK) set.

parse

public static JWKSet parse(net.minidev.json.JSONObject json)
                    throws java.text.ParseException
Parses the specified JSON object representing a JSON Web Key (JWK) set.

Parameters:
json - The JSON object to parse. Must not be null.
Returns:
The JSON Web Key (JWK) set.
Throws:
java.text.ParseException - If the string couldn't be parsed to a valid JSON Web Key (JWK) set.


Copyright © 2013 NimbusDS. All Rights Reserved.