Class AuthenticationSteps

java.lang.Object
org.springframework.vault.authentication.AuthenticationSteps

public class AuthenticationSteps extends Object
Authentication DSL allowing flow composition to create a VaultToken.

Static generators are the main entry point to start with a flow composition. An example authentication using AWS-EC2 authentication:

 String nonce = "";
 return AuthenticationSteps
                .fromHttpRequest(
                                HttpRequestBuilder.get(options.getIdentityDocumentUri().toString()) //
                                                .as(String.class)) //
                .map(pkcs7 -> pkcs7.replaceAll("\\r", "")) //
                .map(pkcs7 -> {

                        Map<String, String> login = new HashMap<>();

                        login.put("nonce", new String(nonce));
                        login.put("pkcs7", pkcs7);

                        return login;
                }).login(AuthenticationUtil.getLoginPath(options.getPath()));
 

To perform a computation, authentication steps are composed into a pipeline. A pipeline consists of a source (which might be an object, a supplier function, a HTTP request, etc), zero or more intermediate operations (which transform the authentication state object into another object, such as AuthenticationSteps.Node.map(Function)), and a terminal operation which finishes authentication composition. An authentication flow operates on the authentication state object which is created for each authentication. Step produce an object and some steps can accept the current state object for further transformation.

AuthenticationSteps describes the authentication flow. Computation on the source data is only performed when the flow definition is interpreted by an executor.

Since:
2.0
Author:
Mark Paluch
See Also: