public abstract class FileLoginModule extends Object implements Loggable, LoginModule
Modifier and Type | Field and Description |
---|---|
protected CallbackHandler |
callbackHandler
JAAS call back handler used to get authentication request parameters
|
static String |
ENCRYPTED_DATA_SEP |
protected String |
groupFile
The file where to store group management
|
protected String |
loginFile
The file where to store the allowed user//password
|
protected Subject |
subject |
Constructor and Description |
---|
FileLoginModule() |
Modifier and Type | Method and Description |
---|---|
boolean |
abort() |
protected void |
checkGroupFile() |
protected void |
checkLoginFile() |
boolean |
commit() |
protected abstract String |
getGroupFileName()
Defines group file name
|
protected abstract String |
getLoginFileName()
Defines login file name
|
protected abstract PrivateKey |
getPrivateKey()
Defines private key
|
protected void |
groupMembershipFromFile(String username)
Return corresponding group for an user from the group file.
|
void |
initialize(Subject subject,
CallbackHandler callbackHandler,
Map<String,?> sharedState,
Map<String,?> options) |
boolean |
login() |
boolean |
logout() |
protected boolean |
logUser(String username,
String password,
boolean printErrorMessage)
First Check user and password from login file.
|
public static final String ENCRYPTED_DATA_SEP
protected CallbackHandler callbackHandler
protected String loginFile
protected String groupFile
protected Subject subject
protected abstract String getLoginFileName()
protected abstract String getGroupFileName()
protected abstract PrivateKey getPrivateKey() throws KeyException
KeyException
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String,?> sharedState, Map<String,?> options)
initialize
in interface LoginModule
LoginModule.initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)
protected void checkLoginFile()
protected void checkGroupFile()
public boolean login() throws LoginException
login
in interface LoginModule
LoginException
- if userName of password are not correctLoginModule.login()
protected boolean logUser(String username, String password, boolean printErrorMessage) throws LoginException
username
- user's loginpassword
- user's passwordprintErrorMessage
- if a message should be printed if the password is incorrect.LoginException
- if authentication or group membership fails.protected void groupMembershipFromFile(String username) throws LoginException
username
- user's loginLoginException
- if group file is not found or unreadable.public boolean commit() throws LoginException
commit
in interface LoginModule
LoginException
LoginModule.commit()
public boolean abort() throws LoginException
abort
in interface LoginModule
LoginException
LoginModule.abort()
public boolean logout() throws LoginException
logout
in interface LoginModule
LoginException
LoginModule.logout()