Packagecom.kaazing.gateway.client.security
Classpublic class BasicChallengeHandler
InheritanceBasicChallengeHandler Inheritance ChallengeHandler

Challenge handler for Basic authentication as defined in RFC 2617.

This BasicChallengeHandler can be loaded and instantiated using ChallengeHandlers.load(clazz:Class), and registered at a location using DispatchChallengeHandler.register(String, ChallengeHandler).

In addition, one can install general and realm-specific LoginHandler objects onto this BasicChallengeHandler to assist in handling challenges associated with any or specific realms.

The following example loads an instance of a BasicChallengeHandler, sets a login handler onto it and registers the basic handler at a URI location. In this way, all attempts to access that URI for which the server issues "Basic" challenges are handled by the registered BasicChallengeHandler .

 var loginHandler:LoginHandler = new LoginHandler() {
       override public function getCredentials(continuation:Function):void {
           continuation("global", "credentials");
       }
 };
  ChallengeHandlers.setDefault((ChallengeHandlers.load(DispatchChallengeHandler.class) as DispatchChallengeHandler)
    .register("ws://localhost:8001", (ChallengeHandlers.load(BasicChallengeHandler.class) as BasicChallengeHandler)
            .setLoginHandler(loginHandler);
    )
  );
 

See also

to instantiate a BasicChallengeHandler.
RFC 2616 - HTTP 1.1
RFC 2617 Section 2 - Basic Authentication


Public Properties
 PropertyDefined by
  loginHandler : LoginHandler
Get the general (non-realm-specific) login handler associated with this challenge handler.
BasicChallengeHandler
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.
BasicChallengeHandler
  
Get the general (non-realm-specific) login handler associated with this challenge handler.
BasicChallengeHandler
 Inherited
handle(challengeRequest:ChallengeRequest, callback:Function):ChallengeResponseFuture
Handle the presented challenge by creating a challenge response future.
ChallengeHandler
  
Provide a general (non-realm-specific) login handler to be used in association with this challenge handler.
BasicChallengeHandler
  
Set a Login Handler to be used if and only if a challenge request has a realm parameter matching the provided realm.
BasicChallengeHandler
Property detail
loginHandlerproperty
loginHandler:LoginHandler  [read-write]

Get the general (non-realm-specific) login handler associated with this challenge handler. A login handler is used to assist in obtaining credentials to respond to challenge requests.

Implementation
    public function get loginHandler():LoginHandler
    public function set loginHandler(value:LoginHandler):void
Method detail
defaultImplementation()method
public static function defaultImplementation():String

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

Returns
String
getLoginHandler()method 
public function getLoginHandler():LoginHandler

Get the general (non-realm-specific) login handler associated with this challenge handler. A login handler is used to assist in obtaining credentials to respond to challenge requests.

Returns
LoginHandler — a login handler to assist in providing credentials, or null if none has been established yet.
setLoginHandler()method 
public function setLoginHandler(loginHandler:LoginHandler):BasicChallengeHandler

Provide a general (non-realm-specific) login handler to be used in association with this challenge handler. The login handler is used to assist in obtaining credentials to respond to any Basic challenge requests when no realm-specific login handler matches the realm parameter of the request (if any).

Parameters
loginHandler:LoginHandler — a login handler for credentials.

Returns
BasicChallengeHandler
setRealmLoginHandler()method 
public function setRealmLoginHandler(realm:String, loginHandler:LoginHandler):BasicChallengeHandler

Set a Login Handler to be used if and only if a challenge request has a realm parameter matching the provided realm.

Parameters
realm:String — the realm upon which to apply the loginHandler.
 
loginHandler:LoginHandler — the login handler to use for the provided realm.

Returns
BasicChallengeHandler