com.google.api.client.extensions.appengine.auth.helpers
Class AppAssertionCredential

java.lang.Object
  extended by com.google.api.client.extensions.appengine.auth.helpers.AppAssertionCredential
All Implemented Interfaces:
Credential, HttpExecuteInterceptor, HttpRequestInitializer, HttpUnsuccessfulResponseHandler

public final class AppAssertionCredential
extends Object
implements Credential

Implementation of credentials that is used to communicate with resources managed on behalf of an App Engine application.

Since:
1.6
Author:
moshenko@google.com (Jake Moshenko)

Constructor Summary
AppAssertionCredential(String applicationName, String authorizationServerUrl, String scope, String audience)
          Create an instance of this class.
 
Method Summary
 boolean handleResponse(HttpRequest request, HttpResponse response, boolean retrySupported)
           
 void initialize(HttpRequest request)
           
 void intercept(HttpRequest request)
           
 boolean isInvalid()
          Determine if the Credential is no longer valid, after being revoked for example.
 void postConstruct(HttpTransport transport, JsonFactory jsonFactory)
          Finish building the object.
 void setAccessToken(String accessToken)
          Set the access token to a new value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppAssertionCredential

public AppAssertionCredential(String applicationName,
                              String authorizationServerUrl,
                              String scope,
                              String audience)
Create an instance of this class. This will only set up on the object, and a call to postConstruct(com.google.api.client.http.HttpTransport, com.google.api.client.json.JsonFactory) is required before it can be used.

Parameters:
applicationName - Primary key for this data object in the data store. It is usually the robot name.
authorizationServerUrl - Server with which we can exchange an assertion for an access token.
scope - Scope(s) for which this credential will request access.
audience - Audience to be used in the JSON web token.
Method Detail

setAccessToken

public void setAccessToken(String accessToken)
Set the access token to a new value.

Parameters:
accessToken - New access token or null for none

postConstruct

public void postConstruct(HttpTransport transport,
                          JsonFactory jsonFactory)
                   throws IOException
Finish building the object. This should be called whether the object is loaded using JDO or created using the constructor.

Parameters:
transport - HttpTransport instance to use to access the network.
jsonFactory - JsonFactory instance to use to serialize and deserialize auth server communications.
Throws:
IOException - Thrown when we are unable to set up access token communications.

initialize

public void initialize(HttpRequest request)
                throws IOException
Specified by:
initialize in interface HttpRequestInitializer
Throws:
IOException

intercept

public void intercept(HttpRequest request)
               throws IOException
Specified by:
intercept in interface HttpExecuteInterceptor
Throws:
IOException

handleResponse

public boolean handleResponse(HttpRequest request,
                              HttpResponse response,
                              boolean retrySupported)
                       throws IOException
Specified by:
handleResponse in interface HttpUnsuccessfulResponseHandler
Throws:
IOException

isInvalid

public boolean isInvalid()
Description copied from interface: Credential
Determine if the Credential is no longer valid, after being revoked for example.

Specified by:
isInvalid in interface Credential


Copyright © 2011 Google. All Rights Reserved.