Challenge handler for Basic authentication as defined in RFC 2617.

This BasicChallengeHandler can be loaded and instantiated using ChallengeHandlers.Load(), 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. This can be achieved using 'setLoginHandler(LoginHandler)' and 'setRealmLoginHandler(String, LoginHandler)' methods.

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.

 Copy imageCopy Code
             public class MyLoginHandler : LoginHandler {
               public PasswordAuthentication GetCredentials() {
                 return new PasswordAuthentication("global", "credentials".ToCharArray());
               }
             }
             BasicChallengeHandler basicHandler = ChallengeHandlers.Load<BasicChallengeHandler>(typeof(BasicChallengeHandler));
             basicHandler.LoginHandler = new MyLoginHandler();
             ChallengeHandlers.Default = basicHandler;
             

RFC 2616 - HTTP 1.1

RFC 2617 Section 2 - Basic Authentication

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

Syntax

Visual Basic
Public MustInherit Class BasicChallengeHandler _
	Inherits ChallengeHandler
C#
public abstract class BasicChallengeHandler : ChallengeHandler
Visual C++
public ref class BasicChallengeHandler abstract : public ChallengeHandler

Inheritance Hierarchy

System..::..Object
  Kaazing.Security..::..ChallengeHandler
    Kaazing.Security..::..BasicChallengeHandler

See Also