Class LoginContext
- java.lang.Object
-
- com.sun.identity.authentication.jaas.LoginContext
-
- All Implemented Interfaces:
LoginContext
public class LoginContext extends Object implements LoginContext
This class is pulled out from JDK1.4. RemoveddoPrivileged()
oninvoke()
method so that Error and Runtime exceptions can be passed back to the caller. Otherwise any exception is converted toLoginException
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LoginContext.ModuleInfo
LoginModule information - encapsulates Configuration info and actual module instances.
-
Constructor Summary
Constructors Constructor Description LoginContext(AppConfigurationEntry[] entries, CallbackHandler callbackHandler)
LoginContext(AppConfigurationEntry[] entries, Subject subject, CallbackHandler callbackHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getModuleInstanceNames()
Returns module instance names listLoginContext.ModuleInfo[]
getModuleStack()
LinkedList<LoginContext.ModuleInfo>
getModuleStackQueue()
LoginException
getOptionalException()
LoginException
getRequiredException()
Subject
getSubject()
Return the authenticated Subject.void
login()
Perform the authentication.void
logout()
Logout theSubject
.void
resetAuthChainToModule(int moduleIndex)
Resets auth chain to particular module, auth chain starts with this modulevoid
setModuleStackQueue(LinkedList<LoginContext.ModuleInfo> moduleStackQueue)
void
setNextModule(int moduleIndex)
Sets next module by module index in chain, allows to modify auth chain during authvoid
setNextModule(String moduleName)
Sets next module by module name, allows to modify auth chain during auth
-
-
-
Constructor Detail
-
LoginContext
public LoginContext(AppConfigurationEntry[] entries, CallbackHandler callbackHandler) throws LoginException
- Throws:
LoginException
-
LoginContext
public LoginContext(AppConfigurationEntry[] entries, Subject subject, CallbackHandler callbackHandler) throws LoginException
- Throws:
LoginException
-
-
Method Detail
-
login
public void login() throws LoginException
Description copied from interface:LoginContext
Perform the authentication.- Specified by:
login
in interfaceLoginContext
- Throws:
LoginException
- if the authentication fails.
-
logout
public void logout() throws LoginException
Description copied from interface:LoginContext
Logout theSubject
.- Specified by:
logout
in interfaceLoginContext
- Throws:
LoginException
- if the logout fails.
-
getModuleStack
public LoginContext.ModuleInfo[] getModuleStack()
-
getSubject
public Subject getSubject()
Description copied from interface:LoginContext
Return the authenticated Subject.- Specified by:
getSubject
in interfaceLoginContext
- Returns:
- the authenticated subject.
-
setNextModule
public void setNextModule(String moduleName)
Sets next module by module name, allows to modify auth chain during auth- Parameters:
moduleName
-
-
setNextModule
public void setNextModule(int moduleIndex)
Sets next module by module index in chain, allows to modify auth chain during auth- Parameters:
moduleName
-
-
getModuleInstanceNames
public List<String> getModuleInstanceNames()
Returns module instance names list- Returns:
- module instance names list
-
resetAuthChainToModule
public void resetAuthChainToModule(int moduleIndex) throws ResetAuthChainException
Resets auth chain to particular module, auth chain starts with this module- Parameters:
moduleIndex
- index of module- Throws:
ResetAuthChainException
-
getRequiredException
public LoginException getRequiredException()
-
getOptionalException
public LoginException getOptionalException()
-
getModuleStackQueue
public LinkedList<LoginContext.ModuleInfo> getModuleStackQueue()
-
setModuleStackQueue
public void setModuleStackQueue(LinkedList<LoginContext.ModuleInfo> moduleStackQueue)
-
-