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
ConstructorDescriptionAzureMsiAuthentication
(AzureMsiAuthenticationOptions options, RestOperations restOperations) Create a newAzureMsiAuthentication
.AzureMsiAuthentication
(AzureMsiAuthenticationOptions options, RestOperations vaultRestOperations, RestOperations azureMetadataRestOperations) Create a newAzureMsiAuthentication
specifyingAzureMsiAuthenticationOptions
, a Vault and an Azure-Metadata-specificRestOperations
. -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticationSteps
Creates aAuthenticationSteps
for Azure authentication givenAzureMsiAuthenticationOptions
.protected static AuthenticationSteps
createAuthenticationSteps
(AzureMsiAuthenticationOptions options, AzureVmEnvironment environment) Get theAuthenticationSteps
describing 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 newAzureMsiAuthentication
specifyingAzureMsiAuthenticationOptions
, 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 aAuthenticationSteps
for Azure authentication givenAzureMsiAuthenticationOptions
.- Parameters:
options
- must not be null.- Returns:
AuthenticationSteps
for Azure authentication.
-
createAuthenticationSteps
protected static AuthenticationSteps createAuthenticationSteps(AzureMsiAuthenticationOptions options, @Nullable AzureVmEnvironment environment) -
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.
-