Class UsernamePasswordAuthentication
java.lang.Object
org.springframework.vault.authentication.UsernamePasswordAuthentication
- All Implemented Interfaces:
AuthenticationStepsFactory,ClientAuthentication
public class UsernamePasswordAuthentication
extends Object
implements ClientAuthentication, AuthenticationStepsFactory
Username and password implementation of
ClientAuthentication. Can be
used for userpass, ldap, okta, and radius
authentication methods.- Since:
- 2.4
- Author:
- Mikhael Sokolov, Mark Paluch
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate aUsernamePasswordAuthenticationusingUsernamePasswordAuthenticationOptionsandVaultClient.UsernamePasswordAuthentication(UsernamePasswordAuthenticationOptions options, RestOperations restOperations) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticationStepsCreateAuthenticationStepsfor username/password authentication givenUsernamePasswordAuthenticationOptions.Get theAuthenticationStepsdescribing an authentication flow.login()Obtain aVaultTokenfor authenticated Vault access.
-
Constructor Details
-
UsernamePasswordAuthentication
@Deprecated(since="4.1") public UsernamePasswordAuthentication(UsernamePasswordAuthenticationOptions options, RestOperations restOperations) Deprecated.since 4.1, useUsernamePasswordAuthentication(UsernamePasswordAuthenticationOptions, VaultClient)instead.Create aUsernamePasswordAuthenticationusingUsernamePasswordAuthenticationOptionsandRestOperations.- Parameters:
options- must not be null.restOperations- must not be null.
-
UsernamePasswordAuthentication
public UsernamePasswordAuthentication(UsernamePasswordAuthenticationOptions options, RestClient client) - Parameters:
options- must not be null.client- must not be null.- Since:
- 4.0
-
UsernamePasswordAuthentication
public UsernamePasswordAuthentication(UsernamePasswordAuthenticationOptions options, VaultClient client) Create aUsernamePasswordAuthenticationusingUsernamePasswordAuthenticationOptionsandVaultClient.- Parameters:
options- must not be null.client- must not be null.- Since:
- 4.1
-
-
Method Details
-
createAuthenticationSteps
public static AuthenticationSteps createAuthenticationSteps(UsernamePasswordAuthenticationOptions options) CreateAuthenticationStepsfor username/password authentication givenUsernamePasswordAuthenticationOptions.- Parameters:
options- must not be null.- Returns:
AuthenticationStepsfor username/password authentication.
-
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.
-
UsernamePasswordAuthentication(UsernamePasswordAuthenticationOptions, VaultClient)instead.