Package com.google.auth.oauth2
Class CloudShellCredentials
- java.lang.Object
-
- com.google.auth.Credentials
-
- com.google.auth.oauth2.OAuth2Credentials
-
- com.google.auth.oauth2.GoogleCredentials
-
- com.google.auth.oauth2.CloudShellCredentials
-
- All Implemented Interfaces:
QuotaProjectIdProvider
,java.io.Serializable
public class CloudShellCredentials extends GoogleCredentials
OAuth2 credentials representing the built-in service account for Google Cloud Shell.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CloudShellCredentials.Builder
-
Nested classes/interfaces inherited from class com.google.auth.oauth2.OAuth2Credentials
OAuth2Credentials.AsyncRefreshResult, OAuth2Credentials.CacheState, OAuth2Credentials.CredentialsChangedListener, OAuth2Credentials.FutureCallbackToMetadataCallbackAdapter, OAuth2Credentials.OAuthValue, OAuth2Credentials.RefreshTask, OAuth2Credentials.RefreshTaskListener
-
-
Field Summary
Fields Modifier and Type Field Description private static int
ACCESS_TOKEN_INDEX
private int
authPort
protected static java.lang.String
GET_AUTH_TOKEN_REQUEST
The Cloud Shell back authorization channel uses serialized Javascript Protobuffers, preceded by the message length and a new line character.protected static byte[]
GET_AUTH_TOKEN_REQUEST_BYTES
private static int
READ_TIMEOUT_MS
private static long
serialVersionUID
-
Fields inherited from class com.google.auth.oauth2.GoogleCredentials
GDCH_SERVICE_ACCOUNT_FILE_TYPE, QUOTA_PROJECT_ID_HEADER_KEY, quotaProjectId, SERVICE_ACCOUNT_FILE_TYPE, USER_FILE_TYPE
-
Fields inherited from class com.google.auth.oauth2.OAuth2Credentials
clock, DEFAULT_EXPIRATION_MARGIN, DEFAULT_REFRESH_MARGIN, lock, refreshTask
-
Fields inherited from class com.google.auth.Credentials
GOOGLE_DEFAULT_UNIVERSE
-
-
Constructor Summary
Constructors Modifier Constructor Description private
CloudShellCredentials(CloudShellCredentials.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CloudShellCredentials
create(int authPort)
boolean
equals(java.lang.Object obj)
protected int
getAuthPort()
int
hashCode()
static CloudShellCredentials.Builder
newBuilder()
AccessToken
refreshAccessToken()
Method to refresh the access token according to the specific type of credentials.CloudShellCredentials.Builder
toBuilder()
java.lang.String
toString()
-
Methods inherited from class com.google.auth.oauth2.GoogleCredentials
addQuotaProjectIdToRequestMetadata, create, create, createDelegated, createScoped, createScoped, createScoped, createScopedRequired, createWithCustomRetryStrategy, createWithQuotaProject, fromStream, fromStream, getAdditionalHeaders, getApplicationDefault, getApplicationDefault, getQuotaProjectId, getUniverseDomain, isDefaultUniverseDomain, isExplicitUniverseDomain, toStringHelper
-
Methods inherited from class com.google.auth.oauth2.OAuth2Credentials
addChangeListener, getAccessToken, getAuthenticationType, getExpirationMargin, getFromServiceLoader, getRefreshMargin, getRequestMetadata, getRequestMetadata, getRequestMetadataInternal, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, refreshIfExpired, removeChangeListener
-
Methods inherited from class com.google.auth.Credentials
blockingGetToCallback, getMetricsCredentialType, getRequestMetadata
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
ACCESS_TOKEN_INDEX
private static final int ACCESS_TOKEN_INDEX
- See Also:
- Constant Field Values
-
READ_TIMEOUT_MS
private static final int READ_TIMEOUT_MS
- See Also:
- Constant Field Values
-
GET_AUTH_TOKEN_REQUEST
protected static final java.lang.String GET_AUTH_TOKEN_REQUEST
The Cloud Shell back authorization channel uses serialized Javascript Protobuffers, preceded by the message length and a new line character. However, the request message has no content, so a token request consists of an empty JsPb, and its 2 character length prefix.- See Also:
- Constant Field Values
-
GET_AUTH_TOKEN_REQUEST_BYTES
protected static final byte[] GET_AUTH_TOKEN_REQUEST_BYTES
-
authPort
private final int authPort
-
-
Constructor Detail
-
CloudShellCredentials
private CloudShellCredentials(CloudShellCredentials.Builder builder)
-
-
Method Detail
-
create
public static CloudShellCredentials create(int authPort)
-
getAuthPort
protected int getAuthPort()
-
refreshAccessToken
public AccessToken refreshAccessToken() throws java.io.IOException
Description copied from class:OAuth2Credentials
Method to refresh the access token according to the specific type of credentials.Throws IllegalStateException if not overridden since direct use of OAuth2Credentials is only for temporary or non-refreshing access tokens.
- Overrides:
refreshAccessToken
in classOAuth2Credentials
- Returns:
- never
- Throws:
java.io.IOException
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classGoogleCredentials
-
toString
public java.lang.String toString()
- Overrides:
toString
in classGoogleCredentials
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classGoogleCredentials
-
toBuilder
public CloudShellCredentials.Builder toBuilder()
- Overrides:
toBuilder
in classGoogleCredentials
-
newBuilder
public static CloudShellCredentials.Builder newBuilder()
-
-