Class AwsIamAuthentication
java.lang.Object
org.springframework.vault.authentication.AwsIamAuthentication
- All Implemented Interfaces:
AuthenticationStepsFactory,ClientAuthentication
public class AwsIamAuthentication
extends Object
implements ClientAuthentication, AuthenticationStepsFactory
AWS IAM authentication using signed HTTP requests to query the current
identity.
AWS IAM authentication creates a signed HTTP
request that is executed by Vault to get the identity of the signer using AWS
STS GetCallerIdentity. A signature requires
AwsCredentials to calculate
the signature.
This authentication requires AWS' Java SDK to sign request parameters and
calculate the signature key. Using an appropriate
AwsCredentialsProvider allows
authentication within AWS-EC2 instances with an assigned profile, within ECS
and Lambda instances.
- Since:
- 1.1
- Author:
- Mark Paluch
- See Also:
-
AwsIamAuthenticationOptionsAwsCredentialsProviderVaultClient- Auth Method: aws (IAM)
- AWS: GetCallerIdentity
-
Constructor Summary
ConstructorsConstructorDescriptionAwsIamAuthentication(AwsIamAuthenticationOptions options, VaultClient vaultClient) AwsIamAuthentication(AwsIamAuthenticationOptions options, RestClient vaultClient) AwsIamAuthentication(AwsIamAuthenticationOptions options, RestOperations vaultRestOperations) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticationStepsCreateAuthenticationStepsfor AWS-IAM authentication givenAwsIamAuthenticationOptions.protected static AuthenticationStepscreateAuthenticationSteps(AwsIamAuthenticationOptions options, software.amazon.awssdk.auth.credentials.AwsCredentials credentials, software.amazon.awssdk.regions.Region region) Create the request body to perform a Vault login using the AWS-IAM authentication method.Get theAuthenticationStepsdescribing an authentication flow.login()Obtain aVaultTokenfor authenticated Vault access.
-
Constructor Details
-
AwsIamAuthentication
@Deprecated(since="4.1") public AwsIamAuthentication(AwsIamAuthenticationOptions options, RestOperations vaultRestOperations) Deprecated.since 4.1, useAwsIamAuthentication(AwsIamAuthenticationOptions, VaultClient)instead.Create a newAwsIamAuthenticationspecifyingAwsIamAuthenticationOptionsand a VaultRestOperations.- Parameters:
options- must not be null.vaultRestOperations- must not be null.
-
AwsIamAuthentication
- Parameters:
options- must not be null.vaultClient- must not be null.
-
AwsIamAuthentication
- Parameters:
options- must not be null.vaultClient- must not be null.- Since:
- 4.1
-
-
Method Details
-
createAuthenticationSteps
CreateAuthenticationStepsfor AWS-IAM authentication givenAwsIamAuthenticationOptions. The resultingAuthenticationStepsreuse eagerly-fetchedAwsCredentialsto prevent blocking I/O during authentication.- Parameters:
options- must not be null.- Returns:
AuthenticationStepsfor AWS-IAM authentication.- Since:
- 2.2
-
createAuthenticationSteps
protected static AuthenticationSteps createAuthenticationSteps(AwsIamAuthenticationOptions options, software.amazon.awssdk.auth.credentials.AwsCredentials credentials, software.amazon.awssdk.regions.Region region) -
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:
-
getAuthenticationSteps
Description copied from interface:AuthenticationStepsFactoryGet theAuthenticationStepsdescribing an authentication flow.- Specified by:
getAuthenticationStepsin interfaceAuthenticationStepsFactory- Returns:
- the
AuthenticationStepsdescribing an authentication flow.
-
createRequestBody
Create the request body to perform a Vault login using the AWS-IAM authentication method.- Parameters:
options- must not be null.- Returns:
- the map containing body key-value pairs.
-
AwsIamAuthentication(AwsIamAuthenticationOptions, VaultClient)instead.