Class FormAuthenticationHandler

java.lang.Object
io.milton.http.http11.auth.FormAuthenticationHandler
All Implemented Interfaces:
AuthenticationHandler

public class FormAuthenticationHandler extends Object implements AuthenticationHandler
Supports authentication from form parameters. Note that this will not by itself result in a persistent login. It should be used with cookie authentication handler, or some equivalent session based handler
Author:
brad
  • Constructor Details

    • FormAuthenticationHandler

      public FormAuthenticationHandler()
  • Method Details

    • supports

      public boolean supports(Resource r, Request request)
      Description copied from interface: AuthenticationHandler
      Returns true if this supports authenticating with the given Auth data on the given resource. Only the first AuthenticationHandler which returns true for supports will be used for authentication. Ie supports implementations should be mutually exclusive
      Specified by:
      supports in interface AuthenticationHandler
      Parameters:
      r - - the resource being access
      Returns:
    • authenticate

      public Object authenticate(Resource resource, Request request)
      The authentication result is written to a request attribute called "loginResult". Its value is "true" if login succeeded and "false" if not. Note that a successful login does not ensure that that authorisation will succeed. If rendering a login page based on authentication and authorisation you should also look at the "authReason" attribute set by the LoginResponseHandler which gives the reason for an authorisation failure
      Specified by:
      authenticate in interface AuthenticationHandler
      Parameters:
      resource -
      request -
      Returns:
    • credentialsPresent

      public boolean credentialsPresent(Request request)
      Description copied from interface: AuthenticationHandler
      Determine if there are login credentials present. Should not attempt to validate credentials. Should only determine if something has been provided
      Specified by:
      credentialsPresent in interface AuthenticationHandler
      Returns:
    • appendChallenges

      public void appendChallenges(Resource resource, Request request, List<String> challenges)
      Description copied from interface: AuthenticationHandler
      Create a challenge for this authentication method. This should be completely formatted as per http://tools.ietf.org/html/rfc2617 and appended to the given list of challenges. It is allowable to append more then one challenge if appropriate
      Specified by:
      appendChallenges in interface AuthenticationHandler
      challenges - - the list of challenges to append to, or not, as appropriate
    • isCompatible

      public boolean isCompatible(Resource resource, Request request)
      Description copied from interface: AuthenticationHandler
      Returns true if this authentication handler is compatible with the given resource This is used when authorisation has failed, in generating challenge responses If you don't want to add a challenge response, return false
      Specified by:
      isCompatible in interface AuthenticationHandler
      Returns:
      - true if this can authenticate the resource, and it should issue a http challenge
    • getUserNameParam

      public String getUserNameParam()
    • setUserNameParam

      public void setUserNameParam(String userNameParam)
    • getPasswordParam

      public String getPasswordParam()
    • setPasswordParam

      public void setPasswordParam(String passwordParam)
    • getLoginResultAttName

      public String getLoginResultAttName()
      Get the attribute name used to store the login result. The login result is a Boolean which indicates if authentication was successful or not. A null value indicates that authentication was not attempted
      Returns:
    • setLoginResultAttName

      public void setLoginResultAttName(String loginResultAttName)