@@ -112,20 +112,6 @@ $token = $user->getHmacTokenById($id);
112112$tokens = $user->hmacTokens();
113113```
114114
115- ## HMAC Keys Lifetime
116-
117- HMAC Keys/Tokens will expire after a specified amount of time has passed since they have been used.
118- This uses the same configuration value as AccessTokens.
119-
120- By default, this is set to 1 year. You can change this value by setting the ` $unusedTokenLifetime `
121- value in the ** app/Config/AuthToken.php** config file. This is in seconds so that you can use the
122- [ time constants] ( https://codeigniter.com/user_guide/general/common_functions.html#time-constants )
123- that CodeIgniter provides.
124-
125- ``` php
126- public $unusedTokenLifetime = YEAR;
127- ```
128-
129115## HMAC Keys Scopes
130116
131117Each token (set of keys) can be given one or more scopes they can be used within. These can be thought of as
@@ -219,3 +205,44 @@ authtoken.hmacEncryptionCurrentKey = k2
219205Depending on the set length of the Secret Key and the type of encryption used, it is possible for the encrypted value to
220206exceed the database column character limit of 255 characters. If this happens, creation of a new HMAC identity will
221207throw a ` RuntimeException ` .
208+
209+ ## Configuration
210+
211+ ### HMAC Keys Lifetime
212+
213+ HMAC Keys/Tokens will expire after a specified amount of time has passed since they have been used.
214+ This uses the same configuration value as AccessTokens.
215+
216+ By default, this is set to 1 year. You can change this value by setting the ` $unusedTokenLifetime `
217+ value in the ** app/Config/AuthToken.php** config file. This is in seconds so that you can use the
218+ [ time constants] ( https://codeigniter.com/user_guide/general/common_functions.html#time-constants )
219+ that CodeIgniter provides.
220+
221+ ``` php
222+ public $unusedTokenLifetime = YEAR;
223+ ```
224+
225+ ### Login Attempt Logging
226+
227+ By default, only failed login attempts are recorded in the ` auth_token_logins ` table.
228+ This can be modified in the ** app/Config/AuthToken.php** config file.
229+
230+ ``` php
231+ public int $recordLoginAttempt = Auth::RECORD_LOGIN_ATTEMPT_FAILURE;
232+ ```
233+
234+ If you don't want any logs, set it to ` Auth::RECORD_LOGIN_ATTEMPT_NONE ` .
235+
236+ If you want to log all login attempts, set it to ` Auth::RECORD_LOGIN_ATTEMPT_ALL ` .
237+ It means you log all requests.
238+
239+ ## Logging
240+
241+ Login attempts are recorded in the ` auth_token_logins ` table, according to the
242+ configuration above.
243+
244+ When a failed login attempt is logged, the raw token value sent is saved in
245+ the ` identifier ` column.
246+
247+ When a successful login attempt is logged, the token name is saved in the
248+ ` identifier ` column.
0 commit comments