Class HashLoginService

  • All Implemented Interfaces:
    LoginService, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle

    public class HashLoginService
    extends AbstractLoginService
    An implementation of a LoginService that stores users and roles in-memory in HashMaps. The source of the users and roles information is a properties file formatted like so:
      username: password [,rolename ...]
     
    Passwords may be clear text, obfuscated or checksummed. The class com.eclipse.Util.Password should be used to generate obfuscated passwords or password checksums.

    If DIGEST Authentication is used, the password must be in a recoverable format, either plain text or OBF:.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container

        org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable

        org.eclipse.jetty.util.component.Dumpable.DumpableContainer
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

        org.eclipse.jetty.util.component.LifeCycle.Listener
    • Field Summary

      • Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        FAILED, STARTED, STARTING, STOPPED, STOPPING
      • Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

        KEY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doStart()  
      protected void doStop()  
      java.lang.String getConfig()  
      boolean isHotReload()
      Is hot reload enabled on this user store
      protected java.util.List<RolePrincipal> loadRoleInfo​(UserPrincipal user)  
      protected UserPrincipal loadUserInfo​(java.lang.String userName)  
      void setConfig​(java.lang.String config)
      Load users from properties file.
      void setHotReload​(boolean enable)
      Enable Hot Reload of the Property File
      void setUserStore​(UserStore userStore)
      Configure the UserStore implementation to use.
      • Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

        addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans
      • Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.eclipse.jetty.util.component.Container

        getCachedBeans, getEventListeners
      • Methods inherited from interface org.eclipse.jetty.util.component.Dumpable

        dumpSelf
      • Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer

        isDumpable
    • Constructor Detail

      • HashLoginService

        public HashLoginService()
      • HashLoginService

        public HashLoginService​(java.lang.String name)
      • HashLoginService

        public HashLoginService​(java.lang.String name,
                                java.lang.String config)
    • Method Detail

      • getConfig

        public java.lang.String getConfig()
      • setConfig

        public void setConfig​(java.lang.String config)
        Load users from properties file.

        The property file maps usernames to password specs followed by an optional comma separated list of role names.

        Parameters:
        config - uri or url or path to realm properties file
      • isHotReload

        public boolean isHotReload()
        Is hot reload enabled on this user store
        Returns:
        true if hot reload was enabled before startup
      • setHotReload

        public void setHotReload​(boolean enable)
        Enable Hot Reload of the Property File
        Parameters:
        enable - true to enable, false to disable
      • setUserStore

        public void setUserStore​(UserStore userStore)
        Configure the UserStore implementation to use. If none, for backward compat if none the PropertyUserStore will be used
        Parameters:
        userStore - the UserStore implementation to use
      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Overrides:
        doStart in class org.eclipse.jetty.util.component.ContainerLifeCycle
        Throws:
        java.lang.Exception
      • doStop

        protected void doStop()
                       throws java.lang.Exception
        Overrides:
        doStop in class org.eclipse.jetty.util.component.ContainerLifeCycle
        Throws:
        java.lang.Exception