Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15310826
D18891.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D18891.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
@@ -2133,6 +2133,7 @@
'PhabricatorAuthTemporaryToken' => 'applications/auth/storage/PhabricatorAuthTemporaryToken.php',
'PhabricatorAuthTemporaryTokenGarbageCollector' => 'applications/auth/garbagecollector/PhabricatorAuthTemporaryTokenGarbageCollector.php',
'PhabricatorAuthTemporaryTokenQuery' => 'applications/auth/query/PhabricatorAuthTemporaryTokenQuery.php',
+ 'PhabricatorAuthTemporaryTokenRevoker' => 'applications/auth/revoker/PhabricatorAuthTemporaryTokenRevoker.php',
'PhabricatorAuthTemporaryTokenType' => 'applications/auth/tokentype/PhabricatorAuthTemporaryTokenType.php',
'PhabricatorAuthTemporaryTokenTypeModule' => 'applications/auth/tokentype/PhabricatorAuthTemporaryTokenTypeModule.php',
'PhabricatorAuthTerminateSessionController' => 'applications/auth/controller/PhabricatorAuthTerminateSessionController.php',
@@ -7422,6 +7423,7 @@
),
'PhabricatorAuthTemporaryTokenGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorAuthTemporaryTokenQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+ 'PhabricatorAuthTemporaryTokenRevoker' => 'PhabricatorAuthRevoker',
'PhabricatorAuthTemporaryTokenType' => 'Phobject',
'PhabricatorAuthTemporaryTokenTypeModule' => 'PhabricatorConfigModule',
'PhabricatorAuthTerminateSessionController' => 'PhabricatorAuthController',
diff --git a/src/applications/auth/revoker/PhabricatorAuthTemporaryTokenRevoker.php b/src/applications/auth/revoker/PhabricatorAuthTemporaryTokenRevoker.php
new file mode 100644
--- /dev/null
+++ b/src/applications/auth/revoker/PhabricatorAuthTemporaryTokenRevoker.php
@@ -0,0 +1,33 @@
+<?php
+
+final class PhabricatorAuthTemporaryTokenRevoker
+ extends PhabricatorAuthRevoker {
+
+ const REVOKERKEY = 'temporary';
+
+ public function revokeAllCredentials() {
+ $table = new PhabricatorAuthTemporaryToken();
+ $conn = $table->establishConnection('w');
+
+ queryfx(
+ $conn,
+ 'DELETE FROM %T',
+ $table->getTableName());
+
+ return $conn->getAffectedRows();
+ }
+
+ public function revokeCredentialsFrom($object) {
+ $table = new PhabricatorAuthTemporaryToken();
+ $conn = $table->establishConnection('w');
+
+ queryfx(
+ $conn,
+ 'DELETE FROM %T WHERE tokenResource = %s',
+ $table->getTableName(),
+ $object->getPHID());
+
+ return $conn->getAffectedRows();
+ }
+
+}
diff --git a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php
--- a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php
+++ b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php
@@ -1646,6 +1646,11 @@
'%s objects.',
),
+ 'Destroyed %s credential(s) of type "%s".' => array(
+ 'Destroyed one credential of type "%2$s".',
+ 'Destroyed %s credentials of type "%s".',
+ ),
+
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 7, 9:30 AM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7329786
Default Alt Text
D18891.diff (3 KB)
Attached To
Mode
D18891: Add a `bin/auth revoke` revoker for temporary tokens
Attached
Detach File
Event Timeline
Log In to Comment