mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 10:22:42 +01:00
24544b1a2f
Summary: Ref T4339. Login providers use absolute URIs, but the ones that rely on local form submits should not, because we want to include CSRF tokens where applicable. Instead, make the default be relative URIs and turn them into absolute ones for the callback proivders. Test Plan: Clicked, like, every login button. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4339 Differential Revision: https://secure.phabricator.com/D8045
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorAuthProviderOAuthGitHub
|
|
extends PhabricatorAuthProviderOAuth {
|
|
|
|
public function getProviderName() {
|
|
return pht('GitHub');
|
|
}
|
|
|
|
public function getConfigurationHelp() {
|
|
$uri = PhabricatorEnv::getProductionURI('/');
|
|
$callback_uri = PhabricatorEnv::getURI($this->getLoginURI());
|
|
|
|
return pht(
|
|
"To configure GitHub OAuth, create a new GitHub Application here:".
|
|
"\n\n".
|
|
"https://github.com/settings/applications/new".
|
|
"\n\n".
|
|
"You should use these settings in your application:".
|
|
"\n\n".
|
|
" - **URL:** Set this to your full domain with protocol. For this ".
|
|
" Phabricator install, the correct value is: `%s`\n".
|
|
" - **Callback URL**: Set this to: `%s`\n".
|
|
"\n\n".
|
|
"Once you've created an application, copy the **Client ID** and ".
|
|
"**Client Secret** into the fields above.",
|
|
$uri,
|
|
$callback_uri);
|
|
}
|
|
|
|
protected function newOAuthAdapter() {
|
|
return new PhutilAuthAdapterOAuthGitHub();
|
|
}
|
|
|
|
protected function getLoginIcon() {
|
|
return 'Github';
|
|
}
|
|
|
|
public function getLoginURI() {
|
|
// TODO: Clean this up. See PhabricatorAuthOldOAuthRedirectController.
|
|
return '/oauth/github/login/';
|
|
}
|
|
|
|
}
|