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 classAppEngineCredentials.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 GoogleCredentialscreateScoped(Collection<String> scopes)If the credentials support scopes, creates a copy of the identity with the specified scopes; otherwise, returns the same instance.booleancreateScopedRequired()Indicates whether the credentials require scopes to be specified via a call toGoogleCredentials.createScoped(java.util.Collection<java.lang.String>)before use.booleanequals(Object obj)StringgetAccount()Returns the service account associated with the signer.inthashCode()static AppEngineCredentials.BuildernewBuilder()AccessTokenrefreshAccessToken()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.BuildertoBuilder()StringtoString()-
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:
refreshAccessTokenin classOAuth2Credentials- Returns:
- never
- Throws:
IOException
-
createScopedRequired
public boolean createScopedRequired()
Description copied from class:GoogleCredentialsIndicates whether the credentials require scopes to be specified via a call toGoogleCredentials.createScoped(java.util.Collection<java.lang.String>)before use.- Overrides:
createScopedRequiredin classGoogleCredentials- Returns:
- Whether the credentials require scopes to be specified.
-
createScoped
public GoogleCredentials createScoped(Collection<String> scopes)
Description copied from class:GoogleCredentialsIf the credentials support scopes, creates a copy of the identity with the specified scopes; otherwise, returns the same instance.- Overrides:
createScopedin classGoogleCredentials- Parameters:
scopes- Collection of scopes to request.- Returns:
- GoogleCredentials with requested scopes.
-
getAccount
public String getAccount()
Description copied from interface:ServiceAccountSignerReturns the service account associated with the signer.- Specified by:
getAccountin interfaceServiceAccountSigner- Returns:
- The service account associated with the signer.
-
sign
public byte[] sign(byte[] toSign)
Description copied from interface:ServiceAccountSignerSigns the provided bytes using the private key associated with the service account.- Specified by:
signin interfaceServiceAccountSigner- Parameters:
toSign- bytes to sign- Returns:
- signed bytes
-
hashCode
public int hashCode()
- Overrides:
hashCodein classOAuth2Credentials
-
toString
public String toString()
- Overrides:
toStringin classOAuth2Credentials
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classOAuth2Credentials
-
newBuilder
public static AppEngineCredentials.Builder newBuilder()
-
toBuilder
public AppEngineCredentials.Builder toBuilder()
- Overrides:
toBuilderin classGoogleCredentials
-
-