Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15415323
D19888.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D19888.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2188,6 +2188,7 @@
'PhabricatorAuthAuthFactorPHIDType' => 'applications/auth/phid/PhabricatorAuthAuthFactorPHIDType.php',
'PhabricatorAuthAuthProviderPHIDType' => 'applications/auth/phid/PhabricatorAuthAuthProviderPHIDType.php',
'PhabricatorAuthChallenge' => 'applications/auth/storage/PhabricatorAuthChallenge.php',
+ 'PhabricatorAuthChallengeGarbageCollector' => 'applications/auth/garbagecollector/PhabricatorAuthChallengeGarbageCollector.php',
'PhabricatorAuthChallengePHIDType' => 'applications/auth/phid/PhabricatorAuthChallengePHIDType.php',
'PhabricatorAuthChallengeQuery' => 'applications/auth/query/PhabricatorAuthChallengeQuery.php',
'PhabricatorAuthChangePasswordAction' => 'applications/auth/action/PhabricatorAuthChangePasswordAction.php',
@@ -7830,6 +7831,7 @@
'PhabricatorAuthDAO',
'PhabricatorPolicyInterface',
),
+ 'PhabricatorAuthChallengeGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorAuthChallengePHIDType' => 'PhabricatorPHIDType',
'PhabricatorAuthChallengeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorAuthChangePasswordAction' => 'PhabricatorSystemAction',
diff --git a/src/applications/auth/garbagecollector/PhabricatorAuthChallengeGarbageCollector.php b/src/applications/auth/garbagecollector/PhabricatorAuthChallengeGarbageCollector.php
new file mode 100644
--- /dev/null
+++ b/src/applications/auth/garbagecollector/PhabricatorAuthChallengeGarbageCollector.php
@@ -0,0 +1,28 @@
+<?php
+
+final class PhabricatorAuthChallengeGarbageCollector
+ extends PhabricatorGarbageCollector {
+
+ const COLLECTORCONST = 'auth.challenges';
+
+ public function getCollectorName() {
+ return pht('Authentication Challenges');
+ }
+
+ public function hasAutomaticPolicy() {
+ return true;
+ }
+
+ protected function collectGarbage() {
+ $challenge_table = new PhabricatorAuthChallenge();
+ $conn = $challenge_table->establishConnection('w');
+
+ queryfx(
+ $conn,
+ 'DELETE FROM %R WHERE challengeTTL < UNIX_TIMESTAMP() LIMIT 100',
+ $challenge_table);
+
+ return ($conn->getAffectedRows() == 100);
+ }
+
+}
diff --git a/src/applications/auth/storage/PhabricatorAuthChallenge.php b/src/applications/auth/storage/PhabricatorAuthChallenge.php
--- a/src/applications/auth/storage/PhabricatorAuthChallenge.php
+++ b/src/applications/auth/storage/PhabricatorAuthChallenge.php
@@ -25,6 +25,9 @@
'key_issued' => array(
'columns' => array('userPHID', 'challengeTTL'),
),
+ 'key_collection' => array(
+ 'columns' => array('challengeTTL'),
+ ),
),
) + parent::getConfiguration();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 5:24 AM (6 d, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7709255
Default Alt Text
D19888.diff (2 KB)
Attached To
Mode
D19888: Add a garbage collector for MFA challenges
Attached
Detach File
Event Timeline
Log In to Comment