T
- authorization token representation.@Contract(threading=STATELESS) public abstract class AbstractAsyncServerAuthFilter<T> extends Object implements AsyncFilterHandler
Modifier | Constructor and Description |
---|---|
protected |
AbstractAsyncServerAuthFilter(boolean respondImmediately) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
authenticate(T challengeResponse,
URIAuthority authority,
String requestUri,
HttpContext context)
Authenticates the client using the authentication token sent by the client
as a response to an authentication challenge.
|
protected abstract String |
generateChallenge(T challengeResponse,
URIAuthority authority,
String requestUri,
HttpContext context)
Generates an authentication challenge in case of unsuccessful authentication.
|
protected AsyncEntityProducer |
generateResponseContent(HttpResponse unauthorized)
Generates response body for UNAUTHORIZED response.
|
AsyncDataConsumer |
handle(HttpRequest request,
EntityDetails entityDetails,
HttpContext context,
AsyncFilterChain.ResponseTrigger responseTrigger,
AsyncFilterChain chain)
Processes the incoming HTTP request and if processing has been completed
submits a final response to the client.
|
protected abstract T |
parseChallengeResponse(String authorizationValue,
HttpContext context)
Parses authorization header value into an authentication token sent by the client
as a response to an authentication challenge.
|
protected AbstractAsyncServerAuthFilter(boolean respondImmediately)
protected abstract T parseChallengeResponse(String authorizationValue, HttpContext context) throws HttpException
authorizationValue
- the authorization header value.context
- the actual execution context.HttpException
- in case of an HTTP protocol violation.protected abstract boolean authenticate(T challengeResponse, URIAuthority authority, String requestUri, HttpContext context)
challengeResponse
- the authentication token sent by the client
as a response to an authentication challenge.authority
- the URI authority.requestUri
- the request URI.context
- the actual execution context.true
if the client could be successfully authenticated false
otherwise.protected abstract String generateChallenge(T challengeResponse, URIAuthority authority, String requestUri, HttpContext context)
challengeResponse
- the authentication token sent by the client
as a response to an authentication challenge
or null
if the client has not sent any.authority
- the URI authority.requestUri
- the request URI.context
- the actual execution context.protected AsyncEntityProducer generateResponseContent(HttpResponse unauthorized)
unauthorized
- the response to return as a result of authentication failure.public final AsyncDataConsumer handle(HttpRequest request, EntityDetails entityDetails, HttpContext context, AsyncFilterChain.ResponseTrigger responseTrigger, AsyncFilterChain chain) throws HttpException, IOException
AsyncFilterHandler
AsyncFilterChain.proceed(HttpRequest, EntityDetails, HttpContext, AsyncFilterChain.ResponseTrigger)
method.handle
in interface AsyncFilterHandler
request
- the actual request head.entityDetails
- the request entity details or null
if the request
does not enclose an entity.context
- the actual execution context.responseTrigger
- the response trigger.chain
- the next element in the request processing chain.null
if entityDetails parameter is null
.HttpException
- in case of an HTTP protocol violation.IOException
- in case of an I/O error.Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.