com.google.api.client.googleapis.extensions.appengine.auth.oauth2
Class AppIdentityCredential

java.lang.Object
  extended by com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential
All Implemented Interfaces:
HttpExecuteInterceptor, HttpRequestInitializer

public class AppIdentityCredential
extends Object
implements HttpRequestInitializer, HttpExecuteInterceptor

OAuth 2.0 credential in which a client Google App Engine application needs to access data that it owns, based on Asserting Identity to Google APIs.

Sample usage:

  public static HttpRequestFactory createRequestFactory(
      HttpTransport transport, JsonFactory jsonFactory, TokenResponse tokenResponse) {
    return transport.createRequestFactory(
        new AppIdentityCredential("https://www.googleapis.com/auth/urlshortener"));
  }
 

Implementation is immutable and thread-safe.

Since:
1.7
Author:
Yaniv Inbar

Constructor Summary
AppIdentityCredential(Iterable<String> scopes)
           
AppIdentityCredential(String... scopes)
           
 
Method Summary
 void initialize(HttpRequest request)
           
 void intercept(HttpRequest request)
          Intercept the request by using the access token obtained from the AppIdentityService.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppIdentityCredential

public AppIdentityCredential(Iterable<String> scopes)
Parameters:
scopes - OAuth scopes

AppIdentityCredential

public AppIdentityCredential(String... scopes)
Parameters:
scopes - OAuth scopes
Method Detail

initialize

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

intercept

public void intercept(HttpRequest request)
               throws IOException
Intercept the request by using the access token obtained from the AppIdentityService. Any thrown AppIdentityServiceFailureException will be wrapped with an IOException.

Specified by:
intercept in interface HttpExecuteInterceptor
Throws:
IOException


Copyright © 2010-2012 Google. All Rights Reserved.