java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.security.SPNEGOLoginService
- 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
public class SPNEGOLoginService
extends org.eclipse.jetty.util.component.ContainerLifeCycle
implements LoginService
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
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
Fields 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()Get the IdentityService associated with this Login Service.getName()login(String username, Object credentials, org.eclipse.jetty.server.Request request, Function<Boolean, org.eclipse.jetty.server.Session> getOrCreateSession) Login a user.voidlogout(UserIdentity user) voidsetHostName(String hostName) voidsetIdentityService(IdentityService identityService) Set the IdentityService associated with this Login Service.voidsetKeyTabPath(Path keyTabFile) voidsetServiceName(String serviceName) booleanvalidate(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, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop, toStringMethods 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
isDumpableMethods inherited from interface org.eclipse.jetty.security.LoginService
getUserIdentity
-
Constructor Details
-
SPNEGOLoginService
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceLoginService- Returns:
- the realm name
-
getKeyTabPath
- Returns:
- the path of the keyTab file containing service credentials
-
setKeyTabPath
- 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
- Parameters:
hostName- the host name of the service
-
doStart
- Overrides:
doStartin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
login
public UserIdentity login(String username, Object credentials, org.eclipse.jetty.server.Request request, Function<Boolean, org.eclipse.jetty.server.Session> getOrCreateSession) Description copied from interface:LoginServiceLogin a user.- Specified by:
loginin 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:LoginServiceValidate a user identity. Validate that a UserIdentity previously created by a call toLoginService.login(String, Object, Request, Function)is still valid.- Specified by:
validatein interfaceLoginService- Parameters:
user- The user to validate- Returns:
- true if authentication has not been revoked for the user.
-
getIdentityService
Description copied from interface:LoginServiceGet the IdentityService associated with this Login Service.- Specified by:
getIdentityServicein interfaceLoginService- Returns:
- the IdentityService associated with this Login Service.
-
setIdentityService
Description copied from interface:LoginServiceSet the IdentityService associated with this Login Service.- Specified by:
setIdentityServicein interfaceLoginService- Parameters:
identityService- the IdentityService associated with this Login Service.
-
logout
- Specified by:
logoutin interfaceLoginService
-