public class ComputeEngineCredentials extends GoogleCredentials implements ServiceAccountSigner
Fetches access tokens from the Google Compute Engine metadata server.
These credentials use the IAM API to sign data. See sign(byte[]) for more details.
| Modifier and Type | Class and Description |
|---|---|
static class |
ComputeEngineCredentials.Builder |
OAuth2Credentials.CredentialsChangedListenerServiceAccountSigner.SigningException| Modifier and Type | Method and Description |
|---|---|
static ComputeEngineCredentials |
create()
Create a new ComputeEngineCredentials instance with default behavior.
|
boolean |
equals(Object obj) |
String |
getAccount() |
static String |
getMetadataServerUrl() |
static String |
getMetadataServerUrl(com.google.auth.oauth2.DefaultCredentialsProvider provider) |
static String |
getServiceAccountsUrl() |
static String |
getTokenServerEncodedUrl() |
static String |
getTokenServerEncodedUrl(com.google.auth.oauth2.DefaultCredentialsProvider provider) |
int |
hashCode() |
static ComputeEngineCredentials.Builder |
newBuilder() |
AccessToken |
refreshAccessToken()
Refresh the access token by getting it from the GCE metadata server
|
byte[] |
sign(byte[] toSign)
Signs the provided bytes using the private key associated with the service account.
|
ComputeEngineCredentials.Builder |
toBuilder() |
String |
toString() |
create, createDelegated, createScoped, createScoped, createScopedRequired, fromStream, fromStream, getApplicationDefault, getApplicationDefaultaddChangeListener, getAccessToken, getAuthenticationType, getFromServiceLoader, getRequestMetadata, getRequestMetadata, getRequestMetadataInternal, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, refreshIfExpired, removeChangeListenerblockingGetToCallback, getRequestMetadatapublic static ComputeEngineCredentials create()
public AccessToken refreshAccessToken() throws IOException
refreshAccessToken in class OAuth2CredentialsIOException - from derived implementationspublic static String getMetadataServerUrl(com.google.auth.oauth2.DefaultCredentialsProvider provider)
public static String getMetadataServerUrl()
public static String getTokenServerEncodedUrl(com.google.auth.oauth2.DefaultCredentialsProvider provider)
public static String getTokenServerEncodedUrl()
public static String getServiceAccountsUrl()
public int hashCode()
hashCode in class OAuth2Credentialspublic String toString()
toString in class OAuth2Credentialspublic boolean equals(Object obj)
equals in class OAuth2Credentialspublic ComputeEngineCredentials.Builder toBuilder()
toBuilder in class GoogleCredentialspublic static ComputeEngineCredentials.Builder newBuilder()
public String getAccount()
getAccount in interface ServiceAccountSignerpublic byte[] sign(byte[] toSign)
The Compute Engine's project must enable the Identity and Access Management (IAM) API and the instance's service account must have the iam.serviceAccounts.signBlob permission.
sign in interface ServiceAccountSignertoSign - bytes to signSigningException - if the attempt to sign the provided bytes failedCopyright © 2019 Google. All rights reserved.