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
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorAuthProviderOAuthAmazon
|
|
extends PhabricatorAuthProviderOAuth {
|
|
|
|
public function getProviderName() {
|
|
return pht('Amazon');
|
|
}
|
|
|
|
public function getConfigurationHelp() {
|
|
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
|
|
|
|
$uri = new PhutilURI(PhabricatorEnv::getProductionURI('/'));
|
|
$https_note = null;
|
|
if ($uri->getProtocol() !== 'https') {
|
|
$https_note = pht(
|
|
'NOTE: Amazon **requires** HTTPS, but your Phabricator install does '.
|
|
'not use HTTPS. **You will not be able to add Amazon as an '.
|
|
'authentication provider until you configure HTTPS on this install**.');
|
|
}
|
|
|
|
return pht(
|
|
"%s\n\n".
|
|
"To configure Amazon OAuth, create a new 'API Project' here:".
|
|
"\n\n".
|
|
"http://login.amazon.com/manageApps".
|
|
"\n\n".
|
|
"Use these settings:".
|
|
"\n\n".
|
|
" - **Allowed Return URLs:** Add this: `%s`".
|
|
"\n\n".
|
|
"After completing configuration, copy the **Client ID** and ".
|
|
"**Client Secret** to the fields above.",
|
|
$https_note,
|
|
$login_uri);
|
|
}
|
|
|
|
protected function newOAuthAdapter() {
|
|
return new PhutilAuthAdapterOAuthAmazon();
|
|
}
|
|
|
|
protected function getLoginIcon() {
|
|
return 'Amazon';
|
|
}
|
|
|
|
}
|