Class AbstractBasicHttpAuthenticatorFactory

java.lang.Object
org.springframework.extensions.webscripts.AbstractBasicHttpAuthenticatorFactory
All Implemented Interfaces:
ServletAuthenticatorFactory

public abstract class AbstractBasicHttpAuthenticatorFactory extends Object implements ServletAuthenticatorFactory
HTTP Basic Authentication

Abstract class that makes basic authentication easier to handle by managing the request headers and the base 64 decoding.

Extend this class and implement doAuthenticate and doAuthorize to authenticate and authorize against a specific user store.

Author:
Erik Winlof
  • Field Details

    • guestUserName

      protected String guestUserName
    • basicRealm

      protected String basicRealm
  • Constructor Details

    • AbstractBasicHttpAuthenticatorFactory

      public AbstractBasicHttpAuthenticatorFactory()
  • Method Details

    • create

      Factory's create method.
      Specified by:
      create in interface ServletAuthenticatorFactory
      Parameters:
      req - The webscript request
      res - THe webscript response
      Returns:
      A BasicHttpAuthenticator instance
    • doAuthenticate

      public abstract boolean doAuthenticate(String username, String password)
      Implement to authenticate against a specific user store.
      Parameters:
      username - The username
      password - The password
      Returns:
      Shall return true if authentication was successful
    • doAuthorize

      public abstract boolean doAuthorize(String username, Description.RequiredAuthentication role)
      Implement to authorize against a specific user store.
      Parameters:
      username - The username
      role - The role that the user MUST have
      Returns:
      Shall return true if the user has the given role
    • setGuestUserName

      public void setGuestUserName(String guestUserName)
      The guest username.
      Parameters:
      guestUserName - The guest username
    • setBasicRealm

      public void setBasicRealm(String basicRealm)
      The basic realm.
      Parameters:
      basicRealm - The basic realm