Class AbstractBasicHttpAuthenticatorFactory

  • All Implemented Interfaces:
    ServletAuthenticatorFactory

    public abstract class AbstractBasicHttpAuthenticatorFactory
    extends java.lang.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 Detail

      • guestUserName

        protected java.lang.String guestUserName
      • basicRealm

        protected java.lang.String basicRealm
    • Constructor Detail

      • AbstractBasicHttpAuthenticatorFactory

        public AbstractBasicHttpAuthenticatorFactory()
    • Method Detail

      • doAuthenticate

        public abstract boolean doAuthenticate​(java.lang.String username,
                                               java.lang.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​(java.lang.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​(java.lang.String guestUserName)
        The guest username.
        Parameters:
        guestUserName - The guest username
      • setBasicRealm

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