Package org.eclipse.jetty.ee8.security
Class PropertyUserStore
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.ee8.security.UserStore
org.eclipse.jetty.ee8.security.PropertyUserStore
- All Implemented Interfaces:
EventListener,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.PathWatcher.Listener
public class PropertyUserStore
extends UserStore
implements org.eclipse.jetty.util.PathWatcher.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 org.eclipse.jetty.ee8.security.UserStore
UserStore.UserNested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.eclipse.jetty.util.resource.Resourceprotected booleanprotected booleanprotected List<PropertyUserStore.UserListener>protected org.eclipse.jetty.util.PathWatcherFields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
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()org.eclipse.jetty.util.resource.ResourceGet the config (as a string)org.eclipse.jetty.util.resource.ResourceDeprecated, for removal: This API element is subject to removal in a future version.booleanIs hot reload enabled on this user storeprotected voidvoidonPathWatchEvent(org.eclipse.jetty.util.PathWatcher.PathWatchEvent event) voidRegisters a listener to be notified of the contents of the property filevoidsetConfig(org.eclipse.jetty.util.resource.Resource config) Set the Config Path from a String reference to a filevoidsetHotReload(boolean enable) Enable Hot Reload of the Property FiletoString()Methods inherited from class org.eclipse.jetty.ee8.security.UserStore
addUser, getRolePrincipals, getUserPrincipal, removeUserMethods 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, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListenersMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Field Details
-
_configResource
protected org.eclipse.jetty.util.resource.Resource _configResource -
_pathWatcher
protected org.eclipse.jetty.util.PathWatcher _pathWatcher -
_hotReload
protected boolean _hotReload -
_firstLoad
protected boolean _firstLoad -
_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, 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
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
-
toString
-
loadUsers
- Throws:
IOException
-
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 classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
onPathWatchEvent
public void onPathWatchEvent(org.eclipse.jetty.util.PathWatcher.PathWatchEvent event) - Specified by:
onPathWatchEventin interfaceorg.eclipse.jetty.util.PathWatcher.Listener
-
doStop
- Overrides:
doStopin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
registerUserListener
Registers a listener to be notified of the contents of the property file- Parameters:
listener- the user listener
-