Package org.nuxeo.runtime.api.login
Class NuxeoLoginContext
- java.lang.Object
-
- javax.security.auth.login.LoginContext
-
- org.nuxeo.runtime.api.login.NuxeoLoginContext
-
- All Implemented Interfaces:
AutoCloseable
public class NuxeoLoginContext extends LoginContext implements AutoCloseable
An implementation ofLoginContext
just holding a principal.Construction is done through the static
create(java.security.Principal)
method, which takes aPrincipal
. The caller must push the principal on the Nuxeo principal stack usinglogin()
, and finally dologout()
orclose()
to remove it.This is used for compatibility with previous code that expected to receive a
LoginContext
and then calllogout()
on it.- Since:
- 11.1
-
-
Constructor Summary
Constructors Constructor Description NuxeoLoginContext()
This constructor cannot be used, use the static methodcreate(java.security.Principal)
instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static NuxeoLoginContext
create(Principal principal)
Creates aNuxeoLoginContext
for the given principal.Subject
getSubject()
void
login()
void
logout()
protected void
setPrincipal(Principal principal)
-
-
-
Constructor Detail
-
NuxeoLoginContext
public NuxeoLoginContext() throws LoginException
This constructor cannot be used, use the static methodcreate(java.security.Principal)
instead.- Throws:
LoginException
-
-
Method Detail
-
create
public static NuxeoLoginContext create(Principal principal)
Creates aNuxeoLoginContext
for the given principal.- Parameters:
principal
- the principal- Returns:
- the login context
-
setPrincipal
protected void setPrincipal(Principal principal)
-
getSubject
public Subject getSubject()
- Overrides:
getSubject
in classLoginContext
-
login
public void login()
- Overrides:
login
in classLoginContext
-
logout
public void logout()
- Overrides:
logout
in classLoginContext
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-