Class FailedSignInRecorder
UserAuthenticationUIImpl) for a refusal that named an existing user - at the password, at the second factor, at a passkey, at a recovery code, by a policy or by the license.Nothing of this is in the sign-in's path. onFailure(IClientSessionGyro, UserInfoBase, FailedSignInStep, boolean, boolean, String) starts a virtual thread and returns; the thread resolves the client address and its place (ClientPlace), writes one row of IZS.FAILED_SIGNINS (FailedSignInStore), writes the WARNING line of an attempt that got past the password or hit a sensitive account, and hands the attempt to the FailedSignInNotifier, which decides about the mail. A failure anywhere is logged at most once a minute and ends there. The answer to the failing client is what it was: nothing says that a mail went, or that the password was right.
What is "almost signed in" and "sensitive". The caller says: afterPassword when the password was accepted before the step failed, sensitive for a member of the Administrators group (ServerAdmin's users are its members) and for a user a strong sign-in policy binds. Either makes the attempt urgent: a WARNING in the server log and a mail every time, no throttle (within the hourly cap).
The two settings of the account are user details (IBasicUserInfoDetailNames.DETAIL_FailedSignInMail, IBasicUserInfoDetailNames.DETAIL_FailedSignInClear); the mail's default is on for a sensitive account and off otherwise (isMailWanted(UserInfoBase, boolean)), the clearing at a sign-in is off by default.
- Author:
- Christopher Mindus
Field Summary
FieldsConstructor Summary
ConstructorsConstructorDescriptionFailedSignInRecorder(FailedSignInStore store, Executor executor, FailedSignInNotifier notifier) Constructs a recorder on a store, an executor and a notifier: the tests' constructor.Method Summary
Modifier and TypeMethodDescriptionintclear(long uid) Clears the attempts of a user: the user's or an administrator's "Clear".static FailedSignInRecorderGets the server's recorder.getStore()Gets the store.infos(long uid) Lists the attempts of a user as the SignIn module gets them.static booleanisAutoClear(UserInfoBase user) Checks if a user has the list cleared at every successful sign-in: the detailIZS-FailedSignInClearison.static booleanisMailWanted(UserInfoBase user, boolean sensitive) Checks if a user is mailed about the throttled failed sign-ins: the detailIZS-FailedSignInMailwhen set (on/off), else the default - on for a sensitive account, off otherwise.list(long uid) Lists the attempts of a user, the most recent first, for the account page and ServerAdmin.voidonFailure(IClientSessionGyro clientGyro, UserInfoBase user, FailedSignInStep step, boolean afterPassword, boolean sensitive, String reason) Called when a sign-in to a known account was refused: starts the capture and returns.voidonLockStarted(FailedSignInMails.LockPath path, UserAuthenticationInfo info, IClientSessionGyro clientGyro, InetAddress address) Called when a wrong password started a lock of an account on a path that keeps no failed sign-in for it (LockEvents.startWithoutAttempt(FailedSignInMails.LockPath, UserAuthenticationInfo, IClientSessionGyro)): starts the telling and returns.voidCalled at every clean-up round of the server: starts the notifier's thread once the server is started and its database is ready, so that a batch or a summary held when the server stopped goes out (FailedSignInNotifier.runDue()).voidonSignedIn(UserInfoBase user) Called when a user has signed in: clears the list when the user chose so.intpurge(int days) Deletes the attempts older than the days kept: the daily purge, with the sign-in records.static voidsetAutoClear(Connection conn, BasicUserInfo user, boolean on) Writes the clearing setting of a user, inside the caller's transaction: the detail ison, or deleted for off.static voidsetMailWanted(Connection conn, BasicUserInfo user, boolean wanted) Writes the mail setting of a user, inside the caller's transaction.
Field Details
ON
OFF
LIST_LIMIT
public static final int LIST_LIMITThe most attempts listed to the user or the administrator.- See Also:
Constructor Details
FailedSignInRecorder
public FailedSignInRecorder(FailedSignInStore store, Executor executor, FailedSignInNotifier notifier) Constructs a recorder on a store, an executor and a notifier: the tests' constructor.- Parameters:
store- The store.executor- Where the capture runs;Runnable::runruns it in the caller.notifier- The notifier, on the same store.
Method Details
getInstance
getStore
onServerRound
public void onServerRound()Called at every clean-up round of the server: starts the notifier's thread once the server is started and its database is ready, so that a batch or a summary held when the server stopped goes out (FailedSignInNotifier.runDue()). Without a started server (the tests' JVM) nothing is started.isMailWanted
Checks if a user is mailed about the throttled failed sign-ins: the detailIZS-FailedSignInMailwhen set (on/off), else the default - on for a sensitive account, off otherwise.- Parameters:
user- The user.sensitive- Whether the account is a sensitive one.- Returns:
- true when the mail is on.
isAutoClear
Checks if a user has the list cleared at every successful sign-in: the detailIZS-FailedSignInClearison.- Parameters:
user- The user.- Returns:
- true when the list is cleared at a sign-in.
setMailWanted
public static void setMailWanted(Connection conn, BasicUserInfo user, boolean wanted) throws SQLException Writes the mail setting of a user, inside the caller's transaction.- Parameters:
conn- The connection of the caller's transaction.user- The user.wanted- true for on, false for off.- Throws:
SQLException- For SQL errors.
setAutoClear
public static void setAutoClear(Connection conn, BasicUserInfo user, boolean on) throws SQLException Writes the clearing setting of a user, inside the caller's transaction: the detail ison, or deleted for off.- Parameters:
conn- The connection of the caller's transaction.user- The user.on- true to clear the list at every sign-in.- Throws:
SQLException- For SQL errors.
onFailure
public void onFailure(IClientSessionGyro clientGyro, UserInfoBase user, FailedSignInStep step, boolean afterPassword, boolean sensitive, String reason) Called when a sign-in to a known account was refused: starts the capture and returns. The caller has answered, or is about to answer, the failing client exactly as before.- Parameters:
clientGyro- The client session the attempt came from, null for none.user- The account, with its basic user information.step- The step that failed.afterPassword- true when the password was accepted before the step failed.sensitive- true for a sensitive account (an administrator, a user a strong policy binds).reason- The reason, for the log line, null for none; never a secret.
onSignedIn
Called when a user has signed in: clears the list when the user chose so. Off the path, on the executor.- Parameters:
user- The user, with its basic user information.
list
Lists the attempts of a user, the most recent first, for the account page and ServerAdmin.- Parameters:
uid- The user.- Returns:
- The attempts, at most
LIST_LIMIT; none when the store is unavailable or failed (logged).
infos
Lists the attempts of a user as the SignIn module gets them.- Parameters:
uid- The user.- Returns:
- The information, the most recent first.
clear
public int clear(long uid) Clears the attempts of a user: the user's or an administrator's "Clear".- Parameters:
uid- The user.- Returns:
- The rows deleted, -1 when the store failed (logged).
purge
public int purge(int days) Deletes the attempts older than the days kept: the daily purge, with the sign-in records.- Parameters:
days- The days kept.- Returns:
- The rows deleted, 0 when the store is unavailable or the purge failed (logged).
onLockStarted
public void onLockStarted(FailedSignInMails.LockPath path, UserAuthenticationInfo info, IClientSessionGyro clientGyro, InetAddress address) Called when a wrong password started a lock of an account on a path that keeps no failed sign-in for it (LockEvents.startWithoutAttempt(FailedSignInMails.LockPath, UserAuthenticationInfo, IClientSessionGyro)): starts the telling and returns. Off the path, asonFailure(IClientSessionGyro, UserInfoBase, FailedSignInStep, boolean, boolean, String): the thread resolves the client address and its place, logs the security event of a path that has no client session (the Push API; a path with a session has logged it), writes one WARNING line and has the owner mailed (FailedSignInNotifier.onLock(FailedSignInMails.LockPath, FailedSignInStore.Attempt, BasicUserInfo)). NOTHING is written toIZS.FAILED_SIGNINS(order 561, FA-D-6).- Parameters:
path- The path.info- The answer of the password check that started the lock.clientGyro- The client session the wrong password came from, null for none.address- The client address when there is no client session, null when unknown.