Class AwsEc2Authentication
java.lang.Object
org.springframework.vault.authentication.AwsEc2Authentication
- All Implemented Interfaces:
AuthenticationStepsFactory
,ClientAuthentication
public class AwsEc2Authentication
extends Object
implements ClientAuthentication, AuthenticationStepsFactory
AWS-EC2 login implementation.
AWS-EC2 login uses the EC2 identity document and a nonce to login into Vault. AWS-EC2
login obtains the PKCS#7 signed EC2 identity document and generates a
nonce
. Instances of this class are immutable once constructed.
- Author:
- Mark Paluch
- See Also:
-
Constructor Summary
ConstructorDescriptionAwsEc2Authentication
(AwsEc2AuthenticationOptions options, RestOperations vaultRestOperations, RestOperations awsMetadataRestOperations) Create a newAwsEc2Authentication
specifyingAwsEc2AuthenticationOptions
, a Vault and an AWS-Metadata-specificRestOperations
.AwsEc2Authentication
(RestOperations vaultRestOperations) Create a newAwsEc2Authentication
. -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticationSteps
Creates aAuthenticationSteps
for AWS-EC2 authentication givenAwsEc2AuthenticationOptions
.protected static AuthenticationSteps
createAuthenticationSteps
(AwsEc2AuthenticationOptions options, AtomicReference<char[]> nonce, Supplier<char[]> nonceSupplier) protected char[]
Get theAuthenticationSteps
describing an authentication flow.login()
Return aVaultToken
.
-
Constructor Details
-
AwsEc2Authentication
Create a newAwsEc2Authentication
.- Parameters:
vaultRestOperations
- must not be null.
-
AwsEc2Authentication
public AwsEc2Authentication(AwsEc2AuthenticationOptions options, RestOperations vaultRestOperations, RestOperations awsMetadataRestOperations) Create a newAwsEc2Authentication
specifyingAwsEc2AuthenticationOptions
, a Vault and an AWS-Metadata-specificRestOperations
.- Parameters:
options
- must not be null.vaultRestOperations
- must not be null.awsMetadataRestOperations
- must not be null.
-
-
Method Details
-
createAuthenticationSteps
Creates aAuthenticationSteps
for AWS-EC2 authentication givenAwsEc2AuthenticationOptions
.- Parameters:
options
- must not be null.- Returns:
AuthenticationSteps
for AWS-EC2 authentication.- Since:
- 2.0
-
createAuthenticationSteps
protected static AuthenticationSteps createAuthenticationSteps(AwsEc2AuthenticationOptions options, AtomicReference<char[]> nonce, Supplier<char[]> nonceSupplier) -
login
Description copied from interface:ClientAuthentication
Return aVaultToken
. This method can optionally log into Vault to obtain atoken
.- Specified by:
login
in interfaceClientAuthentication
- Returns:
- a
VaultToken
. - Throws:
VaultException
-
getAuthenticationSteps
Description copied from interface:AuthenticationStepsFactory
Get theAuthenticationSteps
describing an authentication flow.- Specified by:
getAuthenticationSteps
in interfaceAuthenticationStepsFactory
- Returns:
- the
AuthenticationSteps
describing an authentication flow.
-
getEc2Login
-
createNonce
protected char[] createNonce()
-