Class JwtAuthentication
java.lang.Object
org.springframework.vault.authentication.JwtAuthentication
- All Implemented Interfaces:
AuthenticationStepsFactory,ClientAuthentication
public class JwtAuthentication
extends Object
implements ClientAuthentication, AuthenticationStepsFactory
JWT implementation of
ClientAuthentication. JwtAuthentication
uses a JSON Web Token to login into Vault. JWT and Role are sent in the login
request to Vault to obtain a VaultToken.- Since:
- 3.1
- Author:
- Nanne Baars
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJwtAuthentication(JwtAuthenticationOptions options, VaultClient client) JwtAuthentication(JwtAuthenticationOptions options, RestClient client) JwtAuthentication(JwtAuthenticationOptions options, RestOperations restOperations) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionGet theAuthenticationStepsdescribing an authentication flow.login()Obtain aVaultTokenfor authenticated Vault access.
-
Field Details
-
DEFAULT_JWT_AUTHENTICATION_PATH
- See Also:
-
-
Constructor Details
-
JwtAuthentication
@Deprecated(since="4.1") public JwtAuthentication(JwtAuthenticationOptions options, RestOperations restOperations) Deprecated.since 4.1, useJwtAuthentication(JwtAuthenticationOptions, VaultClient)instead.- Parameters:
options- must not be null.restOperations- must not be null.
-
JwtAuthentication
- Parameters:
options- must not be null.client- must not be null.- Since:
- 4.0
-
JwtAuthentication
- Parameters:
options- must not be null.client- must not be null.- Since:
- 4.1
-
-
Method Details
-
getAuthenticationSteps
Description copied from interface:AuthenticationStepsFactoryGet theAuthenticationStepsdescribing an authentication flow.- Specified by:
getAuthenticationStepsin interfaceAuthenticationStepsFactory- Returns:
- the
AuthenticationStepsdescribing an authentication flow.
-
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:
-
JwtAuthentication(JwtAuthenticationOptions, VaultClient)instead.