public class GoogleCredentials extends OAuth2Credentials
OAuth2Credentials.CredentialsChangedListener| Modifier | Constructor and Description |
|---|---|
protected |
GoogleCredentials()
Default constructor.
|
|
GoogleCredentials(AccessToken accessToken)
Constructor with explicit access token.
|
| Modifier and Type | Method and Description |
|---|---|
GoogleCredentials |
createScoped(Collection<String> scopes)
If the credentials support scopes, create a copy of the the idenitity with the specified
scopes, otherwise returns the same instance.
|
boolean |
createScopedRequired()
Indicates whether the credentials require scopes to be specified via a call to
{link GoogleCredentials#createScoped} before use.
|
static GoogleCredentials |
fromStream(InputStream credentialsStream)
Returns credentials defined by a JSON file stream.
|
static GoogleCredentials |
fromStream(InputStream credentialsStream,
com.google.api.client.http.HttpTransport transport)
Returns credentials defined by a JSON file stream.
|
static GoogleCredentials |
getApplicationDefault()
Returns the Application Default Credentials.
|
static GoogleCredentials |
getApplicationDefault(com.google.api.client.http.HttpTransport transport)
Returns the Application Default Credentials.
|
addChangeListener, getAccessToken, getAuthenticationType, getRequestMetadata, hasRequestMetadata, hasRequestMetadataOnly, refresh, refreshAccessTokengetRequestMetadataprotected GoogleCredentials()
public GoogleCredentials(AccessToken accessToken)
accessToken - Initial or temporary access token.public static GoogleCredentials getApplicationDefault() throws IOException
Returns the Application Default Credentials which are credentials that identify and authorize the whole application. This is the built-in service account if running on Google Compute Engine or the credentials file from the path in the environment variable GOOGLE_APPLICATION_CREDENTIALS.
IOException - if the credentials cannot be created in the current environment.public static GoogleCredentials getApplicationDefault(com.google.api.client.http.HttpTransport transport) throws IOException
Returns the Application Default Credentials which are credentials that identify and authorize the whole application. This is the built-in service account if running on Google Compute Engine or the credentials file from the path in the environment variable GOOGLE_APPLICATION_CREDENTIALS.
transport - the transport for Http calls.IOException - if the credentials cannot be created in the current environment.public static GoogleCredentials fromStream(InputStream credentialsStream) throws IOException
The stream can contain a Service Account key file in JSON format from the Google Developers Console or a stored user credential using the format supported by the Cloud SDK.
credentialsStream - the stream with the credential definition.IOException - if the credential cannot be created from the stream.public static GoogleCredentials fromStream(InputStream credentialsStream, com.google.api.client.http.HttpTransport transport) throws IOException
The stream can contain a Service Account key file in JSON format from the Google Developers Console or a stored user credential using the format supported by the Cloud SDK.
credentialsStream - the stream with the credential definition.transport - the transport for Http calls.IOException - if the credential cannot be created from the stream.public boolean createScopedRequired()
public GoogleCredentials createScoped(Collection<String> scopes)
Copyright © 2015 Google. All rights reserved.