Class GdchCredentials
- All Implemented Interfaces:
QuotaProjectIdProvider,Serializable
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.google.auth.oauth2.OAuth2Credentials
OAuth2Credentials.CredentialsChangedListener -
Field Summary
Fields inherited from class com.google.auth.oauth2.GoogleCredentials
quotaProjectIdFields inherited from class com.google.auth.Credentials
GOOGLE_DEFAULT_UNIVERSE -
Method Summary
Modifier and TypeMethodDescriptioncreateWithGdchAudience(String apiAudience) Create a copy of GDCH credentials with the specified audience.createWithGdchAudience(URI apiAudience) This method is obsolete.booleanstatic GdchCredentialsfromStream(InputStream credentialsStream) Returns credentials defined by a GdchCredentials key file in JSON format from the Google Developers Console.static GdchCredentialsfromStream(InputStream credentialsStream, HttpTransportFactory transportFactory) Returns credentials defined by a GdchCredentials key file in JSON format from the Google Developers Console.final URINOTE: This method is obsolete, please usegetGdchAudience()instead.final Stringfinal StringReturns the underlying audience string set for this credentials object.final PrivateKeyfinal Stringfinal StringThe projectId value for a Credential type.final Stringfinal URIfinal HttpTransportFactoryinthashCode()static GdchCredentials.BuilderRefresh the OAuth2 access token by getting a new access token using a JSON Web Token (JWT).toString()Returns a string representation of this credential, including request metadata and access token.Methods inherited from class com.google.auth.oauth2.GoogleCredentials
create, create, createDelegated, createScoped, createScoped, createScoped, createScopedRequired, createWithCustomRetryStrategy, createWithQuotaProject, getAdditionalHeaders, getApplicationDefault, getApplicationDefault, getCredentialInfo, getQuotaProjectId, getUniverseDomain, isExplicitUniverseDomain, toStringHelperMethods inherited from class com.google.auth.oauth2.OAuth2Credentials
addChangeListener, getAccessToken, getAuthenticationType, getFromServiceLoader, getRequestMetadata, getRequestMetadata, getRequestMetadataInternal, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, refreshIfExpired, removeChangeListenerMethods inherited from class com.google.auth.Credentials
blockingGetToCallback, getMetricsCredentialType, getRequestMetadata
-
Method Details
-
fromStream
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 .
- Parameters:
credentialsStream- the stream with the credential definition.- Returns:
- the credential defined by the credentialsStream.
- Throws:
IOException- if the credential cannot be created from the stream.
-
fromStream
public static GdchCredentials fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory) throws IOException 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 .
- Parameters:
credentialsStream- the stream with the credential definition.transportFactory- HTTP transport factory, creates the transport used to get access tokens.- Returns:
- the credential defined by the credentialsStream.
- Throws:
IOException- if the credential cannot be created from the stream.
-
createWithGdchAudience
@ObsoleteApi("Use createWithGdchAudience(String) instead.") public GdchCredentials createWithGdchAudience(URI apiAudience) This method is obsolete. Please usecreateWithGdchAudience(String)} instead. Create a copy of GDCH credentials with the specified audience.- Parameters:
apiAudience- The intended audience for GDCH credentials.
-
createWithGdchAudience
Create a copy of GDCH credentials with the specified audience.- Parameters:
apiAudience- The intended audience for GDCH credentials.
-
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).
- Overrides:
refreshAccessTokenin classOAuth2Credentials- Returns:
- never
- Throws:
IOException
-
getProjectId
Description copied from class:GoogleCredentialsThe 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.- Overrides:
getProjectIdin classGoogleCredentials- Returns:
- the projectId set in the GDCH SA Key file or the user set projectId
-
getPrivateKeyId
-
getPrivateKey
-
getServiceIdentityName
-
getTokenServerUri
-
getGdchAudience
Returns the underlying audience string set for this credentials object.- Returns:
- the audience string, or null if no audience has been set.
-
getApiAudience
NOTE: This method is obsolete, please usegetGdchAudience()instead. Returns a URI representation of the underlying audience string set for this credentials object. This method may fail if the underlying audience string does not conform to a URI format.- Returns:
- a URI object representing the audience of the credentials, or null if no audience has been set or if the audience string is not a valid URI.
-
getTransportFactory
-
getCaCertPath
-
newBuilder
-
toBuilder
- Overrides:
toBuilderin classGoogleCredentials
-
hashCode
public int hashCode()- Overrides:
hashCodein classGoogleCredentials
-
toString
Description copied from class:OAuth2CredentialsReturns a string representation of this credential, including request metadata and access token.Security Warning: The output of this method includes the request metadata which contains the raw Bearer access token, and the raw access token value. Do not log this output in production environments as it may expose sensitive credentials.
- Overrides:
toStringin classGoogleCredentials
-
equals
- Overrides:
equalsin classGoogleCredentials
-