Package com.google.auth.appengine
Class AppEngineCredentials
- java.lang.Object
-
- com.google.auth.Credentials
-
- com.google.auth.oauth2.OAuth2Credentials
-
- com.google.auth.oauth2.GoogleCredentials
-
- com.google.auth.appengine.AppEngineCredentials
-
- All Implemented Interfaces:
QuotaProjectIdProvider
,ServiceAccountSigner
,Serializable
public class AppEngineCredentials extends GoogleCredentials implements ServiceAccountSigner
OAuth2 credentials representing the built-in service account for Google App Engine. You should only use this class if you are running on AppEngine and are using urlfetch.Fetches access tokens from the App Identity service.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AppEngineCredentials.Builder
-
Nested classes/interfaces inherited from class com.google.auth.oauth2.OAuth2Credentials
OAuth2Credentials.CredentialsChangedListener
-
Nested classes/interfaces inherited from interface com.google.auth.ServiceAccountSigner
ServiceAccountSigner.SigningException
-
-
Field Summary
-
Fields inherited from class com.google.auth.oauth2.GoogleCredentials
quotaProjectId
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GoogleCredentials
createScoped(Collection<String> scopes)
If the credentials support scopes, creates a copy of the identity with the specified scopes; otherwise, returns the same instance.boolean
createScopedRequired()
Indicates whether the credentials require scopes to be specified via a call toGoogleCredentials.createScoped(java.util.Collection<java.lang.String>)
before use.boolean
equals(Object obj)
String
getAccount()
Returns the service account associated with the signer.int
hashCode()
static AppEngineCredentials.Builder
newBuilder()
AccessToken
refreshAccessToken()
Refresh the access token by getting it from the App Identity servicebyte[]
sign(byte[] toSign)
Signs the provided bytes using the private key associated with the service account.AppEngineCredentials.Builder
toBuilder()
String
toString()
-
Methods inherited from class com.google.auth.oauth2.GoogleCredentials
create, createDelegated, createScoped, createScoped, createWithCustomRetryStrategy, createWithQuotaProject, fromStream, fromStream, getAdditionalHeaders, getApplicationDefault, getApplicationDefault, getQuotaProjectId
-
Methods inherited from class com.google.auth.oauth2.OAuth2Credentials
addChangeListener, getAccessToken, getAuthenticationType, getFromServiceLoader, getRequestMetadata, getRequestMetadata, getRequestMetadataInternal, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, refreshIfExpired, removeChangeListener
-
Methods inherited from class com.google.auth.Credentials
blockingGetToCallback, getRequestMetadata
-
-
-
-
Method Detail
-
refreshAccessToken
public AccessToken refreshAccessToken() throws IOException
Refresh the access token by getting it from the App Identity service- Overrides:
refreshAccessToken
in classOAuth2Credentials
- Returns:
- never
- Throws:
IOException
-
createScopedRequired
public boolean createScopedRequired()
Description copied from class:GoogleCredentials
Indicates whether the credentials require scopes to be specified via a call toGoogleCredentials.createScoped(java.util.Collection<java.lang.String>)
before use.- Overrides:
createScopedRequired
in classGoogleCredentials
- Returns:
- Whether the credentials require scopes to be specified.
-
createScoped
public GoogleCredentials createScoped(Collection<String> scopes)
Description copied from class:GoogleCredentials
If the credentials support scopes, creates a copy of the identity with the specified scopes; otherwise, returns the same instance.- Overrides:
createScoped
in classGoogleCredentials
- Parameters:
scopes
- Collection of scopes to request.- Returns:
- GoogleCredentials with requested scopes.
-
getAccount
public String getAccount()
Description copied from interface:ServiceAccountSigner
Returns the service account associated with the signer.- Specified by:
getAccount
in interfaceServiceAccountSigner
- Returns:
- The service account associated with the signer.
-
sign
public byte[] sign(byte[] toSign)
Description copied from interface:ServiceAccountSigner
Signs the provided bytes using the private key associated with the service account.- Specified by:
sign
in interfaceServiceAccountSigner
- Parameters:
toSign
- bytes to sign- Returns:
- signed bytes
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classOAuth2Credentials
-
toString
public String toString()
- Overrides:
toString
in classOAuth2Credentials
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classOAuth2Credentials
-
newBuilder
public static AppEngineCredentials.Builder newBuilder()
-
toBuilder
public AppEngineCredentials.Builder toBuilder()
- Overrides:
toBuilder
in classGoogleCredentials
-
-