Class ConfigurableSpnegoLoginService
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.security.ConfigurableSpnegoLoginService
- 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 login(String, Object, ServletRequest) 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 ClassesModifier and TypeClassDescriptionprivate static classprivate classprivate static classNested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListenerNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface LifeCycle
LifeCycle.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AuthorizationServiceprivate final GSSManagerprivate Stringprivate IdentityServiceprivate Pathprivate final Stringprivate Stringprivate static final Logger -
Constructor Summary
ConstructorsConstructorDescriptionConfigurableSpnegoLoginService(String realm, AuthorizationService authorizationService) -
Method Summary
Modifier and TypeMethodDescriptionprivate PrivilegedAction<byte[]> acceptGSSContext(GSSContext gssContext, byte[] token) protected voiddoStart()Starts the managed lifecycle beans in the order they were added.Get the IdentityService associated with this Login Service.getName()Login a user.voidlogout(UserIdentity user) private PrivilegedAction<GSSContext> newSpnegoContext(Subject subject) voidsetHostName(String hostName) voidsetIdentityService(IdentityService identityService) Set the IdentityService associated with this Login Service.voidsetKeyTabPath(Path keyTabFile) voidsetServiceName(String serviceName) private StringtoUserName(GSSContext gssContext) booleanvalidate(UserIdentity user) Validate a user identity.Methods inherited from class ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStop, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansMethods inherited from class AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Dumpable.DumpableContainer
isDumpable
-
Field Details
-
LOG
-
_gssManager
-
_realm
-
_authorizationService
-
_identityService
-
_serviceName
-
_keyTabPath
-
_hostName
-
_context
-
-
Constructor Details
-
ConfigurableSpnegoLoginService
-
-
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
Description copied from class:ContainerLifeCycleStarts the managed lifecycle beans in the order they were added.- Overrides:
doStartin classContainerLifeCycle- Throws:
Exception
-
newSpnegoContext
private PrivilegedAction<ConfigurableSpnegoLoginService.SpnegoContext> newSpnegoContext(Subject subject) -
login
Description copied from interface:LoginServiceLogin a user.- Specified by:
loginin interfaceLoginService- Parameters:
username- The user namecredentials- The users credentialsreq- TODO- Returns:
- A UserIdentity if the credentials matched, otherwise null
-
newGSSContext
-
acceptGSSContext
-
toUserName
-
validate
Description copied from interface:LoginServiceValidate a user identity. Validate that a UserIdentity previously created by a call toLoginService.login(String, Object, ServletRequest)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
-