Class KubernetesAuthentication
java.lang.Object
org.springframework.vault.authentication.KubernetesAuthentication
- All Implemented Interfaces:
AuthenticationStepsFactory,ClientAuthentication
public class KubernetesAuthentication
extends Object
implements ClientAuthentication, AuthenticationStepsFactory
Kubernetes implementation of
ClientAuthentication.
KubernetesAuthentication uses a Kubernetes Service Account JSON Web
Token to login into Vault. JWT and Role are sent in the login request to
Vault to obtain a VaultToken.- Since:
- 2.0
- Author:
- Michal Budzyn, Mark Paluch
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKubernetesAuthentication(KubernetesAuthenticationOptions options, VaultClient client) KubernetesAuthentication(KubernetesAuthenticationOptions options, RestClient client) KubernetesAuthentication(KubernetesAuthenticationOptions options, RestOperations restOperations) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticationStepsCreateAuthenticationStepsfor kubernetes authentication givenKubernetesAuthenticationOptions.Get theAuthenticationStepsdescribing an authentication flow.login()Obtain aVaultTokenfor authenticated Vault access.
-
Constructor Details
-
KubernetesAuthentication
@Deprecated(since="4.1") public KubernetesAuthentication(KubernetesAuthenticationOptions options, RestOperations restOperations) Deprecated.since 4.1, useKubernetesAuthentication(KubernetesAuthenticationOptions, VaultClient)instead.- Parameters:
options- must not be null.restOperations- must not be null.
-
KubernetesAuthentication
- Parameters:
options- must not be null.client- must not be null.- Since:
- 4.0
-
KubernetesAuthentication
- Parameters:
options- must not be null.client- must not be null.- Since:
- 4.1
-
-
Method Details
-
createAuthenticationSteps
public static AuthenticationSteps createAuthenticationSteps(KubernetesAuthenticationOptions options) CreateAuthenticationStepsfor kubernetes authentication givenKubernetesAuthenticationOptions.- Parameters:
options- must not be null.- Returns:
AuthenticationStepsfor kubernetes 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.
-
KubernetesAuthentication(KubernetesAuthenticationOptions, VaultClient)instead.