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

When a challenge is received for a protected URI, the {@code locationDescription} matches against elements of the protected URI; if a match is found, one consults the challenge handler(s) registered at that {@code locationDescription} to find a challenge handler suitable to respond to the challenge.

A {@code 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 {@code locationDescription}, a default port will be inferred based on the scheme mentioned in the location description, according to the following table:

 Copy imageCopy Code
             | 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
             +---------+------------------+-----------------------------
             

The protocol scheme (e.g. http or ws) if present in {@code locationDescription} will not be used to match {@code 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 {@code "foo.example.com"} matches both URIs {@code http://foo.example.com} and {@code ws://foo.example.com}.

Some examples of {@code locationDescription} values with wildcards are:

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

the (possibly wild-carded) location(s) at which to register a handler.the challenge handler to register at the location(s).

Return Value

a reference to this challenge handler for chained calls

Namespace:  Kaazing.Security
Assembly:  Kaazing.Gateway (in Kaazing.Gateway.dll)

Syntax

Visual Basic
Public MustOverride Function Register ( _
	locationDescription As String, _
	challengeHandler As ChallengeHandler _
) As DispatchChallengeHandler
C#
public abstract DispatchChallengeHandler Register(
	string locationDescription,
	ChallengeHandler challengeHandler
)
Visual C++
public:
virtual DispatchChallengeHandler^ Register(
	String^ locationDescription, 
	ChallengeHandler^ challengeHandler
) abstract

Parameters

locationDescription
Type: System..::..String
challengeHandler
Type: Kaazing.Security..::..ChallengeHandler

See Also