Package waffle.apache

Class MixedAuthenticator

java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.valves.ValveBase
org.apache.catalina.authenticator.AuthenticatorBase
waffle.apache.MixedAuthenticator
All Implemented Interfaces:
jakarta.security.auth.message.config.RegistrationListener, MBeanRegistration, org.apache.catalina.Authenticator, org.apache.catalina.Contained, org.apache.catalina.JmxEnabled, org.apache.catalina.Lifecycle, org.apache.catalina.Valve

public class MixedAuthenticator extends org.apache.catalina.authenticator.AuthenticatorBase
Mixed Negotiate + Form Authenticator.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.catalina.authenticator.AuthenticatorBase

    org.apache.catalina.authenticator.AuthenticatorBase.AllowCorsPreflight

    Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle

    org.apache.catalina.Lifecycle.SingleUse
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    The allow guest login.
    The auth.
    protected int
    The auth continueContextsTimeout configuration.
    protected String
    The info.
    protected org.slf4j.Logger
    The log.
    protected PrincipalFormat
    The principal format.
    protected Set<String>
    The protocols.
    protected PrincipalFormat
    The role format.

    Fields inherited from class org.apache.catalina.authenticator.AuthenticatorBase

    alwaysUseSession, AUTH_HEADER_NAME, cache, changeSessionIdOnAuthentication, context, disableProxyCaching, jaspicCallbackHandlerClass, REALM_NAME, securePagesWithPragma, secureRandomAlgorithm, secureRandomClass, secureRandomProvider, sendAuthInfoResponseHeaders, sessionIdGenerator, sm, sso

    Fields inherited from class org.apache.catalina.valves.ValveBase

    asyncSupported, container, containerLog, next

    Fields inherited from interface org.apache.catalina.Lifecycle

    AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a new mixed authenticator.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    authenticate(org.apache.catalina.connector.Request request, javax.servlet.http.HttpServletResponse response)
     
    protected org.apache.catalina.realm.GenericPrincipal
    This method will create an instance of a IWindowsIdentity based GenericPrincipal.
    protected boolean
    doAuthenticate(org.apache.catalina.connector.Request request, javax.servlet.http.HttpServletResponse response)
    XXX The 'doAuthenticate' is intended to replace 'authenticate' for needs like ours.
    protected Principal
    doLogin(org.apache.catalina.connector.Request request, String username, String password)
     
    Windows authentication provider.
    protected String
     
    int
    Gets the continue context time out configuration.
    Gets the info.
    Principal format.
    Principal format.
    boolean
    True if Guest login permitted.
    protected void
    sendError(javax.servlet.http.HttpServletResponse response, int code)
    Send an error code.
    protected void
    sendUnauthorized(javax.servlet.http.HttpServletResponse response)
    Send a 401 Unauthorized along with protocol authentication headers.
    void
    setAllowGuestLogin(boolean value)
    Set whether Guest login is permitted.
    void
    Set Windows auth provider.
    void
    setContinueContextsTimeout(int continueContextsTimeout)
    Sets the continue context time out configuration.
    void
    Set the principal format.
    void
    Set the authentication protocols.
    void
    Set the principal format.
    void
    Hook to the start and to set up the dependencies.
    void
     

    Methods inherited from class org.apache.catalina.authenticator.AuthenticatorBase

    allowCorsPreflightBypass, associate, authenticate, changeSessionID, checkForCachedAuthentication, doAuthenticate, getAllowCorsPreflight, getAlwaysUseSession, getCache, getChangeSessionIdOnAuthentication, getContainer, getDisableProxyCaching, getJaspicCallbackHandlerClass, getRealmName, getSecurePagesWithPragma, getSecureRandomAlgorithm, getSecureRandomClass, getSecureRandomProvider, invoke, isContinuationRequired, isPreemptiveAuthPossible, isSendAuthInfoResponseHeaders, login, logout, notify, reauthenticateFromSSO, register, register, setAllowCorsPreflight, setAlwaysUseSession, setCache, setChangeSessionIdOnAuthentication, setContainer, setDisableProxyCaching, setJaspicCallbackHandlerClass, setSecurePagesWithPragma, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSendAuthInfoResponseHeaders

    Methods inherited from class org.apache.catalina.valves.ValveBase

    backgroundProcess, getDomainInternal, getNext, getObjectNameKeyProperties, initInternal, isAsyncSupported, setAsyncSupported, setNext, toString

    Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase

    destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister

    Methods inherited from class org.apache.catalina.util.LifecycleBase

    addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • info

      protected String info
      The info.
    • log

      protected org.slf4j.Logger log
      The log.
    • principalFormat

      protected PrincipalFormat principalFormat
      The principal format.
    • roleFormat

      protected PrincipalFormat roleFormat
      The role format.
    • allowGuestLogin

      protected boolean allowGuestLogin
      The allow guest login.
    • protocols

      protected Set<String> protocols
      The protocols.
    • continueContextsTimeout

      protected int continueContextsTimeout
      The auth continueContextsTimeout configuration.
    • auth

      protected IWindowsAuthProvider auth
      The auth.
  • Constructor Details

    • MixedAuthenticator

      public MixedAuthenticator()
      Instantiates a new mixed authenticator.
  • Method Details

    • startInternal

      public void startInternal() throws org.apache.catalina.LifecycleException
      Hook to the start and to set up the dependencies.
      Throws:
      org.apache.catalina.LifecycleException - the lifecycle exception
    • stopInternal

      public void stopInternal() throws org.apache.catalina.LifecycleException
      Overrides:
      stopInternal in class org.apache.catalina.authenticator.AuthenticatorBase
      Throws:
      org.apache.catalina.LifecycleException
    • authenticate

      public boolean authenticate(org.apache.catalina.connector.Request request, javax.servlet.http.HttpServletResponse response)
    • doAuthenticate

      protected boolean doAuthenticate(org.apache.catalina.connector.Request request, javax.servlet.http.HttpServletResponse response) throws IOException
      XXX The 'doAuthenticate' is intended to replace 'authenticate' for needs like ours. In order to support old and new at this time, we will continue to have both for time being.
      Throws:
      IOException
    • getContinueContextsTimeout

      public int getContinueContextsTimeout()
      Gets the continue context time out configuration.
      Returns:
      the continue contexts timeout
    • setContinueContextsTimeout

      public void setContinueContextsTimeout(int continueContextsTimeout)
      Sets the continue context time out configuration.
      Parameters:
      continueContextsTimeout - the new continue contexts timeout
    • getAuth

      public IWindowsAuthProvider getAuth()
      Windows authentication provider.
      Returns:
      IWindowsAuthProvider.
    • setAuth

      public void setAuth(IWindowsAuthProvider provider)
      Set Windows auth provider.
      Parameters:
      provider - Class implements IWindowsAuthProvider.
    • getInfo

      public String getInfo()
      Gets the info.
      Returns:
      the info
    • setPrincipalFormat

      public void setPrincipalFormat(String format)
      Set the principal format.
      Parameters:
      format - Principal format.
    • getPrincipalFormat

      public PrincipalFormat getPrincipalFormat()
      Principal format.
      Returns:
      Principal format.
    • setRoleFormat

      public void setRoleFormat(String format)
      Set the principal format.
      Parameters:
      format - Role format.
    • getRoleFormat

      public PrincipalFormat getRoleFormat()
      Principal format.
      Returns:
      Role format.
    • isAllowGuestLogin

      public boolean isAllowGuestLogin()
      True if Guest login permitted.
      Returns:
      True if Guest login permitted, false otherwise.
    • setAllowGuestLogin

      public void setAllowGuestLogin(boolean value)
      Set whether Guest login is permitted. Default is true, if the Guest account is enabled, an invalid username/password results in a Guest login.
      Parameters:
      value - True or false.
    • setProtocols

      public void setProtocols(String value)
      Set the authentication protocols. Default is "Negotiate, NTLM".
      Parameters:
      value - Authentication protocols
    • sendUnauthorized

      protected void sendUnauthorized(javax.servlet.http.HttpServletResponse response)
      Send a 401 Unauthorized along with protocol authentication headers.
      Parameters:
      response - HTTP Response
    • sendError

      protected void sendError(javax.servlet.http.HttpServletResponse response, int code)
      Send an error code.
      Parameters:
      response - HTTP Response
      code - Error Code
    • getAuthMethod

      protected String getAuthMethod()
      Specified by:
      getAuthMethod in class org.apache.catalina.authenticator.AuthenticatorBase
    • doLogin

      protected Principal doLogin(org.apache.catalina.connector.Request request, String username, String password) throws javax.servlet.ServletException
      Overrides:
      doLogin in class org.apache.catalina.authenticator.AuthenticatorBase
      Throws:
      javax.servlet.ServletException
    • createPrincipal

      protected org.apache.catalina.realm.GenericPrincipal createPrincipal(IWindowsIdentity windowsIdentity)
      This method will create an instance of a IWindowsIdentity based GenericPrincipal. It is used for creating custom implementation within subclasses.
      Parameters:
      windowsIdentity - the windows identity to initialize the principal
      Returns:
      the Generic Principal