Package org.eclipse.jetty.security
Class SPNEGOLoginService
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.security.SPNEGOLoginService
- All Implemented Interfaces:
LoginService
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
A configurable (as opposed to using system properties) SPNEGO LoginService.
At startup, this LoginService will login via JAAS the service principal, composed
of the service name
and the host name
,
for example HTTP/wonder.com
, using a keyTab
file as the service principal
credentials.
Upon receiving an HTTP request, the server tries to authenticate the client
calling LoginService.login(String, Object, Request, Function)
where the GSS APIs are used to
verify client tokens and (perhaps after a few round-trips) a GSSContext
is
established.
-
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
Starts the managed lifecycle beans in the order they were added.Get the IdentityService associated with this Login Service.Get the path of the keyTab file containing service credentials.getName()
login
(String username, Object credentials, Request request, Function<Boolean, Session> getOrCreateSession) Login a user.void
logout
(UserIdentity user) void
setHostName
(String hostName) Set the host name of the service.void
setIdentityService
(IdentityService identityService) Set the IdentityService associated with this Login Service.void
setKeyTabPath
(Path keyTabFile) Set the path of the keyTab file containing service credentials.void
setServiceName
(String serviceName) 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, 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, 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
Methods inherited from interface org.eclipse.jetty.security.LoginService
getUserIdentity
-
Constructor Details
-
SPNEGOLoginService
-
-
Method Details
-
getName
- Specified by:
getName
in interfaceLoginService
- Returns:
- the realm name
-
getKeyTabPath
Get the path of the keyTab file containing service credentials.- Returns:
- the path of the keyTab file containing service credentials
-
setKeyTabPath
Set the path of the keyTab file containing service credentials.- Parameters:
keyTabFile
- the path of the keyTab file containing service credentials
-
getServiceName
- Returns:
- the service name, typically "HTTP"
- See Also:
-
setServiceName
- Parameters:
serviceName
- the service name- See Also:
-
getHostName
- Returns:
- the host name of the service
- See Also:
-
setHostName
Set the host name of the service.- Parameters:
hostName
- the host name of the service
-
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, Request request, Function<Boolean, Session> getOrCreateSession) Description copied from interface:LoginService
Login a user.- Specified by:
login
in interfaceLoginService
- Parameters:
username
- The username.credentials
- The users credentials.request
- The request or nullgetOrCreateSession
- function to retrieve or create a session.- 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, Request, Function)
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.
-
getIdentityService
Description copied from interface:LoginService
Get the IdentityService associated with this Login Service.- Specified by:
getIdentityService
in interfaceLoginService
- Returns:
- the IdentityService associated with this Login Service.
-
setIdentityService
Description copied from interface:LoginService
Set the IdentityService associated with this Login Service.- Specified by:
setIdentityService
in interfaceLoginService
- Parameters:
identityService
- the IdentityService associated with this Login Service.
-
logout
- Specified by:
logout
in interfaceLoginService
-