Package org.nuxeo.runtime.api.login
Class LoginComponent
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.runtime.api.login.LoginComponent
- All Implemented Interfaces:
LoginService
,Adaptable
,Component
,Extensible
,TimestampedService
Component holding the stack of logged in principals.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final ThreadLocal<Deque<Principal>>
The thread-local principal stack.static final String
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
INTERNAL.<T> T
getAdapter
(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.static Principal
Returns the last principal from the current principal stack.INTERNAL.boolean
isSystemId
(Principal principal) static boolean
isSystemLogin
(Object principal) login()
System login, using a private principal that has all privileges.Deprecated.System login, using a private principal that has all privileges.static Principal
Pops the last principal from the current principal stack.static void
pushPrincipal
(Principal principal) Pushes the principal to the current principal stack.protected NuxeoLoginContext
systemLogin
(String originatingUser) Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterContribution, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
SYSTEM_USERNAME
- See Also:
-
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
Description copied from interface:Adaptable
Returns an object which is an instance of the given class associated with this object. Returnsnull
if no such object can be found.- Specified by:
getAdapter
in interfaceAdaptable
- Overrides:
getAdapter
in classDefaultComponent
- 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
-
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 interfaceLoginService
- Returns:
- the login context
-
loginAs
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 interfaceLoginService
- 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 interfaceLoginService
- Throws:
LoginException
-
isSystemId
- Specified by:
isSystemId
in interfaceLoginService
-
isSystemLogin
-
getPrincipalStack
INTERNAL.- Since:
- 11.1
-
clearPrincipalStack
public static void clearPrincipalStack()INTERNAL.- Since:
- 11.1
-
pushPrincipal
Pushes the principal to the current principal stack.- Parameters:
principal
- the principal- Since:
- 11.1
-
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
Returns the last principal from the current principal stack.- Returns:
- the last principal, or
null
if the stack is empty - Since:
- 11.1
-