@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Convert OAuth1 handshake tokens to new modular temporary tokens

Summary: Ref T10603. Swap these over and give them nice UI strings.

Test Plan:
- Refreshed a Twitter OAuth link.
- Unlinked and re-linked a Twitter account.
- Viewed the new type in {nav Config > Temporary Tokens}.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10603

Differential Revision: https://secure.phabricator.com/D15480

+26 -4
+2
src/__phutil_library_map__.php
··· 2672 2672 'PhabricatorNotificationsApplication' => 'applications/notification/application/PhabricatorNotificationsApplication.php', 2673 2673 'PhabricatorNuanceApplication' => 'applications/nuance/application/PhabricatorNuanceApplication.php', 2674 2674 'PhabricatorOAuth1AuthProvider' => 'applications/auth/provider/PhabricatorOAuth1AuthProvider.php', 2675 + 'PhabricatorOAuth1SecretTemporaryTokenType' => 'applications/auth/provider/PhabricatorOAuth1SecretTemporaryTokenType.php', 2675 2676 'PhabricatorOAuth2AuthProvider' => 'applications/auth/provider/PhabricatorOAuth2AuthProvider.php', 2676 2677 'PhabricatorOAuthAuthProvider' => 'applications/auth/provider/PhabricatorOAuthAuthProvider.php', 2677 2678 'PhabricatorOAuthClientAuthorization' => 'applications/oauthserver/storage/PhabricatorOAuthClientAuthorization.php', ··· 7122 7123 'PhabricatorNotificationsApplication' => 'PhabricatorApplication', 7123 7124 'PhabricatorNuanceApplication' => 'PhabricatorApplication', 7124 7125 'PhabricatorOAuth1AuthProvider' => 'PhabricatorOAuthAuthProvider', 7126 + 'PhabricatorOAuth1SecretTemporaryTokenType' => 'PhabricatorAuthTemporaryTokenType', 7125 7127 'PhabricatorOAuth2AuthProvider' => 'PhabricatorOAuthAuthProvider', 7126 7128 'PhabricatorOAuthAuthProvider' => 'PhabricatorAuthProvider', 7127 7129 'PhabricatorOAuthClientAuthorization' => array(
+7 -4
src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php
··· 9 9 const PROPERTY_CONSUMER_SECRET = 'oauth1:consumer:secret'; 10 10 const PROPERTY_PRIVATE_KEY = 'oauth1:private:key'; 11 11 12 - const TEMPORARY_TOKEN_TYPE = 'oauth1:request:secret'; 13 - 14 12 protected function getIDKey() { 15 13 return self::PROPERTY_CONSUMER_KEY; 16 14 } ··· 215 213 216 214 217 215 private function saveHandshakeTokenSecret($client_code, $secret) { 216 + $secret_type = PhabricatorOAuth1SecretTemporaryTokenType::TOKENTYPE; 218 217 $key = $this->getHandshakeTokenKeyFromClientCode($client_code); 219 - $type = $this->getTemporaryTokenType(self::TEMPORARY_TOKEN_TYPE); 218 + $type = $this->getTemporaryTokenType($secret_type); 220 219 221 220 // Wipe out an existing token, if one exists. 222 221 $token = id(new PhabricatorAuthTemporaryTokenQuery()) ··· 238 237 } 239 238 240 239 private function loadHandshakeTokenSecret($client_code) { 240 + $secret_type = PhabricatorOAuth1SecretTemporaryTokenType::TOKENTYPE; 241 241 $key = $this->getHandshakeTokenKeyFromClientCode($client_code); 242 - $type = $this->getTemporaryTokenType(self::TEMPORARY_TOKEN_TYPE); 242 + $type = $this->getTemporaryTokenType($secret_type); 243 243 244 244 $token = id(new PhabricatorAuthTemporaryTokenQuery()) 245 245 ->setViewer(PhabricatorUser::getOmnipotentUser()) ··· 262 262 // Namespace the type so that multiple providers don't step on each 263 263 // others' toes if a user starts Mediawiki and Bitbucket auth at the 264 264 // same time. 265 + 266 + // TODO: This isn't really a proper use of the table and should get 267 + // cleaned up some day: the type should be constant. 265 268 266 269 return $core_type.':'.$this->getProviderConfig()->getID(); 267 270 }
+17
src/applications/auth/provider/PhabricatorOAuth1SecretTemporaryTokenType.php
··· 1 + <?php 2 + 3 + final class PhabricatorOAuth1SecretTemporaryTokenType 4 + extends PhabricatorAuthTemporaryTokenType { 5 + 6 + const TOKENTYPE = 'oauth1:request:secret'; 7 + 8 + public function getTokenTypeDisplayName() { 9 + return pht('OAuth1 Handshake Secret'); 10 + } 11 + 12 + public function getTokenReadableTypeName( 13 + PhabricatorAuthTemporaryToken $token) { 14 + return pht('OAuth1 Handshake Token'); 15 + } 16 + 17 + }