com.google.api.client.googleapis.auth.oauth2
Class GoogleIdToken
java.lang.Object
com.google.api.client.auth.jsontoken.JsonWebToken
com.google.api.client.auth.jsontoken.JsonWebSignature
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GoogleIdToken
public GoogleIdToken(JsonWebSignature.Header header,
GoogleIdToken.Payload payload,
byte[] signatureBytes,
byte[] signedContentBytes)
- Parameters:
header
- headerpayload
- payloadsignatureBytes
- bytes of the signaturesignedContentBytes
- bytes of the signature content
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 factoryidTokenString
- 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.