com.bradmcevoy.http
Class AuthenticationService

java.lang.Object
  extended by com.bradmcevoy.http.AuthenticationService

public class AuthenticationService
extends java.lang.Object

Author:
brad

Nested Class Summary
static class AuthenticationService.AuthStatus
           
 
Constructor Summary
AuthenticationService()
          Creates with Basic and Digest handlers
AuthenticationService(java.util.List<AuthenticationHandler> authenticationHandlers)
          Creates a AuthenticationService using the given handlers.
AuthenticationService(NonceProvider nonceProvider)
          Creates basic and digest handlers with the given NonceProvider
 
Method Summary
 AuthenticationService.AuthStatus authenticate(Resource resource, Request request)
          Looks for an AuthenticationHandler which supports the given resource and authorization header, and then returns the result of that handler's authenticate method.
 java.util.List<AuthenticationHandler> getAuthenticationHandlers()
           
 java.util.List<java.lang.String> getChallenges(Resource resource, Request request)
          Generates a list of http authentication challenges, one for each supported authentication method, to be sent to the client.
 java.util.List<AuthenticationHandler> getExtraHandlers()
           
 boolean isDisableBasic()
           
 boolean isDisableDigest()
           
 void setDisableBasic(boolean b)
           
 void setDisableDigest(boolean b)
           
 void setExtraHandlers(java.util.List<AuthenticationHandler> extraHandlers)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthenticationService

public AuthenticationService(java.util.List<AuthenticationHandler> authenticationHandlers)
Creates a AuthenticationService using the given handlers. Use this if you don't want the default of a BasicAuthHandler and a DigestAuthenticationHandler

Parameters:
authenticationHandlers -

AuthenticationService

public AuthenticationService(NonceProvider nonceProvider)
Creates basic and digest handlers with the given NonceProvider

Parameters:
nonceProvider -

AuthenticationService

public AuthenticationService()
Creates with Basic and Digest handlers

Method Detail

setDisableBasic

public void setDisableBasic(boolean b)

isDisableBasic

public boolean isDisableBasic()

setDisableDigest

public void setDisableDigest(boolean b)

isDisableDigest

public boolean isDisableDigest()

authenticate

public AuthenticationService.AuthStatus authenticate(Resource resource,
                                                     Request request)
Looks for an AuthenticationHandler which supports the given resource and authorization header, and then returns the result of that handler's authenticate method. Returns null if no handlers support the request

Parameters:
resource -
request -
Returns:
- null if no authentication was attempted. Otherwise, an AuthStatus object containing the Auth object and a boolean indicating whether the login succeeded

getChallenges

public java.util.List<java.lang.String> getChallenges(Resource resource,
                                                      Request request)
Generates a list of http authentication challenges, one for each supported authentication method, to be sent to the client.

Parameters:
resource - - the resoruce being requested
request - - the current request
Returns:
- a list of http challenges

getAuthenticationHandlers

public java.util.List<AuthenticationHandler> getAuthenticationHandlers()

getExtraHandlers

public java.util.List<AuthenticationHandler> getExtraHandlers()

setExtraHandlers

public void setExtraHandlers(java.util.List<AuthenticationHandler> extraHandlers)


Copyright © 2011. All Rights Reserved.