com.google.api.client.auth.jsontoken
Class JsonWebSignature

java.lang.Object
  extended by com.google.api.client.auth.jsontoken.JsonWebToken
      extended by com.google.api.client.auth.jsontoken.JsonWebSignature

public class JsonWebSignature
extends JsonWebToken

JSON Web Signature (JWS).

Sample usage:

  public static void printPayload(JsonFactory jsonFactory, String tokenString) throws IOException {
    JsonWebSignature jws = JsonWebSignature.parse(jsonFactory, tokenString);
    System.out.println(jws.getPayload());
  }
 

Implementation is not thread-safe.

Since:
1.7
Author:
Yaniv Inbar

Nested Class Summary
static class JsonWebSignature.Header
          Header as specified in Reserved Header Parameter Names.
static class JsonWebSignature.Parser
          JWS parser.
 
Nested classes/interfaces inherited from class com.google.api.client.auth.jsontoken.JsonWebToken
JsonWebToken.Payload
 
Constructor Summary
JsonWebSignature(JsonWebSignature.Header header, JsonWebToken.Payload payload, byte[] signatureBytes, byte[] signedContentBytes)
           
 
Method Summary
 JsonWebSignature.Header getHeader()
          Returns the header.
 byte[] getSignatureBytes()
          Returns the bytes of the signature.
 byte[] getSignedContentBytes()
          Returns the bytes of the signature content.
static JsonWebSignature parse(JsonFactory jsonFactory, String tokenString)
          Parses the given JWS token string and returns the parsed JsonWebSignature.
static JsonWebSignature.Parser parser(JsonFactory jsonFactory)
          Returns a new instance of a JWS parser.
 
Methods inherited from class com.google.api.client.auth.jsontoken.JsonWebToken
getPayload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonWebSignature

public JsonWebSignature(JsonWebSignature.Header header,
                        JsonWebToken.Payload payload,
                        byte[] signatureBytes,
                        byte[] signedContentBytes)
Parameters:
header - header
payload - payload
signatureBytes - bytes of the signature
signedContentBytes - bytes of the signature content
Method Detail

getHeader

public JsonWebSignature.Header getHeader()
Description copied from class: JsonWebToken
Returns the header.

Subclasses may override only to change the return type.

Overrides:
getHeader in class JsonWebToken

getSignatureBytes

public final byte[] getSignatureBytes()
Returns the bytes of the signature.


getSignedContentBytes

public final byte[] getSignedContentBytes()
Returns the bytes of the signature content.


parse

public static JsonWebSignature parse(JsonFactory jsonFactory,
                                     String tokenString)
                              throws IOException
Parses the given JWS token string and returns the parsed JsonWebSignature.

Parameters:
jsonFactory - JSON factory
tokenString - JWS token string
Returns:
parsed JWS
Throws:
IOException

parser

public static JsonWebSignature.Parser parser(JsonFactory jsonFactory)
Returns a new instance of a JWS parser.



Copyright © 2011-2012 Google. All Rights Reserved.