Class AMLoginContext
- java.lang.Object
-
- com.sun.identity.authentication.service.AMLoginContext
-
public class AMLoginContext extends Object
AMLoginContextclass is the core layer in the authentication middle tier which connects user clients to the JAASLoginModule. TheAMLoginContextexecutes pre and post authentication process based on authentication status.AMLoginContextprovides a synchronous layer on top of the JAAS framework for appropriate user interaction and communication between clients and authentication module via callbacks requirementsAMLoginContextsets and retrieves the authentication configuration entryThis class actually starts the JAAS login process by instantiating the
LoginContextobject with the JAAS configuration name and theCallbackHandlerfollowed by calling theLoginContext::login()method.
-
-
Field Summary
Fields Modifier and Type Field Description static AuthThreadManagerauthThreadAuthThreadManager associated with this AMLoginContext.
-
Constructor Summary
Constructors Constructor Description AMLoginContext(AuthContextLocal authContext)CreatesAMLoginContextobject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()Terminates an ongoing login process.voidexecuteLogin(Subject subject, AuthContext.IndexType loginIndexType, String loginIndexName, String locale, String redirectUrl)Starts login process, the map passed to this method is the parameters required to start the login process.StringgetAuthIdentifier()Returns the currentauthIdentifierof the authentication process as String Session ID.StringgetErrorCode()Returns error code.StringgetErrorMessage()Returns error message.StringgetErrorTemplate()Returns error template.StringgetFailureURL()Returns Login Failure URL for authenticated user.StringgetLockoutMsg()Gets the account lockout messageLoginContextgetLoginContext()Returns current login contextLoginStategetLoginState()Returns login state for the authentication context.Set<String>getModuleInstanceNames()Returns authentication modules configured for a given organization.StringgetOrganizationName()Returns organization/suborganization for a request.Callback[]getRequiredInfo()Returns array of received callbacks from module.SSOTokengetSSOToken()Returns Single Sign On Token for authenticated user, returns null if session is inactive.intgetStatus()Returns the authentication status.SubjectgetSubject()Returns the subject of authenticated user.StringgetSuccessURL()Returns Login Success URL for authenticated user.booleanisLockedOut()Checks if the account is lockedbooleanisPureJAAS()Checks if is pure JAAS modevoidlogout()Logs out.static voidresetJAASConfig()Sets the JAAS configuration to the default container's configuration.voidrunLogin()Starts the login process ,calls JAAS Login ContextCallback[]submitCallbackInfo()CallbackHandlercalls this to retrieve the submitted credentials/callbacks waits tillauthContext.getLoginState().setSubmittedCallbackis set ORLoginStatusis notAUTH_IN_PROGRESS.voidsubmitRequiredInfo(Callback[] callback)Sets the submitted requirements, called byAuthContext.submitRequirementsauthContext.getLoginState().setSubmittedCallbackis update.
-
-
-
Field Detail
-
authThread
public static AuthThreadManager authThread
AuthThreadManager associated with this AMLoginContext.
-
-
Constructor Detail
-
AMLoginContext
public AMLoginContext(AuthContextLocal authContext)
CreatesAMLoginContextobject.- Parameters:
authContext-AuthContextLocalobject. Must not be null;
-
-
Method Detail
-
resetJAASConfig
public static void resetJAASConfig()
Sets the JAAS configuration to the default container's configuration.
-
executeLogin
public void executeLogin(Subject subject, AuthContext.IndexType loginIndexType, String loginIndexName, String locale, String redirectUrl) throws AuthLoginException
Starts login process, the map passed to this method is the parameters required to start the login process. These parameters areindexType,indexName,principal,subject,password,organization name. Based on these parameters Module Configuration name is retrieved using Configuration component. Creates a new LoginContext and starts login process and returns. On error LoginException is thrown.- Throws:
AuthLoginException- if execute login fails
-
runLogin
public void runLogin()
Starts the login process ,calls JAAS Login Context
-
logout
public void logout() throws AuthLoginExceptionLogs out.- Throws:
AuthLoginException- when fails to logout
-
getRequiredInfo
public Callback[] getRequiredInfo()
Returns array of received callbacks from module.- Returns:
- array of received callbacks from module.
-
submitRequiredInfo
public void submitRequiredInfo(Callback[] callback)
Sets the submitted requirements, called byAuthContext.submitRequirementsauthContext.getLoginState().setSubmittedCallbackis update.- Parameters:
callback- submit the requiredCallbacks
-
submitCallbackInfo
public Callback[] submitCallbackInfo()
CallbackHandlercalls this to retrieve the submitted credentials/callbacks waits tillauthContext.getLoginState().setSubmittedCallbackis set ORLoginStatusis notAUTH_IN_PROGRESS.- Returns:
- submitted credentials/callbacks.
-
getStatus
public int getStatus()
Returns the authentication status.- Returns:
- the authentication status.
-
getLoginState
public LoginState getLoginState()
Returns login state for the authentication context.- Returns:
- login state for the authentication context.
-
abort
public void abort() throws AuthLoginExceptionTerminates an ongoing login process.- Throws:
AuthLoginException- when fails to abort
-
getModuleInstanceNames
public Set<String> getModuleInstanceNames()
Returns authentication modules configured for a given organization.- Returns:
- authentication modules configured for a given organization.
-
getOrganizationName
public String getOrganizationName()
Returns organization/suborganization for a request.- Returns:
- organization/suborganization for a request.
-
getSSOToken
public SSOToken getSSOToken()
Returns Single Sign On Token for authenticated user, returns null if session is inactive.- Returns:
- Single Sign On Token for authenticated user.
-
getSuccessURL
public String getSuccessURL()
Returns Login Success URL for authenticated user.- Returns:
- Login Success URL for authenticated user.
-
getFailureURL
public String getFailureURL()
Returns Login Failure URL for authenticated user.- Returns:
- Login Failure URL for authenticated user.
-
getAuthIdentifier
public String getAuthIdentifier()
Returns the currentauthIdentifierof the authentication process as String Session ID.- Returns:
authIdentifierof the authentication process.
-
getSubject
public Subject getSubject()
Returns the subject of authenticated user.- Returns:
- the subject of authenticated user.
-
getLoginContext
public LoginContext getLoginContext()
Returns current login context- Returns:
- login context
-
getErrorTemplate
public String getErrorTemplate()
Returns error template.- Returns:
- error template.
-
getErrorMessage
public String getErrorMessage()
Returns error message.- Returns:
- error message.
-
getErrorCode
public String getErrorCode()
Returns error code.- Returns:
- Authentication error code.
-
getLockoutMsg
public String getLockoutMsg()
Gets the account lockout message- Returns:
- account lockout message
-
isLockedOut
public boolean isLockedOut()
Checks if the account is locked- Returns:
trueif account is locked
-
isPureJAAS
public boolean isPureJAAS()
Checks if is pure JAAS mode- Returns:
trueif pure JAAS
-
-