Class CloudShellCredentials (1.20.0)

public class CloudShellCredentials extends GoogleCredentials

OAuth2 credentials representing the built-in service account for Google Cloud Shell.

Inheritance

Object > Credentials > OAuth2Credentials > GoogleCredentials > CloudShellCredentials

Static Fields

GET_AUTH_TOKEN_REQUEST

protected static final 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.

Field Value
TypeDescription
String

GET_AUTH_TOKEN_REQUEST_BYTES

protected static final byte[] GET_AUTH_TOKEN_REQUEST_BYTES
Field Value
TypeDescription
byte[]

Static Methods

create(int authPort)

public static CloudShellCredentials create(int authPort)
Parameter
NameDescription
authPortint
Returns
TypeDescription
CloudShellCredentials

newBuilder()

public static CloudShellCredentials.Builder newBuilder()
Returns
TypeDescription
CloudShellCredentials.Builder

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getAuthPort()

protected int getAuthPort()
Returns
TypeDescription
int

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

refreshAccessToken()

public AccessToken refreshAccessToken()

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.

Returns
TypeDescription
AccessToken
Overrides
Exceptions
TypeDescription
IOException

toBuilder()

public CloudShellCredentials.Builder toBuilder()
Returns
TypeDescription
CloudShellCredentials.Builder
Overrides

toString()

public String toString()
Returns
TypeDescription
String
Overrides