Class OpenIdLoginService

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.security.openid.OpenIdLoginService
All Implemented Interfaces:
org.eclipse.jetty.security.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 OpenIdLoginService extends org.eclipse.jetty.util.component.ContainerLifeCycle implements org.eclipse.jetty.security.LoginService
The implementation of LoginService required to use OpenID Connect.

Can contain an optional wrapped LoginService which is used to store role information about users.

  • 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.StopException

    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, STARTED, STARTING, STOPPED, STOPPING

    Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

    KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    OpenIdLoginService(OpenIdConfiguration configuration, org.eclipse.jetty.security.LoginService loginService)
    Use a wrapped LoginService to store information about user roles.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    org.eclipse.jetty.security.IdentityService
     
     
    boolean
     
    org.eclipse.jetty.security.UserIdentity
    login(String identifier, Object credentials, org.eclipse.jetty.server.Request request, Function<Boolean,org.eclipse.jetty.server.Session> getOrCreateSession)
     
    void
    logout(org.eclipse.jetty.security.UserIdentity user)
     
    void
    setAuthenticateNewUsers(boolean authenticateNewUsers)
    This setting is only meaningful if a wrapped LoginService has been set.
    void
    setIdentityService(org.eclipse.jetty.security.IdentityService service)
     
    boolean
    validate(org.eclipse.jetty.security.UserIdentity user)
     

    Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

    addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, 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, 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

    dumpSelf

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

    isDumpable

    Methods inherited from interface org.eclipse.jetty.security.LoginService

    getUserIdentity
  • Constructor Details

    • OpenIdLoginService

      public OpenIdLoginService(OpenIdConfiguration configuration)
    • OpenIdLoginService

      public OpenIdLoginService(OpenIdConfiguration configuration, org.eclipse.jetty.security.LoginService loginService)
      Use a wrapped LoginService to store information about user roles. Users in the wrapped loginService must be stored with their username as the value of the sub (subject) Claim, and a credentials value of the empty string.
      Parameters:
      configuration - the OpenID configuration to use.
      loginService - the wrapped LoginService to defer to for user roles.
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface org.eclipse.jetty.security.LoginService
    • getConfiguration

      public OpenIdConfiguration getConfiguration()
    • login

      public org.eclipse.jetty.security.UserIdentity login(String identifier, Object credentials, org.eclipse.jetty.server.Request request, Function<Boolean,org.eclipse.jetty.server.Session> getOrCreateSession)
      Specified by:
      login in interface org.eclipse.jetty.security.LoginService
    • isAuthenticateNewUsers

      public boolean isAuthenticateNewUsers()
    • setAuthenticateNewUsers

      public void setAuthenticateNewUsers(boolean authenticateNewUsers)
      This setting is only meaningful if a wrapped LoginService has been set.

      If set to true, any users not found by the wrapped LoginService will still be authenticated but with no roles, if set to false users will not be authenticated unless they are discovered by the wrapped LoginService.

      Parameters:
      authenticateNewUsers - whether to authenticate users not found by a wrapping LoginService
    • validate

      public boolean validate(org.eclipse.jetty.security.UserIdentity user)
      Specified by:
      validate in interface org.eclipse.jetty.security.LoginService
    • getIdentityService

      public org.eclipse.jetty.security.IdentityService getIdentityService()
      Specified by:
      getIdentityService in interface org.eclipse.jetty.security.LoginService
    • setIdentityService

      public void setIdentityService(org.eclipse.jetty.security.IdentityService service)
      Specified by:
      setIdentityService in interface org.eclipse.jetty.security.LoginService
    • logout

      public void logout(org.eclipse.jetty.security.UserIdentity user)
      Specified by:
      logout in interface org.eclipse.jetty.security.LoginService