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 |
protected String |
tenantFile
The file where to store tenant management
|
Constructor and Description |
---|
FileLoginModule() |
Modifier and Type | Method and Description |
---|---|
boolean |
abort() |
protected void |
checkGroupFile() |
protected void |
checkLoginFile() |
protected void |
checkTenantFile() |
boolean |
commit() |
protected abstract Set<String> |
getConfiguredDomains() |
protected abstract String |
getGroupFileName()
Defines group file name
|
protected abstract String |
getLoginFileName()
Defines login file name
|
protected abstract PrivateKey |
getPrivateKey()
Defines private key
|
protected abstract String |
getTenantFileName()
Defines tenant file name
|
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) |
protected abstract boolean |
isLegacyPasswordEncryption()
Returns true if legacy password encryption is used (hybrid symetric key).
|
boolean |
login() |
boolean |
logout() |
protected boolean |
logUser(String username,
String password,
String domain,
boolean isNotFallbackAuthentication)
First Check user and password from login file.
|
protected void |
removeOldFailedAttempts(String username) |
protected void |
resetFailedAttempt(String username) |
protected int |
retryInHowManyMinutes(String username) |
protected void |
storeFailedAttempt(String username) |
protected void |
tenantMembershipFromFile(String username)
Return corresponding tenant for a user from the tenant file.
|
protected boolean |
tooManyFailedAttempts(String username) |
public static final String ENCRYPTED_DATA_SEP
protected CallbackHandler callbackHandler
protected String loginFile
protected String groupFile
protected String tenantFile
protected Subject subject
protected abstract String getLoginFileName()
protected abstract String getGroupFileName()
protected abstract String getTenantFileName()
protected abstract PrivateKey getPrivateKey() throws KeyException
KeyException
protected abstract boolean isLegacyPasswordEncryption()
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()
protected void checkTenantFile()
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, String domain, boolean isNotFallbackAuthentication) throws LoginException
username
- user's loginpassword
- user's passwordisNotFallbackAuthentication
- true if this method is not called inside a fallback mechanismLoginException
- if authentication or group membership fails.protected void storeFailedAttempt(String username)
protected void resetFailedAttempt(String username)
protected void removeOldFailedAttempts(String username)
protected boolean tooManyFailedAttempts(String username)
protected int retryInHowManyMinutes(String username)
protected void groupMembershipFromFile(String username) throws LoginException
username
- user's loginLoginException
- if group file is not found or unreadable.protected void tenantMembershipFromFile(String username) throws LoginException
username
- user's loginLoginException
- if tenant 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()