Package com.storedobject.core
Interface Authenticator
- All Known Subinterfaces:
FallbackAuthenticator
public interface Authenticator
Interface for defining an external authenticator. If an external authenticator is configured for a particular
"password owner", that authenticator will be used for authenticating that type of "password owners". For example,
to log in to the application, the "password owner" is
SystemUser
and if an external authenticator is
configured for SystemUser
class that will be used instead of the built-in one.- Author:
- Syam
-
Method Summary
Modifier and TypeMethodDescriptionboolean
changePassword
(StoredObject passwordOwner, char[] currentPassword, char[] newPassword) Change the current password to a new one.default void
locked
(SystemUser passwordOwner) This method is invoked when a user is locked because of invalid login attempts.boolean
login
(StoredObject passwordOwner, char[] password) Authenticate the given password owner.default boolean
login
(StoredObject passwordOwner, char[] password, int authenticatorCode) Authenticate the given password owner.default void
loginFailed
(SystemUser passwordOwner, String user, String ip, String deviceIdentifier) This method is invoked when a user fails to log in.boolean
resetPassword
(StoredObject passwordOwner) Reset the password to the initial default password.default void
unlocked
(SystemUser passwordOwner) This method is invoked when a locked user is unlocked.
-
Method Details
-
login
Authenticate the given password owner.- Parameters:
passwordOwner
- The password owner.password
- Password.- Returns:
- True if authenticated successfully.
- Throws:
Exception
- If any exception occurred. For example, the login is currently blocked.
-
login
default boolean login(StoredObject passwordOwner, char[] password, int authenticatorCode) throws Exception Authenticate the given password owner.- Parameters:
passwordOwner
- The password owner.password
- Password.authenticatorCode
- Extra authenticator code required - maybe, from a second device. The default implementation ignores this and invokes thelogin(StoredObject, char[])
method.- Returns:
- True if authenticated successfully.
- Throws:
Exception
- If any exception occurred. For example, the login is currently blocked.
-
changePassword
boolean changePassword(StoredObject passwordOwner, char[] currentPassword, char[] newPassword) throws Exception Change the current password to a new one.- Parameters:
passwordOwner
- The password owner.currentPassword
- Current password.newPassword
- New password- Returns:
- True if changed successfully.
- Throws:
Exception
- If any exception occurred.
-
resetPassword
Reset the password to the initial default password.- Parameters:
passwordOwner
- The password owner.- Returns:
- True if password reset is successful.
- Throws:
Exception
- If any exception occurred.
-
locked
This method is invoked when a user is locked because of invalid login attempts. So, this will be invoked only forSystemUser
s.- Parameters:
passwordOwner
- The password owner.
-
unlocked
This method is invoked when a locked user is unlocked. So, this will be invoked only forSystemUser
s.- Parameters:
passwordOwner
- The password owner.
-
loginFailed
This method is invoked when a user fails to log in. So, this will be invoked only forSystemUser
s.- Parameters:
passwordOwner
- The password owner. This could benull
if no "Password Owner" exists for the login name attempted.user
- Login/user-name tried.ip
- IP address from which the login was attempted.deviceIdentifier
- Device identifier.
-