Class PropertyUserStore

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.security.UserStore
org.eclipse.jetty.security.PropertyUserStore
All Implemented Interfaces:
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, org.eclipse.jetty.util.Scanner.DiscreteListener, org.eclipse.jetty.util.Scanner.Listener

public class PropertyUserStore extends UserStore implements org.eclipse.jetty.util.Scanner.DiscreteListener

This class monitors a property file of the format mentioned below and notifies registered listeners of the changes to the the given file.

  username: password [,rolename ...]
 

Passwords may be clear text, obfuscated or checksummed. The class 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 obfuscated.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     

    Nested classes/interfaces inherited from class org.eclipse.jetty.security.UserStore

    UserStore.User

    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
    Modifier and Type
    Field
    Description
    protected org.eclipse.jetty.util.resource.Resource
     
    protected boolean
     
     
    protected int
     
    protected org.eclipse.jetty.util.Scanner
     

    Fields inherited from class org.eclipse.jetty.security.UserStore

    _users

    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
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Depending on the value of the refresh interval, this method will either start up a scanner thread that will monitor the properties file for changes after it has initially loaded it.
    protected void
     
    org.eclipse.jetty.util.resource.Resource
    Get the config (as a string)
    org.eclipse.jetty.util.resource.Resource
    Deprecated, for removal: This API element is subject to removal in a future version. 
    int
     
    boolean
    Deprecated.
    protected void
    Load the user data from the property file.
    void
     
    void
     
    void
     
    void
    Registers a listener to be notified of the contents of the property file
    void
    setConfig(org.eclipse.jetty.util.resource.Resource config)
    Set the Config Path from a String reference to a file
    void
    setHotReload(boolean enable)
    Deprecated.
    void
    setReloadInterval(int scanSeconds)
    Enable Hot Reload of the Property File
     

    Methods inherited from class org.eclipse.jetty.security.UserStore

    addUser, getRolePrincipals, getUserPrincipal, removeUser

    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, 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

    Methods inherited from interface org.eclipse.jetty.util.Scanner.DiscreteListener

    fileAdded, fileChanged, fileRemoved
  • Field Details

    • _configResource

      protected org.eclipse.jetty.util.resource.Resource _configResource
    • _scanner

      protected org.eclipse.jetty.util.Scanner _scanner
    • _reloadInterval

      protected int _reloadInterval
    • _firstLoad

      protected boolean _firstLoad
    • _listeners

      protected List<PropertyUserStore.UserListener> _listeners
  • Constructor Details

    • PropertyUserStore

      public PropertyUserStore()
  • Method Details

    • getConfig

      public org.eclipse.jetty.util.resource.Resource getConfig()
      Get the config (as a string)
      Returns:
      the config path as a string
    • setConfig

      public void setConfig(org.eclipse.jetty.util.resource.Resource config)
      Set the Config Path from a String reference to a file
      Parameters:
      config - the config file TODO: reintroduce setConfig(String) and internal ResourceFactory usage
    • getConfigResource

      @Deprecated(forRemoval=true) public org.eclipse.jetty.util.resource.Resource getConfigResource()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      the resource associated with the configured properties file, creating it if necessary
    • isHotReload

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

      @Deprecated public void setHotReload(boolean enable)
      Deprecated.
      Enable Hot Reload of the Property File
      Parameters:
      enable - true to enable to a 1 second scan, false to disable
    • setReloadInterval

      public void setReloadInterval(int scanSeconds)
      Enable Hot Reload of the Property File
      Parameters:
      scanSeconds - the period in seconds to scan for property file changes, or 0 for no scanning
    • getReloadInterval

      public int getReloadInterval()
      Returns:
      the period in seconds to scan for property file changes, or 0 for no scanning
    • toString

      public String toString()
      Overrides:
      toString in class UserStore
    • loadUsers

      protected void loadUsers() throws IOException
      Load the user data from the property file.
      Throws:
      IOException - If the users cannot be loaded
    • doStart

      protected void doStart() throws Exception
      Depending on the value of the refresh interval, this method will either start up a scanner thread that will monitor the properties file for changes after it has initially loaded it. Otherwise the users will be loaded and there will be no active monitoring thread so changes will not be detected.
      Overrides:
      doStart in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      Exception
    • pathChanged

      public void pathChanged(Path path) throws Exception
      Specified by:
      pathChanged in interface org.eclipse.jetty.util.Scanner.DiscreteListener
      Throws:
      Exception
    • pathAdded

      public void pathAdded(Path path) throws Exception
      Specified by:
      pathAdded in interface org.eclipse.jetty.util.Scanner.DiscreteListener
      Throws:
      Exception
    • pathRemoved

      public void pathRemoved(Path path) throws Exception
      Specified by:
      pathRemoved in interface org.eclipse.jetty.util.Scanner.DiscreteListener
      Throws:
      Exception
    • doStop

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

      public void registerUserListener(PropertyUserStore.UserListener listener)
      Registers a listener to be notified of the contents of the property file
      Parameters:
      listener - the user listener