org.webbitserver.handler.authentication
Interface PasswordAuthenticator

All Known Implementing Classes:
InMemoryPasswords

public interface PasswordAuthenticator

Provided to BasicAuthenticationHandler to verify the supplied username and password are valid.

Implementations should check username/password are valid and call ResultCallback.success() or ResultCallback.failure(). One of these methods must called - once and only once.

If the result cannot be obtained automatically, the code should not block (as this will block the entire server). Instead, the work should be offloaded to another thread/process, and the ResultCallback methods should be invoked using the handlerExecutor when done.

For simple cases, use InMemoryPasswords.

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:
BasicAuthenticationHandler, InMemoryPasswords

Nested Class Summary
static interface PasswordAuthenticator.ResultCallback
           
 
Method Summary
 void authenticate(HttpRequest request, String username, String password, PasswordAuthenticator.ResultCallback callback, Executor handlerExecutor)
           
 

Method Detail

authenticate

void authenticate(HttpRequest request,
                  String username,
                  String password,
                  PasswordAuthenticator.ResultCallback callback,
                  Executor handlerExecutor)


Copyright © 2012. All Rights Reserved.