Package org.eclipse.jetty.security
Class HashLoginService
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.security.AbstractLoginService
org.eclipse.jetty.security.HashLoginService
- All Implemented Interfaces:
LoginService
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
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
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopException
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
Fields inherited from class org.eclipse.jetty.security.AbstractLoginService
_fullValidate, _identityService, _name
-
Constructor Summary
ConstructorDescriptionHashLoginService
(String name) HashLoginService
(String name, Resource config) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
Starts the managed lifecycle beans in the order they were added.protected void
doStop()
Stops the managed lifecycle beans in the reverse order they were added.int
Get the scan interval in seconds for reloading the property file..boolean
Deprecated.protected List<RolePrincipal>
loadRoleInfo
(UserPrincipal user) protected UserPrincipal
loadUserInfo
(String userName) void
Load users from properties file.void
setHotReload
(boolean enable) Deprecated.void
setReloadInterval
(int reloadIntervalSeconds) void
setUserStore
(UserStore userStore) Configure theUserStore
implementation to use.Methods inherited from class org.eclipse.jetty.security.AbstractLoginService
getIdentityService, getName, isFullValidate, login, logout, setFullValidate, setIdentityService, setName, toString, validate
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, installBean, installBean, 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.DumpableContainer
isDumpable
Methods inherited from interface org.eclipse.jetty.security.LoginService
getUserIdentity
-
Constructor Details
-
HashLoginService
public HashLoginService() -
HashLoginService
-
HashLoginService
-
-
Method Details
-
getConfig
-
setConfig
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
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 1s refresh interval, false to disable
-
getReloadInterval
public int getReloadInterval()Get the scan interval in seconds for reloading the property file..- Returns:
- the scan interval in seconds for reloading the property file.
-
setReloadInterval
public void setReloadInterval(int reloadIntervalSeconds) - Parameters:
reloadIntervalSeconds
- Set the scan interval in seconds for reloading the property file.
-
setUserStore
Configure theUserStore
implementation to use. If none, for backward compat if none thePropertyUserStore
will be used- Parameters:
userStore
- theUserStore
implementation to use
-
loadRoleInfo
- Specified by:
loadRoleInfo
in classAbstractLoginService
-
loadUserInfo
- Specified by:
loadUserInfo
in classAbstractLoginService
-
doStart
Description copied from class:ContainerLifeCycle
Starts the managed lifecycle beans in the order they were added.- Overrides:
doStart
in classContainerLifeCycle
- Throws:
AbstractLifeCycle.StopException
- If thrown, the lifecycle will immediately be stopped.Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
Description copied from class:ContainerLifeCycle
Stops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStop
in classContainerLifeCycle
- Throws:
Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-
getReloadInterval()