public abstract class AuthCredentials extends Object implements Restorable<AuthCredentials>
| Modifier and Type | Class and Description |
|---|---|
static class |
AuthCredentials.AppEngineAuthCredentials
Represents built-in credentials when running in Google App Engine.
|
static class |
AuthCredentials.ApplicationDefaultAuthCredentials
Represents Application Default Credentials, which are credentials that are inferred from the
runtime environment.
|
static class |
AuthCredentials.NoAuthCredentials
A placeholder for credentials to signify that requests sent to the server should not be
authenticated.
|
static class |
AuthCredentials.OAuth2AuthCredentials
Represents OAuth2 credentials.
|
static class |
AuthCredentials.ServiceAccountAuthCredentials
Represents service account credentials.
|
| Constructor and Description |
|---|
AuthCredentials() |
| Modifier and Type | Method and Description |
|---|---|
static AuthCredentials |
createApplicationDefaults()
Returns the Application Default Credentials.
|
static AuthCredentials.OAuth2AuthCredentials |
createFor(String accessToken)
Creates OAuth2 Credentials given the string representation of an access token.
|
static AuthCredentials.OAuth2AuthCredentials |
createFor(String accessToken,
Date expirationTime)
Creates OAuth2 Credentials given the string representation of an access token and its
expiration time.
|
static AuthCredentials.ServiceAccountAuthCredentials |
createFor(String account,
PrivateKey privateKey)
Creates Service Account Credentials given an account id and a private key.
|
static AuthCredentials |
createForAppEngine() |
static AuthCredentials.ServiceAccountAuthCredentials |
createForJson(InputStream jsonCredentialStream)
Creates Service Account Credentials given a stream for credentials in JSON format.
|
abstract com.google.auth.oauth2.GoogleCredentials |
credentials() |
static AuthCredentials |
noAuth()
Creates a placeholder denoting that no credentials should be used.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcapturepublic abstract com.google.auth.oauth2.GoogleCredentials credentials()
public static AuthCredentials createForAppEngine()
public static AuthCredentials createApplicationDefaults() 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 can be read from the path in the environment variable GOOGLE_APPLICATION_CREDENTIALS.
IOException - if the credentials cannot be created in the current environmentpublic static AuthCredentials.ServiceAccountAuthCredentials createFor(String account, PrivateKey privateKey)
For details on how to obtain Service Account Credentials see Service Account Authentication.
account - id of the Service AccountprivateKey - private key associated to the accountpublic static AuthCredentials.OAuth2AuthCredentials createFor(String accessToken)
accessToken - string representation of an access tokenpublic static AuthCredentials.OAuth2AuthCredentials createFor(String accessToken, Date expirationTime)
accessToken - string representation of an access tokenpublic static AuthCredentials noAuth()
LocalDatastoreHelper and
LocalResourceManagerHelper.public static AuthCredentials.ServiceAccountAuthCredentials createForJson(InputStream jsonCredentialStream) throws IOException
For details on how to obtain Service Account Credentials in JSON format see Service Account Authentication.
jsonCredentialStream - stream for Service Account Credentials in JSON formatIOException - if the credentials cannot be created from the streamCopyright © 2016 Google. All rights reserved.