Class ConfigurableSpnegoLoginService

  • 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 ConfigurableSpnegoLoginService
    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 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 classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container

        org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable

        org.eclipse.jetty.util.component.Dumpable.DumpableContainer
      • Nested 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, RUNNING, STARTED, STARTING, STOPPED, STOPPING
      • Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

        KEY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doStart()  
      java.lang.String getHostName()  
      IdentityService getIdentityService()
      Get the IdentityService associated with this Login Service.
      java.nio.file.Path getKeyTabPath()  
      java.lang.String getName()  
      java.lang.String getServiceName()  
      UserIdentity login​(java.lang.String username, java.lang.Object credentials, javax.servlet.ServletRequest req)
      Login a user.
      void logout​(UserIdentity user)  
      void setHostName​(java.lang.String hostName)  
      void setIdentityService​(IdentityService identityService)
      Set the IdentityService associated with this Login Service.
      void setKeyTabPath​(java.nio.file.Path keyTabFile)  
      void setServiceName​(java.lang.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, 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, updateBeans
      • Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, 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.Dumpable

        dumpSelf
      • Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer

        isDumpable
    • Constructor Detail

      • ConfigurableSpnegoLoginService

        public ConfigurableSpnegoLoginService​(java.lang.String realm,
                                              AuthorizationService authorizationService)
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface LoginService
        Returns:
        the realm name
      • getKeyTabPath

        public java.nio.file.Path getKeyTabPath()
        Returns:
        the path of the keyTab file containing service credentials
      • setKeyTabPath

        public void setKeyTabPath​(java.nio.file.Path keyTabFile)
        Parameters:
        keyTabFile - the path of the keyTab file containing service credentials
      • getServiceName

        public java.lang.String getServiceName()
        Returns:
        the service name, typically "HTTP"
        See Also:
        getHostName()
      • setServiceName

        public void setServiceName​(java.lang.String serviceName)
        Parameters:
        serviceName - the service name
        See Also:
        setHostName(String)
      • getHostName

        public java.lang.String getHostName()
        Returns:
        the host name of the service
        See Also:
        setServiceName(String)
      • setHostName

        public void setHostName​(java.lang.String hostName)
        Parameters:
        hostName - the host name of the service
      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Overrides:
        doStart in class org.eclipse.jetty.util.component.ContainerLifeCycle
        Throws:
        java.lang.Exception
      • login

        public UserIdentity login​(java.lang.String username,
                                  java.lang.Object credentials,
                                  javax.servlet.ServletRequest req)
        Description copied from interface: LoginService
        Login a user.
        Specified by:
        login in interface LoginService
        Parameters:
        username - The user name
        credentials - The users credentials
        req - TODO
        Returns:
        A UserIdentity if the credentials matched, otherwise null
      • getIdentityService

        public IdentityService getIdentityService()
        Description copied from interface: LoginService
        Get the IdentityService associated with this Login Service.
        Specified by:
        getIdentityService in interface LoginService
        Returns:
        the IdentityService associated with this Login Service.
      • setIdentityService

        public void setIdentityService​(IdentityService identityService)
        Description copied from interface: LoginService
        Set the IdentityService associated with this Login Service.
        Specified by:
        setIdentityService in interface LoginService
        Parameters:
        identityService - the IdentityService associated with this Login Service.