Class AuthenticationSteps
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Value object representing a HTTP request.static class
Builder forAuthenticationSteps.HttpRequest
.static class
Intermediate authentication step with authentication flow operators represented as node.static class
A tuple of two things. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> AuthenticationSteps.Node<T>
fromHttpRequest
(AuthenticationSteps.HttpRequest<T> request) Start flow composition from aAuthenticationSteps.HttpRequest
.static <T> AuthenticationSteps.Node<T>
fromSupplier
(Supplier<T> supplier) Start flow composition from aSupplier
.static <T> AuthenticationSteps.Node<T>
fromValue
(T value) Start flow composition from a scalarvalue
.static AuthenticationSteps
just
(AuthenticationSteps.HttpRequest<VaultResponse> request) Create a flow definition from aAuthenticationSteps.HttpRequest
returning aVaultResponse
.static AuthenticationSteps
just
(VaultToken token) Create a flow definition using a providedVaultToken
.
-
Method Details
-
just
Create a flow definition using a providedVaultToken
.- Parameters:
token
- the token to be used from thisAuthenticationSteps
, must not be null.- Returns:
- the
AuthenticationSteps
.
-
just
Create a flow definition from aAuthenticationSteps.HttpRequest
returning aVaultResponse
.- Parameters:
request
- the HTTP request definition, must not be null.- Returns:
- the
AuthenticationSteps
.
-
fromValue
Start flow composition from a scalarvalue
.- Parameters:
value
- the value to be used from thisAuthenticationSteps.Node
, must not be null.- Returns:
- the first
AuthenticationSteps.Node
. - Since:
- 2.3
-
fromSupplier
Start flow composition from aSupplier
.- Parameters:
supplier
- supplier function that will produce the flow value, must not be null. Infrastructure components evaluating authentication steps may inspect the givenSupplier
for an optimized approach to obtain its value.- Returns:
- the first
AuthenticationSteps.Node
.
-
fromHttpRequest
public static <T> AuthenticationSteps.Node<T> fromHttpRequest(AuthenticationSteps.HttpRequest<T> request) Start flow composition from aAuthenticationSteps.HttpRequest
.- Parameters:
request
- the HTTP request definition, must not be null.- Returns:
- the first
AuthenticationSteps.Node
.
-