javax.security.auth.login

Class LoginContext

public class LoginContext extends Object

Constructor Summary
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)
Method Summary
SubjectgetSubject()
Returns the authenticated subject, or the parameter passed to one of the constructors.
voidlogin()
Logs a subject in, using all login modules configured for this application.
voidlogout()
Logs a subject out, cleaning up any state that may be in memory.

Constructor Detail

LoginContext

public LoginContext(String name)

LoginContext

public LoginContext(String name, CallbackHandler cbHandler)

LoginContext

public LoginContext(String name, Subject subject)

LoginContext

public LoginContext(String name, Subject subject, CallbackHandler cbHandler)

LoginContext

public LoginContext(String name, Subject subject, CallbackHandler cbHandler, Configuration config)

Since: 1.5

Method Detail

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()
Logs a subject in, using all login modules configured for this application. This method will call the 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()
Logs a subject out, cleaning up any state that may be in memory.

Throws: LoginException If logging out fails.