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:
 Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, Scanner.DiscreteListener, Scanner.Listener
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 ClassesNested classes/interfaces inherited from class UserStore
UserStore.UserNested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainer, Dumpable.DumpAppendableNested classes/interfaces inherited from interface LifeCycle
LifeCycle.Listener - 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Resourceprotected booleanprotected List<PropertyUserStore.UserListener> protected intprotected Scanner - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoStart()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 voiddoStop()Stops the managed lifecycle beans in the reverse order they were added.Get the config (as a string)Deprecated, for removal: This API element is subject to removal in a future version.intGet the period in seconds to scan for property file changes, or 0 for no scanning.booleanDeprecated.protected voidLoad the user data from the property file.voidCalled when a file is added.voidpathChanged(Path path) Called when a file is changed.voidpathRemoved(Path path) Called when a file is removed.voidRegisters a listener to be notified of the contents of the property filevoidSet the Config Path from a String reference to a filevoidsetHotReload(boolean enable) Deprecated.voidsetReloadInterval(int scanSeconds) Enable Hot Reload of the Property FiletoString()Methods inherited from class UserStore
addUser, getRolePrincipals, getUserPrincipal, removeUserMethods inherited from class ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Container
getCachedBeans, getEventListenersMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface Scanner.DiscreteListener
fileAdded, fileChanged, fileRemoved 
- 
Field Details
- 
_configResource
 - 
_scanner
 - 
_reloadInterval
protected int _reloadInterval - 
_firstLoad
protected boolean _firstLoad - 
_listeners
 
 - 
 - 
Constructor Details
- 
PropertyUserStore
public PropertyUserStore() 
 - 
 - 
Method Details
- 
getConfig
 - 
setConfig
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, 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.Is hot reload enabled on this user store- Returns:
 - true if hot reload was enabled before startup
 
 - 
setHotReload
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()Get the period in seconds to scan for property file changes, or 0 for no scanning.- Returns:
 - the period in seconds to scan for property file changes, or 0 for no scanning
 
 - 
toString
 - 
loadUsers
Load the user data from the property file.- Throws:
 IOException- If the users cannot be loaded
 - 
doStart
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:
 doStartin classContainerLifeCycle- Throws:
 Exception- If there was a problem starting. Will cause a transition to FAILED state
 - 
pathChanged
Description copied from interface:Scanner.DiscreteListenerCalled when a file is changed. Default implementation callsScanner.DiscreteListener.fileChanged(String).- Specified by:
 pathChangedin interfaceScanner.DiscreteListener- Parameters:
 path- thePath.toRealPath(LinkOption...)of the changed file- Throws:
 Exception- May be thrown for handling errors
 - 
pathAdded
Description copied from interface:Scanner.DiscreteListenerCalled when a file is added. Default implementation callsScanner.DiscreteListener.fileAdded(String).- Specified by:
 pathAddedin interfaceScanner.DiscreteListener- Parameters:
 path- thePath.toRealPath(LinkOption...)of the added file- Throws:
 Exception- May be thrown for handling errors
 - 
pathRemoved
Description copied from interface:Scanner.DiscreteListenerCalled when a file is removed. Default implementation callsScanner.DiscreteListener.fileRemoved(String).- Specified by:
 pathRemovedin interfaceScanner.DiscreteListener- Parameters:
 path- thePath.toRealPath(LinkOption...)of the removed file- Throws:
 Exception- May be thrown for handling errors
 - 
doStop
Description copied from class:ContainerLifeCycleStops the managed lifecycle beans in the reverse order they were added.- Overrides:
 doStopin classContainerLifeCycle- Throws:
 Exception- If there was a problem stopping. Will cause a transition to FAILED state
 - 
registerUserListener
Registers a listener to be notified of the contents of the property file- Parameters:
 listener- the user listener
 
 - 
 
getReloadInterval()