Class AbstractEdAuthRealm

  • All Implemented Interfaces:
    MBeanRegistration, org.apache.catalina.Contained, org.apache.catalina.JmxEnabled, org.apache.catalina.Lifecycle, org.apache.catalina.Realm
    Direct Known Subclasses:
    EdAuthRealm, LoginRealm

    public abstract class AbstractEdAuthRealm
    extends org.apache.catalina.realm.RealmBase
    Base class to provide drop in authentication against EdAuth using Catalina security realms.
    Author:
    Middleware Services
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.catalina.realm.RealmBase

        org.apache.catalina.realm.RealmBase.AllRolesMode
      • Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle

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

      Fields 
      Modifier and Type Field Description
      protected EdAuthService auth
      Directory class
      protected org.apache.catalina.UserDatabase database
      Used to add additional roles to EdAuth users.
      protected org.slf4j.Logger logger
      Class logger instance.
      protected String resourceName
      The global JNDI name of the EdAuth resource.
      • Fields inherited from class org.apache.catalina.realm.RealmBase

        allRolesMode, container, containerLog, realmPath, sm, stripRealmForGss, support, validate, x509UsernameRetriever, x509UsernameRetrieverClassName
      • Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase

        mserver
      • 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
      AbstractEdAuthRealm​(EdAuthService service, String name)
      Creates a new instance of an AbstractEdAuthRealm object that can provide authentication.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Principal authenticate​(String username, String credentials)
      This returns the Principal associated with the specified username and credentials, if there is one; otherwise return null.
      Principal authenticate​(String username, String clientDigest, String nOnce, String nc, String cnonce, String qop, String realm, String md5a2)
      This method is not supported by this Realm.
      Principal authenticate​(X509Certificate[] certs)
      This method is not supported by this Realm.
      protected String getPassword​(String username)
      This method is not supported by this Realm.
      protected Principal getPrincipal​(String username)
      This returns the principal associated with the supplied user name.
      String getResourceName()
      This returns the global JNDI name of the UserDatabase resource used for adding additional roles to authenticated users.
      void setResourceName​(String newResourceName)
      This sets the global JNDI name of the UserDatabase resource used for adding additional roles to authenticated users.
      void startInternal()
      Prepare for active use of the public methods of this Component.
      void stopInternal()
      Gracefully shut down active use of the public methods of this Component.
      • Methods inherited from class org.apache.catalina.realm.RealmBase

        addPropertyChangeListener, authenticate, authenticate, authenticate, backgroundProcess, findSecurityConstraints, getAllRolesMode, getContainer, getCredentialHandler, getDigest, getDomainInternal, getObjectNameKeyProperties, getPrincipal, getPrincipal, getPrincipal, getRealmPath, getRealmSuffix, getRoles, getServer, getTransportGuaranteeRedirectStatus, getValidate, getX509UsernameRetrieverClassName, hasMessageDigest, hasResourcePermission, hasRole, hasRoleInternal, hasUserDataPermission, initInternal, isStripRealmForGss, main, removePropertyChangeListener, setAllRolesMode, setContainer, setCredentialHandler, setRealmPath, setStripRealmForGss, setTransportGuaranteeRedirectStatus, setValidate, setX509UsernameRetrieverClassName, 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 interface org.apache.catalina.Realm

        isAvailable
    • Field Detail

      • logger

        protected final org.slf4j.Logger logger
        Class logger instance.
      • database

        protected org.apache.catalina.UserDatabase database
        Used to add additional roles to EdAuth users.
      • resourceName

        protected String resourceName
        The global JNDI name of the EdAuth resource.
    • Constructor Detail

      • AbstractEdAuthRealm

        public AbstractEdAuthRealm​(EdAuthService service,
                                   String name)
        Creates a new instance of an AbstractEdAuthRealm object that can provide authentication.
        Parameters:
        service - EdAuthService to perform authentication
        name - String global JNDI name
    • Method Detail

      • getResourceName

        public String getResourceName()
        This returns the global JNDI name of the UserDatabase resource used for adding additional roles to authenticated users.
        Returns:
        String
      • setResourceName

        public void setResourceName​(String newResourceName)
        This sets the global JNDI name of the UserDatabase resource used for adding additional roles to authenticated users.
        Parameters:
        newResourceName - String new global JNDI name
      • authenticate

        public Principal authenticate​(String username,
                                      String credentials)
        This returns the Principal associated with the specified username and credentials, if there is one; otherwise return null.
        Specified by:
        authenticate in interface org.apache.catalina.Realm
        Overrides:
        authenticate in class org.apache.catalina.realm.RealmBase
        Parameters:
        username - String to look up
        credentials - String to use in authenticating this username
        Returns:
        Principal
      • authenticate

        public Principal authenticate​(X509Certificate[] certs)
        This method is not supported by this Realm. It will always return null.
        Specified by:
        authenticate in interface org.apache.catalina.Realm
        Overrides:
        authenticate in class org.apache.catalina.realm.RealmBase
        Parameters:
        certs - to authenticate
        Returns:
        Principal
      • getPassword

        protected String getPassword​(String username)
        This method is not supported by this Realm. It will always return null.
        Specified by:
        getPassword in class org.apache.catalina.realm.RealmBase
        Parameters:
        username - String
        Returns:
        String
      • getPrincipal

        protected Principal getPrincipal​(String username)
        This returns the principal associated with the supplied user name.
        Specified by:
        getPrincipal in class org.apache.catalina.realm.RealmBase
        Parameters:
        username - String
        Returns:
        Principal
      • startInternal

        public void startInternal()
                           throws org.apache.catalina.LifecycleException
        Prepare for active use of the public methods of this Component.
        Overrides:
        startInternal in class org.apache.catalina.realm.RealmBase
        Throws:
        org.apache.catalina.LifecycleException - if this component detects a fatal error that prevents it from being started
      • stopInternal

        public void stopInternal()
                          throws org.apache.catalina.LifecycleException
        Gracefully shut down active use of the public methods of this Component.
        Overrides:
        stopInternal in class org.apache.catalina.realm.RealmBase
        Throws:
        org.apache.catalina.LifecycleException - if this component detects a fatal error that needs to be reported