1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 10:22:42 +01:00
phorge-phorge/src/applications/auth/provider/PhabricatorAuthProviderOAuthAsana.php
epriestley 24544b1a2f Straighten out absolute/relative URIs in login providers
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
2014-01-23 14:03:44 -08:00

50 lines
1.2 KiB
PHP

<?php
final class PhabricatorAuthProviderOAuthAsana
extends PhabricatorAuthProviderOAuth {
public function getProviderName() {
return pht('Asana');
}
public function getConfigurationHelp() {
$app_uri = PhabricatorEnv::getProductionURI('/');
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
return pht(
"To configure Asana OAuth, create a new application here:".
"\n\n".
"https://app.asana.com/-/account_api".
"\n\n".
"When creating your application, 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';
}
public static function getAsanaProvider() {
$providers = self::getAllEnabledProviders();
foreach ($providers as $provider) {
if ($provider instanceof PhabricatorAuthProviderOAuthAsana) {
return $provider;
}
}
return null;
}
}