Class LoginComponent

    • Field Detail

      • 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 Detail

      • LoginComponent

        public LoginComponent()
    • Method Detail

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