public abstract class ExchangeFilterFunctions
extends java.lang.Object
ExchangeFilterFunction
for basic authentication, error handling, etc.Modifier and Type | Class and Description |
---|---|
static class |
ExchangeFilterFunctions.Credentials
Stores user and password for HTTP basic authentication.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE
Name of the request attribute that
contains the
ExchangeFilterFunctions.Credentials used by basicAuthentication() . |
Constructor and Description |
---|
ExchangeFilterFunctions() |
Modifier and Type | Method and Description |
---|---|
static ExchangeFilterFunction |
basicAuthentication()
Variant of
basicAuthentication(String, String) that looks up
the Credentials provided in a
request attribute, or if the
attribute is not found, the authorization header is not added. |
static ExchangeFilterFunction |
basicAuthentication(java.lang.String user,
java.lang.String password)
Return a filter for HTTP Basic Authentication that adds an authorization
header, based on the given user and password.
|
static ExchangeFilterFunction |
statusError(java.util.function.Predicate<HttpStatus> statusPredicate,
java.util.function.Function<ClientResponse,? extends java.lang.Throwable> exceptionFunction)
Return a filter that generates an error signal when the given
HttpStatus predicate matches. |
public static final java.lang.String BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE
ExchangeFilterFunctions.Credentials
used by basicAuthentication()
.public static ExchangeFilterFunction basicAuthentication(java.lang.String user, java.lang.String password)
Note that Basic Authentication only supports characters in the
ISO-8859-1
character set.
user
- the userpassword
- the passwordjava.lang.IllegalArgumentException
- if either user
or
password
contain characters that cannot be encoded to ISO-8859-1.public static ExchangeFilterFunction basicAuthentication()
basicAuthentication(String, String)
that looks up
the Credentials
provided in a
request attribute, or if the
attribute is not found, the authorization header is not added.BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE
,
ExchangeFilterFunctions.Credentials.basicAuthenticationCredentials(String, String)
public static ExchangeFilterFunction statusError(java.util.function.Predicate<HttpStatus> statusPredicate, java.util.function.Function<ClientResponse,? extends java.lang.Throwable> exceptionFunction)
HttpStatus
predicate matches.statusPredicate
- the predicate to check the HTTP status withexceptionFunction
- the function that to create the exception