public abstract class DispatchChallengeHandler extends ChallengeHandler
| Constructor and Description |
|---|
DispatchChallengeHandler() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
canHandle(ChallengeRequest challengeRequest)
Can the presented challenge be potentially handled by this challenge handler?
|
static DispatchChallengeHandler |
create()
Creates a new instance of
DispatchChallengeHandler using the
ServiceLoader API with the implementation specified under
META-INF/services. |
static DispatchChallengeHandler |
create(ClassLoader classLoader)
Creates a new instance of
DispatchChallengeHandler with the
specified ClassLoader using the ServiceLoader API with
the implementation specified under META-INF/services. |
abstract ChallengeResponse |
handle(ChallengeRequest challengeRequest)
Handle the presented challenge by creating a challenge response or returning
null. |
abstract DispatchChallengeHandler |
register(String locationDescription,
ChallengeHandler challengeHandler)
Register a challenge handler to respond to challenges at one or more locations.
|
abstract DispatchChallengeHandler |
unregister(String locationDescription,
ChallengeHandler challengeHandler)
If the provided challengeHandler is registered at the provided location, clear that
association such that any future challenge requests matching the location will never
be handled by the provided challenge handler.
|
create, createpublic static DispatchChallengeHandler create()
DispatchChallengeHandler using the
ServiceLoader API with the implementation specified under
META-INF/services.public static DispatchChallengeHandler create(ClassLoader classLoader)
DispatchChallengeHandler with the
specified ClassLoader using the ServiceLoader API with
the implementation specified under META-INF/services.classLoader - ClassLoader to be used to instantiatepublic abstract boolean canHandle(ChallengeRequest challengeRequest)
ChallengeHandlercanHandle in class ChallengeHandlerchallengeRequest - a challenge request object containing a challengepublic abstract ChallengeResponse handle(ChallengeRequest challengeRequest)
ChallengeHandlernull.
This responsibility is usually achieved
by using the associated LoginHandler to obtain user credentials, and transforming those credentials
into a ChallengeResponse.
When it is not possible to create a ChallengeResponse, this method MUST return null.handle in class ChallengeHandlerchallengeRequest - a challenge objectnull if no response is possible.public abstract DispatchChallengeHandler register(String locationDescription, ChallengeHandler challengeHandler)
locationDescription
matches against elements of the protected URI; if a match is found, one
consults the challenge handler(s) registered at that locationDescription to find
a challenge handler suitable to respond to the challenge.
A locationDescription comprises a username, password, host, port and paths,
any of which can be wild-carded with the "*" character to match any number of request URIs.
If no port is explicitly mentioned in a locationDescription, a default port will be inferred
based on the scheme mentioned in the location description, according to the following table:
| scheme | default port | Sample locationDescription |
|---|---|---|
| http | 80 | foo.example.com or http://foo.example.com |
| ws | 80 | foo.example.com or ws://foo.example.com |
| https | 443 | https://foo.example.com |
| wss | 443 | wss://foo.example.com |
locationDescription will not be used to
match locationDescription with the protected URI, because authentication challenges are
implemented on top of one of the HTTP/s protocols always, whether one is initiating web socket
connections or regular HTTP connections. That is to say for example, the locationDescription "foo.example.com"
matches both URIs http://foo.example.com and ws://foo.example.com.
Some examples of locationDescription values with wildcards are:
*/ -- matches all requests to any host on port 80 (default port), with no user info or path specified. *.hostname.com:8000 -- matches all requests to port 8000 on any sub-domain of hostname.com,
but not hostname.com itself.server.hostname.com:*/* -- matches all requests to a particular server on any port on any path but not the empty path. locationDescription - the (possibly wild-carded) location(s) at which to register a handler.challengeHandler - the challenge handler to register at the location(s).public abstract DispatchChallengeHandler unregister(String locationDescription, ChallengeHandler challengeHandler)
locationDescription - the exact location description at which the challenge handler was originally registeredchallengeHandler - the challenge handler to de-register.Copyright © 2015. All Rights Reserved.