public final class AuthContext extends Object
LoginContext
provided by
JAAS by supporting organization environments that cannot handle sessions, for
example, HTTP/HTML.
A typical caller instantiates this class and starts the login process. The
caller then obtains an array of Callback
objects, which
contains the information required by the authentication plug-in module. The
caller requests information from the user. On receiving the information from
the user, the caller submits the same to this class. If more information is
required, the above process continues until all the information required by
the plug-ins has been supplied. The caller then checks if the user has
successfully been authenticated. If successfully authenticated, the caller
can then get the
Subject
for the user; if not successfully
authenticated, the caller obtains the LoginException.
Modifier and Type | Field and Description |
---|---|
static int |
AUTH_COMPLETED
This login status indicates that the user has been
successfully logged out.
|
static int |
AUTH_FAILED
This login status indicates that the login process
has failed.
|
static int |
AUTH_IN_PROGRESS
This login status indicates that the login process
is in progress.
|
static int |
AUTH_NOT_STARTED
This login status indicates that the login process
has not started yet.
|
static int |
AUTH_SUCCESS
This login status indicates that the login process
has succeeded.
|
Constructor and Description |
---|
AuthContext()
Constructor to get an instance of
AuthContext . |
AuthContext(Principal principal,
char[] password)
Constructor to get an authenticated instance
of this class given the
java.security.Principal the user
would like to be authenticated as, and the password for
the user. |
AuthContext(String orgName)
Constructor to get an instance of this class
given the organization name
orgName . |
AuthContext(String orgName,
Principal principal,
char[] password)
Constructor to get an instance of this class
given the organization name
orgName the user would like to
access, the java.security.Principal
the user would like to
be authenticated as, and the password for the user. |
Modifier and Type | Method and Description |
---|---|
LoginException |
getLoginException()
Returns login exception, if any, during the
authentication process.
|
int |
getLoginStatus()
Returns the current state of the login process.
|
String |
getOrganizationName()
Method to get organization name that was set during
construction of this instance.
|
Principal |
getPrincipal()
Returns the (first)
AuthPrincipal in
the Subject . |
Callback[] |
getRequirements()
Returns an array of
Callback objects
that must be populated by the user and returned back. |
SSOToken |
getSSOToken()
Method to get the Single-Sign-On (SSO) Token.
|
boolean |
hasMoreRequirements()
Returns true if the login process requires more
information from the user to complete the authentication.
|
void |
logout()
Logs the user out.
|
void |
startLogin()
Method to start the login process.
|
void |
submitRequiredInformation(Callback[] info)
Submits the populated
Callback
objects to the authentication plug-in modules. |
public static final int AUTH_NOT_STARTED
startLogin
has not been called.public static final int AUTH_IN_PROGRESS
startLogin
method has been called and that this object is waiting for the user to
send authentication information.public static final int AUTH_SUCCESS
public static final int AUTH_FAILED
public static final int AUTH_COMPLETED
public AuthContext()
AuthContext
. Caller would then use
getRequirements()
and submitRequirements()
to pass the credentials needed for authentication by the plugin modules.LoginException
public AuthContext(Principal principal, char[] password)
java.security.Principal
the user
would like to be authenticated as, and the password
for
the user.principal
- name of the user to be authenticatedpassword
- password for the userLoginException
public AuthContext(String orgName, Principal principal, char[] password)
orgName
the user would like to
access, the java.security.Principal
the user would like to
be authenticated as, and the password
for the user.orgName
- name of the user's organizationprincipal
- name of the user to be authenticatedpassword
- password for the userLoginException
public AuthContext(String orgName)
orgName
. The plug-in modules
would then query for the user name and related information.orgName
- organization name.LoginException
public void startLogin()
LoginException
public boolean hasMoreRequirements()
public Callback[] getRequirements()
Callback
objects
that must be populated by the user and returned back. These objects are
requested by the authentication plug-ins, and these are usually displayed
to the user. The user then provides the requested information for it to
be authenticated.Callback
objects that must be
populated by the user and returned back.public void submitRequiredInformation(Callback[] info)
Callback
objects to the authentication plug-in modules. Called after
getInformationRequired
method and obtaining user's
response to these requests.info
- array of Callback
objects.public void logout()
LoginException
public LoginException getLoginException()
public int getLoginStatus()
public Principal getPrincipal()
AuthPrincipal
in
the Subject
. Returns the first Principal
,
if more than one exists.AuthPrincipal
in the
Subject
.public String getOrganizationName()
null
if it was not initialized
during construction of this instancepublic SSOToken getSSOToken()
InvalidAuthContextException
Copyright © 2010-2013, ForgeRock All Rights Reserved.