public abstract class ExchangeFilterFunctions extends 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 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(String user,
String password)
Return a filter for HTTP Basic Authentication that adds an authorization
header, based on the given user and password.
|
static ExchangeFilterFunction |
statusError(Predicate<HttpStatus> statusPredicate,
Function<ClientResponse,? extends Throwable> exceptionFunction)
Return a filter that generates an error signal when the given
HttpStatus predicate matches. |
public static final String BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE
ExchangeFilterFunctions.Credentials used by basicAuthentication().public static ExchangeFilterFunction basicAuthentication(String user, String password)
Note that Basic Authentication only supports characters in the
ISO-8859-1 character set.
user - the userpassword - the passwordIllegalArgumentException - 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(Predicate<HttpStatus> statusPredicate, Function<ClientResponse,? extends Throwable> exceptionFunction)
HttpStatus predicate matches.statusPredicate - the predicate to check the HTTP status withexceptionFunction - the function that to create the exception