1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Add Amazon and Asana providers

Summary: Ref T1536. Ref T2852. Adds providers for Asana and Amazon. See D6248.

Test Plan:
{F46960}

{F46961}

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T1536, T2852

Differential Revision: https://secure.phabricator.com/D6249
This commit is contained in:
epriestley 2013-06-20 11:19:11 -07:00
parent 1834584e98
commit e117b320e2
3 changed files with 88 additions and 0 deletions

View file

@ -838,6 +838,8 @@ phutil_register_library_map(array(
'PhabricatorAuthProviderConfigTransactionQuery' => 'applications/auth/query/PhabricatorAuthProviderConfigTransactionQuery.php',
'PhabricatorAuthProviderLDAP' => 'applications/auth/provider/PhabricatorAuthProviderLDAP.php',
'PhabricatorAuthProviderOAuth' => 'applications/auth/provider/PhabricatorAuthProviderOAuth.php',
'PhabricatorAuthProviderOAuthAmazon' => 'applications/auth/provider/PhabricatorAuthProviderOAuthAmazon.php',
'PhabricatorAuthProviderOAuthAsana' => 'applications/auth/provider/PhabricatorAuthProviderOAuthAsana.php',
'PhabricatorAuthProviderOAuthDisqus' => 'applications/auth/provider/PhabricatorAuthProviderOAuthDisqus.php',
'PhabricatorAuthProviderOAuthFacebook' => 'applications/auth/provider/PhabricatorAuthProviderOAuthFacebook.php',
'PhabricatorAuthProviderOAuthGitHub' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGitHub.php',
@ -2700,6 +2702,8 @@ phutil_register_library_map(array(
'PhabricatorAuthProviderConfigTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorAuthProviderLDAP' => 'PhabricatorAuthProvider',
'PhabricatorAuthProviderOAuth' => 'PhabricatorAuthProvider',
'PhabricatorAuthProviderOAuthAmazon' => 'PhabricatorAuthProviderOAuth',
'PhabricatorAuthProviderOAuthAsana' => 'PhabricatorAuthProviderOAuth',
'PhabricatorAuthProviderOAuthDisqus' => 'PhabricatorAuthProviderOAuth',
'PhabricatorAuthProviderOAuthFacebook' => 'PhabricatorAuthProviderOAuth',
'PhabricatorAuthProviderOAuthGitHub' => 'PhabricatorAuthProviderOAuth',

View file

@ -0,0 +1,46 @@
<?php
final class PhabricatorAuthProviderOAuthAmazon
extends PhabricatorAuthProviderOAuth {
public function getProviderName() {
return pht('Amazon');
}
public function getConfigurationHelp() {
$login_uri = $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';
}
}

View file

@ -0,0 +1,38 @@
<?php
final class PhabricatorAuthProviderOAuthAsana
extends PhabricatorAuthProviderOAuth {
public function getProviderName() {
return pht('Asana');
}
public function getConfigurationHelp() {
$app_uri = PhabricatorEnv::getProductionURI('/');
$login_uri = $this->getLoginURI();
return pht(
"To configure Asana OAuth, create a new application by logging in to ".
"Asana and going to **Account Settings**, then **Apps**, then ".
"**Add New Application**.".
"\n\n".
"Use these settings:".
"\n\n".
" - **App URL:** Set this to: `%s`\n".
" - **Redirect URL:** Set this to: `%s`".
"\n\n".
"After completing configuration, copy the **Client ID** and ".
"**Client Secret** to the fields above.",
$app_uri,
$login_uri);
}
protected function newOAuthAdapter() {
return new PhutilAuthAdapterOAuthAsana();
}
protected function getLoginIcon() {
return 'Asana';
}
}