public class AuthenticationSteps extends Object
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.
AuthenticationStepsFactory
Modifier and Type | Class and Description |
---|---|
static class |
AuthenticationSteps.HttpRequest<T>
Value object representing a HTTP request.
|
static class |
AuthenticationSteps.HttpRequestBuilder
Builder for
AuthenticationSteps.HttpRequest . |
static class |
AuthenticationSteps.Node<T>
Intermediate authentication step with authentication flow operators represented as
node.
|
static class |
AuthenticationSteps.Pair<L,R>
A tuple of two things.
|
Modifier and Type | Method and Description |
---|---|
static <T> AuthenticationSteps.Node<T> |
fromHttpRequest(AuthenticationSteps.HttpRequest<T> request)
Start flow composition from a
AuthenticationSteps.HttpRequest . |
static <T> AuthenticationSteps.Node<T> |
fromSupplier(Supplier<T> supplier)
Start flow composition from a
Supplier . |
static <T> AuthenticationSteps.Node<T> |
fromValue(T value)
Start flow composition from a scalar
value . |
static AuthenticationSteps |
just(AuthenticationSteps.HttpRequest<VaultResponse> request)
Create a flow definition from a
AuthenticationSteps.HttpRequest returning a
VaultResponse . |
static AuthenticationSteps |
just(VaultToken token)
Create a flow definition using a provided
VaultToken . |
public static AuthenticationSteps just(VaultToken token)
VaultToken
.token
- the token to be used from this AuthenticationSteps
, must not
be null.AuthenticationSteps
.public static AuthenticationSteps just(AuthenticationSteps.HttpRequest<VaultResponse> request)
AuthenticationSteps.HttpRequest
returning a
VaultResponse
.request
- the HTTP request definition, must not be null.AuthenticationSteps
.public static <T> AuthenticationSteps.Node<T> fromValue(T value)
value
.value
- the value to be used from this AuthenticationSteps.Node
, must not be
null.AuthenticationSteps.Node
.public static <T> AuthenticationSteps.Node<T> fromSupplier(Supplier<T> supplier)
Supplier
.supplier
- supplier function that will produce the flow value, must not be
null. Infrastructure components evaluating authentication steps may
inspect the given Supplier
for an optimized approach to
obtain its value.AuthenticationSteps.Node
.public static <T> AuthenticationSteps.Node<T> fromHttpRequest(AuthenticationSteps.HttpRequest<T> request)
AuthenticationSteps.HttpRequest
.request
- the HTTP request definition, must not be null.AuthenticationSteps.Node
.Copyright © 2016–2021 Pivotal Software, Inc.. All rights reserved.