org.webbitserver.handler.authentication
Class BasicAuthenticationHandler

java.lang.Object
  extended by org.webbitserver.handler.authentication.BasicAuthenticationHandler
All Implemented Interfaces:
HttpHandler

public class BasicAuthenticationHandler
extends Object
implements HttpHandler

Adds HTTP Basic authentication to a page. Users should provide an implementation of UsernamePasswordAuthenticator to check the supplied credentials.

See samples.authentication.SimplePasswordsExample in the src/tests directory for a really basic usage. To implement a custom authenticator that performs background IO, see samples.authentication.AsyncPasswordsExample.

See Also:
PasswordAuthenticator, InMemoryPasswords

Field Summary
static String USERNAME
           
 
Constructor Summary
BasicAuthenticationHandler(PasswordAuthenticator authenticator)
           
BasicAuthenticationHandler(PasswordAuthenticator authenticator, String realm)
           
 
Method Summary
 void handleHttpRequest(HttpRequest request, HttpResponse response, HttpControl control)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USERNAME

public static final String USERNAME
See Also:
Constant Field Values
Constructor Detail

BasicAuthenticationHandler

public BasicAuthenticationHandler(PasswordAuthenticator authenticator)

BasicAuthenticationHandler

public BasicAuthenticationHandler(PasswordAuthenticator authenticator,
                                  String realm)
Method Detail

handleHttpRequest

public void handleHttpRequest(HttpRequest request,
                              HttpResponse response,
                              HttpControl control)
                       throws Exception
Specified by:
handleHttpRequest in interface HttpHandler
Throws:
Exception


Copyright © 2013. All Rights Reserved.