Interface Authenticator
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Authenticator
This class represents an authenticator that can be used to provide authentication headers for remote servers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,List<String>>
authenticate(Route route, Request request, Response response)
Gets authentication headers to authenticate against a remove server for the call described by the given parameters.
-
-
-
Method Detail
-
authenticate
Map<String,List<String>> authenticate(Route route, Request request, Response response) throws IOException
Gets authentication headers to authenticate against a remove server for the call described by the given parameters.The return value might be
null
or an empty map if no headers should be modified in the request, for example because no challenge can be satisfied. If the map has entries, their keys are the HTTP headers to be set, the values are the header values for the key. If the first entry in the values list isnull
, or the whole values list isnull
, the given header values replace any existing values for that header. Otherwise all header values are added additionally to eventually already existing ones. Note: It might be advisable to not return the same set of headers again if the originating request already contained these headers. If the authenticator is called again, obviously the authentication did not work properly. So returning the same headers again might end up in an endless loop.- Parameters:
route
- The route to which a request is done that needs to be authenticated.request
- The originating request that led to the authentication attempt.response
- The response that demands authentication.- Returns:
- The authentication headers that should be set in the request.
- Throws:
IOException
- If an IO error occurs.
-
-