Packagecom.kaazing.gateway.client.security
Classpublic class DispatchChallengeHandler
InheritanceDispatchChallengeHandler Inheritance ChallengeHandler

A DispatchChallengeHandler is responsible for dispatching challenge requests to appropriate challenge handlers when challenges arrive from specific URI locations in HTTP 401 responses.

This allows clients to use specific challenge handlers to handle specific types of challenges at different URI locations.



Public Methods
 MethodDefined by
 Inherited
canHandle(challengeRequest:ChallengeRequest):Boolean
Can the presented challenge be potentially handled by this challenge handler?
ChallengeHandler
  
[static] Called to automatically discover the default implementation when loading this challenge handler.
DispatchChallengeHandler
 Inherited
handle(challengeRequest:ChallengeRequest, callback:Function):ChallengeResponseFuture
Handle the presented challenge by creating a challenge response future.
ChallengeHandler
  
register(locationDescription:String, challengeHandler:ChallengeHandler):DispatchChallengeHandler
Register a challenge handler to respond to challenges at one or more locations.
DispatchChallengeHandler
  
unregister(locationDescription:String, challengeHandler: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.
DispatchChallengeHandler
Method detail
defaultImplementation()method
public static function defaultImplementation():String

Called to automatically discover the default implementation when loading this challenge handler.

Returns
String
register()method 
public function register(locationDescription:String, challengeHandler:ChallengeHandler):DispatchChallengeHandler

Register a challenge handler to respond to challenges at one or more locations.

When a 401 response is received for a protected URI, the 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 /code> 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:

schemedefault portSample locationDescription
http80foo.example.com or http://foo.example.com
ws80foo.example.com or ws://foo.example.com
https443https://foo.example.com
wss443wss://foo.example.com

The protocol scheme (e.g. http or ws) if present in 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:

  1. */ -- matches all requests to any host on port 80 (default port), with no user info or path specified.
  2. *.hostname.com:8000 -- matches all requests to port 8000 on any sub-domain of hostname.com, but not hostname.com itself.
  3. server.hostname.com:*/* -- matches all requests to a particular server on any port on any path but not the empty path.

Parameters
locationDescription:String — the (possibly wild-carded) location(s) at which to register a handler.
 
challengeHandler:ChallengeHandler — the challenge handler to register at the location(s).

Returns
DispatchChallengeHandler — a reference to this challenge handler for chained calls
unregister()method 
public function unregister(locationDescription:String, challengeHandler: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.

If no such location or challengeHandler registration exists, this method silently succeeds.

Parameters
locationDescription:String — the exact location description at which the challenge handler was originally registered
 
challengeHandler:ChallengeHandler — the challenge handler to de-register.

Returns
ChallengeHandler — a reference to this object for chained call support