public class AppIdentityCredential extends Object implements HttpRequestInitializer, HttpExecuteInterceptor
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.
Modifier and Type | Class and Description |
---|---|
static class |
AppIdentityCredential.AppEngineCredentialWrapper
Beta Credential wrapper for application identity that inherits from GoogleCredential. |
static class |
AppIdentityCredential.Builder
Builder for
AppIdentityCredential . |
Modifier | Constructor and Description |
---|---|
protected |
AppIdentityCredential(AppIdentityCredential.Builder builder) |
|
AppIdentityCredential(Collection<String> scopes) |
Modifier and Type | Method and Description |
---|---|
AppIdentityService |
getAppIdentityService()
Gets the App Identity Service that provides the access token.
|
Collection<String> |
getScopes()
Gets the OAuth scopes (unmodifiable).
|
void |
initialize(HttpRequest request) |
void |
intercept(HttpRequest request) |
public AppIdentityCredential(Collection<String> scopes)
scopes
- OAuth scopesprotected AppIdentityCredential(AppIdentityCredential.Builder builder)
builder
- builderpublic void initialize(HttpRequest request) throws IOException
initialize
in interface HttpRequestInitializer
IOException
public void intercept(HttpRequest request) throws IOException
intercept
in interface HttpExecuteInterceptor
IOException
public final AppIdentityService getAppIdentityService()
public final Collection<String> getScopes()
Copyright © 2010–2020 Google. All rights reserved.