Class AzureMsiAuthentication
java.lang.Object
org.springframework.vault.authentication.AzureMsiAuthentication
- All Implemented Interfaces:
AuthenticationStepsFactory,ClientAuthentication
public class AzureMsiAuthentication
extends Object
implements ClientAuthentication, AuthenticationStepsFactory
Azure MSI (Managed Service Identity) authentication using Azure as trusted third party.
Azure MSI authentication uses AzureVmEnvironment and the MSI OAuth2 token
(referenced as JWT token in Vault docs) to log into Vault. VM environment and OAuth2
token are fetched from the Azure Instance Metadata service. Instances of this class are
immutable once constructed.
- Since:
- 2.1
- Author:
- Mark Paluch
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAzureMsiAuthentication(AzureMsiAuthenticationOptions options, RestOperations restOperations) Create a newAzureMsiAuthentication.AzureMsiAuthentication(AzureMsiAuthenticationOptions options, RestOperations vaultRestOperations, RestOperations azureMetadataRestOperations) Create a newAzureMsiAuthenticationspecifyingAzureMsiAuthenticationOptions, a Vault and an Azure-Metadata-specificRestOperations. -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticationStepsCreates aAuthenticationStepsfor Azure authentication givenAzureMsiAuthenticationOptions.protected static AuthenticationStepscreateAuthenticationSteps(AzureMsiAuthenticationOptions options, AzureVmEnvironment environment) Get theAuthenticationStepsdescribing an authentication flow.login()Return aVaultToken.
-
Constructor Details
-
AzureMsiAuthentication
Create a newAzureMsiAuthentication.- Parameters:
options- must not be null.restOperations- must not be null.
-
AzureMsiAuthentication
public AzureMsiAuthentication(AzureMsiAuthenticationOptions options, RestOperations vaultRestOperations, RestOperations azureMetadataRestOperations) Create a newAzureMsiAuthenticationspecifyingAzureMsiAuthenticationOptions, a Vault and an Azure-Metadata-specificRestOperations.- Parameters:
options- must not be null.vaultRestOperations- must not be null.azureMetadataRestOperations- must not be null.
-
-
Method Details
-
createAuthenticationSteps
Creates aAuthenticationStepsfor Azure authentication givenAzureMsiAuthenticationOptions.- Parameters:
options- must not be null.- Returns:
AuthenticationStepsfor Azure authentication.
-
createAuthenticationSteps
protected static AuthenticationSteps createAuthenticationSteps(AzureMsiAuthenticationOptions options, @Nullable AzureVmEnvironment environment) -
login
Description copied from interface:ClientAuthenticationReturn aVaultToken. This method can optionally log into Vault to obtain atoken.- Specified by:
loginin interfaceClientAuthentication- Returns:
- a
VaultToken. - Throws:
VaultException
-
getAuthenticationSteps
Description copied from interface:AuthenticationStepsFactoryGet theAuthenticationStepsdescribing an authentication flow.- Specified by:
getAuthenticationStepsin interfaceAuthenticationStepsFactory- Returns:
- the
AuthenticationStepsdescribing an authentication flow.
-