Class ConfigurableSpnegoLoginService

All Implemented Interfaces:
LoginService, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle

public class ConfigurableSpnegoLoginService extends 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/, 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.

  • Constructor Details

    • ConfigurableSpnegoLoginService

      public ConfigurableSpnegoLoginService(String realm, AuthorizationService authorizationService)
  • Method Details

    • getName

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

      public Path getKeyTabPath()
      the path of the keyTab file containing service credentials
    • setKeyTabPath

      public void setKeyTabPath(Path keyTabFile)
      keyTabFile - the path of the keyTab file containing service credentials
    • getServiceName

      public String getServiceName()
      the service name, typically "HTTP"
      See Also:
    • setServiceName

      public void setServiceName(String serviceName)
      serviceName - the service name
      See Also:
    • getHostName

      public String getHostName()
      the host name of the service
      See Also:
    • setHostName

      public void setHostName(String hostName)
      hostName - the host name of the service
    • doStart

      protected void doStart() throws Exception
      Description copied from class: ContainerLifeCycle
      Starts the managed lifecycle beans in the order they were added.
      doStart in class ContainerLifeCycle
      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 req)
      Description copied from interface: LoginService
      Login a user.
      Specified by:
      login in interface LoginService
      username - The user name
      credentials - The users credentials
      req - TODO
      A UserIdentity if the credentials matched, otherwise null
    • validate

      public boolean validate(UserIdentity user)
      Description copied from interface: LoginService
      Validate a user identity. Validate that a UserIdentity previously created by a call to LoginService.login(String, Object, ServletRequest) is still valid.
      Specified by:
      validate in interface LoginService
      user - The user to validate
      true if authentication has not been revoked for the user.
    • getIdentityService

      public IdentityService getIdentityService()
      Description copied from interface: LoginService
      Get the IdentityService associated with this Login Service.
      Specified by:
      getIdentityService in interface LoginService
      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
      identityService - the IdentityService associated with this Login Service.
    • logout

      public void logout(UserIdentity user)
      Specified by:
      logout in interface LoginService