com.google.api.client.googleapis.auth.oauth2
Class GoogleIdToken

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

public class GoogleIdToken
extends JsonWebSignature

Google ID tokens.

Google ID tokens contain useful information such as the obfuscated Google user ID. Google ID tokens are signed and the signature must be verified using verify(GoogleIdTokenVerifier), which also checks that your application's client ID is the intended audience.

Implementation is not thread-safe.

Since:
1.7
Author:
Yaniv Inbar

Nested Class Summary
static class GoogleIdToken.Payload
          Google ID token payload.
 
Nested classes/interfaces inherited from class com.google.api.client.auth.jsontoken.JsonWebSignature
JsonWebSignature.Header, JsonWebSignature.Parser
 
Constructor Summary
GoogleIdToken(JsonWebSignature.Header header, GoogleIdToken.Payload payload, byte[] signatureBytes, byte[] signedContentBytes)
           
 
Method Summary
 GoogleIdToken.Payload getPayload()
           
static GoogleIdToken parse(JsonFactory jsonFactory, String idTokenString)
          Parses the given ID token string and returns the parsed GoogleIdToken.
 boolean verify(GoogleIdTokenVerifier verifier)
          Verifies that this ID token is valid using GoogleIdTokenVerifier.verify(GoogleIdToken).
 
Methods inherited from class com.google.api.client.auth.jsontoken.JsonWebSignature
getHeader, getSignatureBytes, getSignedContentBytes, parser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GoogleIdToken

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

parse

public static GoogleIdToken parse(JsonFactory jsonFactory,
                                  String idTokenString)
                           throws IOException
Parses the given ID token string and returns the parsed GoogleIdToken.

Parameters:
jsonFactory - JSON factory
idTokenString - ID token string
Returns:
parsed Google ID token
Throws:
IOException

verify

public boolean verify(GoogleIdTokenVerifier verifier)
               throws GeneralSecurityException,
                      IOException
Verifies that this ID token is valid using GoogleIdTokenVerifier.verify(GoogleIdToken).

Throws:
GeneralSecurityException
IOException

getPayload

public GoogleIdToken.Payload getPayload()
Overrides:
getPayload in class JsonWebToken


Copyright © 2010-2012 Google. All Rights Reserved.