Class LoginComponent

java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.runtime.api.login.LoginComponent
All Implemented Interfaces:
LoginService, Adaptable, Component, Extensible, TimestampedService

public class LoginComponent extends DefaultComponent implements LoginService
Component holding the stack of logged in principals.
  • Field Details

    • SYSTEM_USERNAME

      public static final String SYSTEM_USERNAME
      See Also:
    • PRINCIPAL_STACK

      protected static final ThreadLocal<Deque<Principal>> PRINCIPAL_STACK
      The thread-local principal stack. The top of the stack (last element) contains the current principal.
      Since:
      11.1
  • Constructor Details

    • LoginComponent

      public LoginComponent()
  • Method Details

    • getAdapter

      public <T> T getAdapter(Class<T> adapter)
      Description copied from interface: Adaptable
      Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found.
      Specified by:
      getAdapter in interface Adaptable
      Overrides:
      getAdapter in class DefaultComponent
      Parameters:
      adapter - the adapter class to look up
      Returns:
      a object castable to the given class, or null if this object does not have an adapter for the given class
    • systemLogin

      protected NuxeoLoginContext systemLogin(String originatingUser)
    • login

      public NuxeoLoginContext login()
      Description copied from interface: LoginService
      System login, using a private principal that has all privileges. This principal is not stored in any database and cannot be accessed by user.
      Specified by:
      login in interface LoginService
      Returns:
      the login context
    • loginAs

      public NuxeoLoginContext loginAs(String username)
      Description copied from interface: LoginService
      System login, using a private principal that has all privileges. This principal is not stored in any database and cannot be accessed by user.
      Specified by:
      loginAs in interface LoginService
      Parameters:
      username - the username that originated the system login
      Returns:
      the login context
    • login

      @Deprecated public NuxeoLoginContext login(String username, Object credentials) throws LoginException
      Deprecated.
      Description copied from interface: LoginService
      Client login using the given username and password.
      Specified by:
      login in interface LoginService
      Throws:
      LoginException
    • isSystemId

      public boolean isSystemId(Principal principal)
      Specified by:
      isSystemId in interface LoginService
    • isSystemLogin

      public static boolean isSystemLogin(Object principal)
    • getPrincipalStack

      public static Deque<Principal> getPrincipalStack()
      INTERNAL.
      Since:
      11.1
    • clearPrincipalStack

      public static void clearPrincipalStack()
      INTERNAL.
      Since:
      11.1
    • pushPrincipal

      public static void pushPrincipal(Principal principal)
      Pushes the principal to the current principal stack.
      Parameters:
      principal - the principal
      Since:
      11.1
    • popPrincipal

      public static Principal popPrincipal()
      Pops the last principal from the current principal stack.
      Returns:
      the last principal, or null if the stack is empty
      Since:
      11.1
    • getCurrentPrincipal

      public static Principal getCurrentPrincipal()
      Returns the last principal from the current principal stack.
      Returns:
      the last principal, or null if the stack is empty
      Since:
      11.1