public class AppIdentityCredential implements HttpRequestInitializer, HttpExecuteInterceptor
OAuth 2.0 credential in which a client Google App Engine application needs to access data that it owns, based on <a href="https://developers.google.com/appengine/docs/java/appidentity/
Java_Asserting_identity_to_Google_APIs">Asserting Identity to Google APIs
Intercepts the request by using the access token obtained from AppIdentityService#getAccessToken(Iterable).
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.
Implements
com.google.api.client.http.HttpRequestInitializer, com.google.api.client.http.HttpExecuteInterceptorConstructors
AppIdentityCredential(AppIdentityCredential.Builder builder)
protected AppIdentityCredential(AppIdentityCredential.Builder builder)
Parameter | |
---|---|
Name | Description |
builder |
AppIdentityCredential.Builder builder |
AppIdentityCredential(Collection<String> scopes)
public AppIdentityCredential(Collection<String> scopes)
Parameter | |
---|---|
Name | Description |
scopes |
Collection<String> OAuth scopes |
Methods
getAppIdentityService()
public final AppIdentityService getAppIdentityService()
Gets the App Identity Service that provides the access token.
Returns | |
---|---|
Type | Description |
com.google.appengine.api.appidentity.AppIdentityService |
getScopes()
public final Collection<String> getScopes()
Gets the OAuth scopes (unmodifiable).
Returns | |
---|---|
Type | Description |
Collection<String> |
initialize(HttpRequest request)
public void initialize(HttpRequest request)
Parameter | |
---|---|
Name | Description |
request |
com.google.api.client.http.HttpRequest |
Exceptions | |
---|---|
Type | Description |
IOException |
intercept(HttpRequest request)
public void intercept(HttpRequest request)
Parameter | |
---|---|
Name | Description |
request |
com.google.api.client.http.HttpRequest |
Exceptions | |
---|---|
Type | Description |
IOException |