Class GcpIamCredentialsAuthentication
java.lang.Object
org.springframework.vault.authentication.GcpJwtAuthenticationSupport
org.springframework.vault.authentication.GcpIamCredentialsAuthentication
- All Implemented Interfaces:
ClientAuthentication
public class GcpIamCredentialsAuthentication
extends GcpJwtAuthenticationSupport
implements ClientAuthentication
Google Cloud IAM credentials login implementation using GCP IAM service
accounts to legitimate its authenticity via JSON Web Token using the IAM
Credentials
projects.serviceAccounts.signJwt method.
This authentication method uses Googles IAM Credentials API to obtain a
signed token for a specific
GoogleCredentials. Service account details
are obtained from a GoogleCredentials that can be retrieved either
from a JSON file or the runtime environment (GAE, GCE).
GcpIamCredentialsAuthentication uses Google Java API that uses
synchronous API.
- Since:
- 2.3.2
- Author:
- Andreas Gebauer, Mark Paluch
- See Also:
-
GcpIamCredentialsAuthenticationOptionsHttpTransportGoogleCredentialsGoogleCredentials.getApplicationDefault()VaultClient- Auth Method: gcp (IAM)
- GCP: projects.serviceAccounts.signJwt
-
Constructor Summary
ConstructorsConstructorDescriptionGcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, VaultClient vaultClient) Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptionsandVaultClient.GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, VaultClient vaultClient, com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider) Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptions,VaultClientandTransportChannelProvider.GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, RestClient vaultClient) Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptionsandRestClient.GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, RestClient vaultClient, com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider) Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptions,RestOperationsandTransportChannelProvider.GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, RestOperations restOperations) Deprecated.GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, RestOperations restOperations, com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionlogin()Obtain aVaultTokenfor authenticated Vault access.protected StringsignJwt()
-
Constructor Details
-
GcpIamCredentialsAuthentication
@Deprecated(since="4.1") public GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, RestOperations restOperations) Deprecated.since 4.1, useGcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions, VaultClient)instead.Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptionsandRestOperations. This constructor initializesInstantiatingGrpcChannelProviderfor Google API usage.- Parameters:
options- must not be null.restOperations- HTTP client for Vault login, must not be null.
-
GcpIamCredentialsAuthentication
@Deprecated(since="4.1") public GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, RestOperations restOperations, com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider) Deprecated.Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptions,RestOperationsandTransportChannelProvider.- Parameters:
options- must not be null.restOperations- HTTP client for Vault login, must not be null.transportChannelProvider- Provider for transport channel Google API use, must not be null.
-
GcpIamCredentialsAuthentication
public GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, RestClient vaultClient) Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptionsandRestClient. This constructor initializesInstantiatingGrpcChannelProviderfor Google API usage.- Parameters:
options- must not be null.vaultClient- HTTP client for Vault login, must not be null.- Since:
- 4.0
-
GcpIamCredentialsAuthentication
public GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, RestClient vaultClient, com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider) Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptions,RestOperationsandTransportChannelProvider.- Parameters:
options- must not be null.vaultClient- HTTP client for Vault login, must not be null.transportChannelProvider- Provider for transport channel Google API use, must not be null.- Since:
- 4.0
-
GcpIamCredentialsAuthentication
public GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, VaultClient vaultClient) Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptionsandVaultClient. This constructor initializesInstantiatingGrpcChannelProviderfor Google API usage.- Parameters:
options- must not be null.vaultClient- client for Vault login, must not be null.- Since:
- 4.1
-
GcpIamCredentialsAuthentication
public GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions options, VaultClient vaultClient, com.google.api.gax.rpc.TransportChannelProvider transportChannelProvider) Create a new instance ofGcpIamCredentialsAuthenticationgivenGcpIamCredentialsAuthenticationOptions,VaultClientandTransportChannelProvider.- Parameters:
options- must not be null.vaultClient- client for Vault login, must not be null.transportChannelProvider- Provider for transport channel Google API use, must not be null.- Since:
- 4.1
-
-
Method Details
-
login
Description copied from interface:ClientAuthenticationObtain aVaultTokenfor authenticated Vault access.This method may perform an authentication request to Vault or return a cached or pre-configured token.
- Specified by:
loginin interfaceClientAuthentication- Returns:
- the Vault token for subsequent authenticated requests
- Throws:
VaultLoginException- if authentication fails.VaultException- See Also:
-
signJwt
-
GcpIamCredentialsAuthentication(GcpIamCredentialsAuthenticationOptions, VaultClient)instead.