com.nimbusds.jwt
Class EncryptedJWT

java.lang.Object
  extended by com.nimbusds.jose.JOSEObject
      extended by com.nimbusds.jose.JWEObject
          extended by com.nimbusds.jwt.EncryptedJWT
All Implemented Interfaces:
JWT

@ThreadSafe
public class EncryptedJWT
extends JWEObject
implements JWT

Encrypted JSON Web Token (JWT). This class is thread-safe.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class com.nimbusds.jose.JWEObject
JWEObject.State
 
Constructor Summary
EncryptedJWT(Base64URL firstPart, Base64URL secondPart, Base64URL thirdPart, Base64URL fourthPart, Base64URL fifthPart)
          Creates a new encrypted JSON Web Token (JWT) with the specified serialised parts.
EncryptedJWT(JWEHeader header, ReadOnlyJWTClaimsSet claimsSet)
          Creates a new to-be-encrypted JSON Web Token (JWT) with the specified header and claims set.
 
Method Summary
 ReadOnlyJWTClaimsSet getJWTClaimsSet()
          Gets the claims set of the JSON Web Token (JWT).
static EncryptedJWT parse(java.lang.String s)
          Parses an encrypted JSON Web Token (JWT) from the specified string in compact format.
 
Methods inherited from class com.nimbusds.jose.JWEObject
decrypt, encrypt, getCipherText, getEncryptedKey, getHeader, getInitializationVector, getIntegrityValue, getState, serialize
 
Methods inherited from class com.nimbusds.jose.JOSEObject
getParsedParts, getParsedString, getPayload, setParsedParts, setPayload, split
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.nimbusds.jwt.JWT
getHeader, getParsedParts, getParsedString, serialize
 

Constructor Detail

EncryptedJWT

public EncryptedJWT(JWEHeader header,
                    ReadOnlyJWTClaimsSet claimsSet)
Creates a new to-be-encrypted JSON Web Token (JWT) with the specified header and claims set. The initial state will be unencrypted.

Parameters:
header - The JWE header. Must not be null.
claimsSet - The JWT claims set. Must not be null.

EncryptedJWT

public EncryptedJWT(Base64URL firstPart,
                    Base64URL secondPart,
                    Base64URL thirdPart,
                    Base64URL fourthPart,
                    Base64URL fifthPart)
             throws java.text.ParseException
Creates a new encrypted JSON Web Token (JWT) with the specified serialised parts. The state will be encrypted.

Parameters:
firstPart - The first part, corresponding to the JWE header. Must not be null.
secondPart - The second part, corresponding to the encrypted key. Empty or null if none.
thirdPart - The third part, corresponding to the initialisation vectory. Empty or null if none.
fourthPart - The fourth part, corresponding to the cipher text. Must not be null.
fifthPart - The fifth part, corresponding to the integrity value. Empty of null if none.
Throws:
java.text.ParseException - If parsing of the serialised parts failed.
Method Detail

getJWTClaimsSet

public ReadOnlyJWTClaimsSet getJWTClaimsSet()
                                     throws java.text.ParseException
Description copied from interface: JWT
Gets the claims set of the JSON Web Token (JWT).

Specified by:
getJWTClaimsSet in interface JWT
Returns:
The claims set, null if not available (for an encrypted JWT that isn't decrypted).
Throws:
java.text.ParseException - If the payload of the JWT doesn't represent a valid JSON object and a JWT claims set.

parse

public static EncryptedJWT parse(java.lang.String s)
                          throws java.text.ParseException
Parses an encrypted JSON Web Token (JWT) from the specified string in compact format.

Parameters:
s - The string to parse. Must not be null.
Returns:
The encrypted JWT.
Throws:
java.text.ParseException - If the string couldn't be parsed to a valid encrypted JWT.


Copyright © 2013 NimbusDS. All Rights Reserved.