Page MenuHomePhabricator

D15480.id37313.diff
No OneTemporary

D15480.id37313.diff

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
@@ -2672,6 +2672,7 @@
'PhabricatorNotificationsApplication' => 'applications/notification/application/PhabricatorNotificationsApplication.php',
'PhabricatorNuanceApplication' => 'applications/nuance/application/PhabricatorNuanceApplication.php',
'PhabricatorOAuth1AuthProvider' => 'applications/auth/provider/PhabricatorOAuth1AuthProvider.php',
+ 'PhabricatorOAuth1SecretTemporaryTokenType' => 'applications/auth/provider/PhabricatorOAuth1SecretTemporaryTokenType.php',
'PhabricatorOAuth2AuthProvider' => 'applications/auth/provider/PhabricatorOAuth2AuthProvider.php',
'PhabricatorOAuthAuthProvider' => 'applications/auth/provider/PhabricatorOAuthAuthProvider.php',
'PhabricatorOAuthClientAuthorization' => 'applications/oauthserver/storage/PhabricatorOAuthClientAuthorization.php',
@@ -7122,6 +7123,7 @@
'PhabricatorNotificationsApplication' => 'PhabricatorApplication',
'PhabricatorNuanceApplication' => 'PhabricatorApplication',
'PhabricatorOAuth1AuthProvider' => 'PhabricatorOAuthAuthProvider',
+ 'PhabricatorOAuth1SecretTemporaryTokenType' => 'PhabricatorAuthTemporaryTokenType',
'PhabricatorOAuth2AuthProvider' => 'PhabricatorOAuthAuthProvider',
'PhabricatorOAuthAuthProvider' => 'PhabricatorAuthProvider',
'PhabricatorOAuthClientAuthorization' => array(
diff --git a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php
--- a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php
@@ -9,8 +9,6 @@
const PROPERTY_CONSUMER_SECRET = 'oauth1:consumer:secret';
const PROPERTY_PRIVATE_KEY = 'oauth1:private:key';
- const TEMPORARY_TOKEN_TYPE = 'oauth1:request:secret';
-
protected function getIDKey() {
return self::PROPERTY_CONSUMER_KEY;
}
@@ -215,8 +213,9 @@
private function saveHandshakeTokenSecret($client_code, $secret) {
+ $secret_type = PhabricatorOAuth1SecretTemporaryTokenType::TOKENTYPE;
$key = $this->getHandshakeTokenKeyFromClientCode($client_code);
- $type = $this->getTemporaryTokenType(self::TEMPORARY_TOKEN_TYPE);
+ $type = $this->getTemporaryTokenType($secret_type);
// Wipe out an existing token, if one exists.
$token = id(new PhabricatorAuthTemporaryTokenQuery())
@@ -238,8 +237,9 @@
}
private function loadHandshakeTokenSecret($client_code) {
+ $secret_type = PhabricatorOAuth1SecretTemporaryTokenType::TOKENTYPE;
$key = $this->getHandshakeTokenKeyFromClientCode($client_code);
- $type = $this->getTemporaryTokenType(self::TEMPORARY_TOKEN_TYPE);
+ $type = $this->getTemporaryTokenType($secret_type);
$token = id(new PhabricatorAuthTemporaryTokenQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
@@ -263,6 +263,9 @@
// others' toes if a user starts Mediawiki and Bitbucket auth at the
// same time.
+ // TODO: This isn't really a proper use of the table and should get
+ // cleaned up some day: the type should be constant.
+
return $core_type.':'.$this->getProviderConfig()->getID();
}
diff --git a/src/applications/auth/provider/PhabricatorOAuth1SecretTemporaryTokenType.php b/src/applications/auth/provider/PhabricatorOAuth1SecretTemporaryTokenType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/auth/provider/PhabricatorOAuth1SecretTemporaryTokenType.php
@@ -0,0 +1,17 @@
+<?php
+
+final class PhabricatorOAuth1SecretTemporaryTokenType
+ extends PhabricatorAuthTemporaryTokenType {
+
+ const TOKENTYPE = 'oauth1:request:secret';
+
+ public function getTokenTypeDisplayName() {
+ return pht('OAuth1 Handshake Secret');
+ }
+
+ public function getTokenReadableTypeName(
+ PhabricatorAuthTemporaryToken $token) {
+ return pht('OAuth1 Handshake Token');
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 20, 3:09 AM (6 d, 6 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704864
Default Alt Text
D15480.id37313.diff (3 KB)

Event Timeline