public class LoginContext extends Object
| Constructor and Description |
|---|
LoginContext(String name) |
LoginContext(String name,
CallbackHandler cbHandler) |
LoginContext(String name,
Subject subject) |
LoginContext(String name,
Subject subject,
CallbackHandler cbHandler) |
LoginContext(String name,
Subject subject,
CallbackHandler cbHandler,
Configuration config) |
| Modifier and Type | Method and Description |
|---|---|
Subject |
getSubject()
Returns the authenticated subject, or the parameter passed to one
of the constructors.
|
void |
login()
Logs a subject in, using all login modules configured for this
application.
|
void |
logout()
Logs a subject out, cleaning up any state that may be in memory.
|
public LoginContext(String name) throws LoginException
LoginExceptionpublic LoginContext(String name, CallbackHandler cbHandler) throws LoginException
LoginExceptionpublic LoginContext(String name, Subject subject) throws LoginException
LoginExceptionpublic LoginContext(String name, Subject subject, CallbackHandler cbHandler) throws LoginException
LoginExceptionpublic LoginContext(String name, Subject subject, CallbackHandler cbHandler, Configuration config) throws LoginException
LoginExceptionpublic Subject getSubject()
null is returned if the previous
login attempt failed and there was no subject provided.public void login() throws LoginException
LoginModule.login()
method of each module configured for this application, stopping
if a REQUISITE module fails or if a SUFFICIENT module succeeds. If
the overall login attempt fails, a LoginException will be
thrown.LoginException - If logging in fails.public void logout() throws LoginException
LoginException - If logging out fails.