Package org.eclipse.jetty.jaas
Class JAASLoginService
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.jaas.JAASLoginService
- All Implemented Interfaces:
LoginService
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
JAASLoginService
Implementation of jetty's LoginService that works with JAAS for
authorization and authentication.
-
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
Modifier and TypeFieldDescriptionprotected String
protected Configuration
protected JAASUserPrincipal
protected IdentityService
protected String
protected String
protected String[]
static final String
static final String[]
static final ThreadLocal<JAASLoginService>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
Starts the managed lifecycle beans in the order they were added.protected String[]
Get all of the groups for the user.Get the identityService.getName()
Get the name of the realm.String[]
Login a user.void
logout
(UserIdentity user) void
setCallbackHandlerClass
(String classname) void
setConfiguration
(Configuration configuration) void
setIdentityService
(IdentityService identityService) Set the identityService.void
setLoginModuleName
(String name) Set the name to use to index into the config file of LoginModules.void
Set the name of the realmvoid
setRoleClassNames
(String[] classnames) boolean
validate
(UserIdentity user) Validate a user identity.Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStop, 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, toString
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
-
Field Details
-
DEFAULT_ROLE_CLASS_NAME
- See Also:
-
DEFAULT_ROLE_CLASS_NAMES
-
INSTANCE
-
_roleClassNames
-
_callbackHandlerClass
-
_realmName
-
_loginModuleName
-
_defaultUser
-
_identityService
-
_configuration
-
-
Constructor Details
-
JAASLoginService
public JAASLoginService() -
JAASLoginService
- Parameters:
name
- the name of the realm
-
-
Method Details
-
getName
Get the name of the realm.- Specified by:
getName
in interfaceLoginService
- Returns:
- name or null if not set.
-
setName
Set the name of the realm- Parameters:
name
- aString
value
-
getConfiguration
- Returns:
- the configuration
-
setConfiguration
- Parameters:
configuration
- the configuration to set
-
getIdentityService
Get the identityService.- Specified by:
getIdentityService
in interfaceLoginService
- Returns:
- the identityService
-
setIdentityService
Set the identityService.- Specified by:
setIdentityService
in interfaceLoginService
- Parameters:
identityService
- the identityService to set
-
setLoginModuleName
Set the name to use to index into the config file of LoginModules.- Parameters:
name
- aString
value
-
setCallbackHandlerClass
-
setRoleClassNames
-
getRoleClassNames
-
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
-
login
public UserIdentity login(String username, Object credentials, javax.servlet.ServletRequest request) Description copied from interface:LoginService
Login a user.- Specified by:
login
in interfaceLoginService
- Parameters:
username
- The user namecredentials
- The users credentialsrequest
- TODO- Returns:
- A UserIdentity if the credentials matched, otherwise null
-
validate
Description copied from interface:LoginService
Validate a user identity. Validate that a UserIdentity previously created by a call toLoginService.login(String, Object, ServletRequest)
is still valid.- Specified by:
validate
in interfaceLoginService
- Parameters:
user
- The user to validate- Returns:
- true if authentication has not been revoked for the user.
-
logout
- Specified by:
logout
in interfaceLoginService
-
getGroups
Get all of the groups for the user.- Parameters:
subject
- the Subject representing the user- Returns:
- all the names of groups that the user is in, or 0 length array if none
-