@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.

Make old GitHub OAuth URIs work for now

Summary: Ref T1536. Like Google, GitHub is actually strict about callback URIs too. Keep them pointed at the old URIs until we can gradually migrate.

Test Plan: Logged in with GitHub.

Reviewers: garoevans, davidreuss, btrahan

Reviewed By: garoevans

CC: aran

Maniphest Tasks: T1536

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

+27 -4
+2 -1
src/applications/auth/application/PhabricatorApplicationAuth.php
··· 71 71 => 'PhabricatorAuthConfirmLinkController', 72 72 ), 73 73 74 - '/oauth/google/login/' => 'PhabricatorAuthOldOAuthRedirectController', 74 + '/oauth/(?P<provider>\w+)/login/' 75 + => 'PhabricatorAuthOldOAuthRedirectController', 75 76 76 77 '/login/' => array( 77 78 '' => 'PhabricatorAuthStartController',
+20 -3
src/applications/auth/controller/PhabricatorAuthOldOAuthRedirectController.php
··· 3 3 final class PhabricatorAuthOldOAuthRedirectController 4 4 extends PhabricatorAuthController { 5 5 6 + private $provider; 7 + 6 8 public function shouldRequireLogin() { 7 9 return false; 10 + } 11 + 12 + public function willProcessRequest(array $data) { 13 + $this->provider = $data['provider']; 8 14 } 9 15 10 16 public function processRequest() { 11 17 // TODO: Most OAuth providers are OK with changing the redirect URI, but 12 - // Google is strict. We need to respect the old OAuth URI until we can 13 - // get installs to migrate. This just keeps the old OAuth URI working 18 + // Google and GitHub are strict. We need to respect the old OAuth URI until 19 + // we can get installs to migrate. This just keeps the old OAuth URI working 14 20 // by redirecting to the new one. 15 21 22 + $provider_map = array( 23 + 'google' => 'google:google.com', 24 + 'github' => 'github:github.com', 25 + ); 26 + 27 + if (!isset($provider_map[$this->provider])) { 28 + return new Aphront404Response(); 29 + } 30 + 31 + $provider_key = $provider_map[$this->provider]; 32 + 16 33 $uri = $this->getRequest()->getRequestURI(); 17 - $uri->setPath($this->getApplicationURI('login/google:google.com/')); 34 + $uri->setPath($this->getApplicationURI('login/'.$provider_key.'/')); 18 35 return id(new AphrontRedirectResponse())->setURI($uri); 19 36 } 20 37
+5
src/applications/auth/provider/PhabricatorAuthProviderOAuthGitHub.php
··· 36 36 return 'Github'; 37 37 } 38 38 39 + public function getLoginURI() { 40 + // TODO: Clean this up. See PhabricatorAuthOldOAuthRedirectController. 41 + return PhabricatorEnv::getURI('/oauth/github/login/'); 42 + } 43 + 39 44 }