Class GdchCredentials (1.41.0)

public class GdchCredentials extends GoogleCredentials

Inheritance

Object > Credentials > OAuth2Credentials > GoogleCredentials > GdchCredentials

Static Methods

fromStream(InputStream credentialsStream)

public static GdchCredentials fromStream(InputStream credentialsStream)

Returns credentials defined by a GdchCredentials key file in JSON format from the Google Developers Console.

Important: If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud Platform, you must validate it before providing it to any Google API or library. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. For more information, refer to {@see documentation}.

Parameter
Name Description
credentialsStream InputStream

the stream with the credential definition.

Returns
Type Description
GdchCredentials

the credential defined by the credentialsStream.

Exceptions
Type Description
IOException

if the credential cannot be created from the stream.

fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory)

public static GdchCredentials fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory)

Returns credentials defined by a GdchCredentials key file in JSON format from the Google Developers Console.

Important: If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud Platform, you must validate it before providing it to any Google API or library. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. For more information, refer to {@see documentation}.

Parameters
Name Description
credentialsStream InputStream

the stream with the credential definition.

transportFactory HttpTransportFactory

HTTP transport factory, creates the transport used to get access tokens.

Returns
Type Description
GdchCredentials

the credential defined by the credentialsStream.

Exceptions
Type Description
IOException

if the credential cannot be created from the stream.

newBuilder()

public static GdchCredentials.Builder newBuilder()
Returns
Type Description
GdchCredentials.Builder

Methods

createWithGdchAudience(URI apiAudience)

public GdchCredentials createWithGdchAudience(URI apiAudience)

Create a copy of GDCH credentials with the specified audience.

Parameter
Name Description
apiAudience URI

The intended audience for GDCH credentials.

Returns
Type Description
GdchCredentials
Exceptions
Type Description
IOException

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getApiAudience()

public final URI getApiAudience()
Returns
Type Description
URI

getCaCertPath()

public final String getCaCertPath()
Returns
Type Description
String

getPrivateKey()

public final PrivateKey getPrivateKey()
Returns
Type Description
PrivateKey

getPrivateKeyId()

public final String getPrivateKeyId()
Returns
Type Description
String

getProjectId()

public final String getProjectId()

The projectId value for a Credential type. Since not all GoogleCredentials subclass have a projectId associated, the projectId may be null. A subset of GoogleCredentials subclasses will override to return their projectId.

Returns
Type Description
String

the projectId set in the GDCH SA Key file or the user set projectId

Overrides

getServiceIdentityName()

public final String getServiceIdentityName()
Returns
Type Description
String

getTokenServerUri()

public final URI getTokenServerUri()
Returns
Type Description
URI

getTransportFactory()

public final HttpTransportFactory getTransportFactory()
Returns
Type Description
HttpTransportFactory

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

refreshAccessToken()

public AccessToken refreshAccessToken()

Refresh the OAuth2 access token by getting a new access token using a JSON Web Token (JWT).

For GDCH credentials, this class creates a self-signed JWT, and sends to the GDCH authentication endpoint (tokenServerUri) to exchange an access token for the intended api audience (apiAudience).

Returns
Type Description
AccessToken
Overrides
Exceptions
Type Description
IOException

toBuilder()

public GdchCredentials.Builder toBuilder()
Returns
Type Description
GdchCredentials.Builder
Overrides

toString()

public String toString()
Returns
Type Description
String
Overrides