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, 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
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.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.DumpableContainer, org.eclipse.jetty.util.component.Dumpable.DumpAppendableNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener -
Field Summary
Fields inherited from class AbstractLoginService
_fullValidate, _identityService, _nameFields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
LEGEND -
Constructor Summary
ConstructorsConstructorDescriptionCreates a hash login service with no name or configuration.HashLoginService(String name) Creates a hash login service with the specified name.HashLoginService(String name, org.eclipse.jetty.util.resource.Resource config) Creates a hash login service with the specified name and configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoStart()protected voiddoStop()org.eclipse.jetty.util.resource.ResourceintGet the scan interval in seconds for reloading the property file..booleanDeprecated.protected List<RolePrincipal> loadRoleInfo(UserPrincipal user) protected UserPrincipalloadUserInfo(String userName) voidsetConfig(org.eclipse.jetty.util.resource.Resource config) Load users from properties file.voidsetHotReload(boolean enable) Deprecated.voidsetReloadInterval(int reloadIntervalSeconds) voidsetUserStore(UserStore userStore) Configure theUserStoreimplementation to use.Methods inherited from class AbstractLoginService
getIdentityService, getName, isFullValidate, login, logout, setFullValidate, setIdentityService, setName, toString, validateMethods 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, 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 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
isDumpableMethods inherited from interface LoginService
getUserIdentity
-
Constructor Details
-
HashLoginService
public HashLoginService()Creates a hash login service with no name or configuration. -
HashLoginService
Creates a hash login service with the specified name.- Parameters:
name- the name of this login service
-
HashLoginService
Creates a hash login service with the specified name and configuration.- Parameters:
name- the name of this login serviceconfig- the resource containing user configuration
-
-
Method Details
-
getConfig
public org.eclipse.jetty.util.resource.Resource getConfig()- Returns:
- the configuration resource containing user data
-
setConfig
public void setConfig(org.eclipse.jetty.util.resource.Resource 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
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 theUserStoreimplementation to use. If none, for backward compat if none thePropertyUserStorewill be used- Parameters:
userStore- theUserStoreimplementation to use
-
loadRoleInfo
- Specified by:
loadRoleInfoin classAbstractLoginService
-
loadUserInfo
- Specified by:
loadUserInfoin classAbstractLoginService
-
doStart
-
doStop
-
getReloadInterval()