Class HttpRequestAttributeAuthenticationMethod

java.lang.Object
dev.getelements.elements.servlet.security.HttpRequestAttributeAuthenticationMethod
All Implemented Interfaces:
UserAuthenticationMethod

public class HttpRequestAttributeAuthenticationMethod extends Object implements UserAuthenticationMethod
Uses a property on the HttpServletRequest to supply the User. The auhenticated user is set to the request using ServletRequest.setAttribute(String, Object) using User.USER_ATTRIBUTE as the key. Created by patricktwohig on 6/26/17.
  • Constructor Details

    • HttpRequestAttributeAuthenticationMethod

      public HttpRequestAttributeAuthenticationMethod()
  • Method Details

    • attempt

      public User attempt()
      Description copied from interface: UserAuthenticationMethod
      Attempts authorization. If authorization fails, then this must throw an instance of ForbiddenException. Subsequence methods may be used before finally failing authentication with a ForbiddenException.
      Specified by:
      attempt in interface UserAuthenticationMethod
      Returns:
      the User, never null
    • getHttpServletRequest

      public jakarta.servlet.http.HttpServletRequest getHttpServletRequest()
    • setHttpServletRequest

      @Inject public void setHttpServletRequest(jakarta.servlet.http.HttpServletRequest httpServletRequest)