javax.security.auth.login
Class LoginContext
java.lang.Object
javax.security.auth.login.LoginContext
public class LoginContext
- extends Object
Method Summary |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LoginContext
public LoginContext(String name)
throws LoginException
- Throws:
LoginException
LoginContext
public LoginContext(String name,
CallbackHandler cbHandler)
throws LoginException
- Throws:
LoginException
LoginContext
public LoginContext(String name,
Subject subject)
throws LoginException
- Throws:
LoginException
LoginContext
public LoginContext(String name,
Subject subject,
CallbackHandler cbHandler)
throws LoginException
- Throws:
LoginException
LoginContext
public LoginContext(String name,
Subject subject,
CallbackHandler cbHandler,
Configuration config)
throws LoginException
- Throws:
LoginException
- Since:
- 1.5
getSubject
public Subject getSubject()
- Returns the authenticated subject, or the parameter passed to one
of the constructors.
null
is returned if the previous
login attempt failed and there was no subject provided.
- Returns:
- The subject, or null.
login
public void login()
throws LoginException
- Logs a subject in, using all login modules configured for this
application. This method will call the
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.
- Throws:
LoginException
- If logging in fails.
logout
public void logout()
throws LoginException
- Logs a subject out, cleaning up any state that may be in memory.
- Throws:
LoginException
- If logging out fails.