2013-06-20 11:19:11 -07:00
|
|
|
<?php
|
|
|
|
|
2014-07-22 21:04:13 +10:00
|
|
|
final class PhabricatorAsanaAuthProvider extends PhabricatorOAuth2AuthProvider {
|
2013-06-20 11:19:11 -07:00
|
|
|
|
|
|
|
public function getProviderName() {
|
|
|
|
return pht('Asana');
|
|
|
|
}
|
|
|
|
|
2014-04-09 11:09:50 -07:00
|
|
|
protected function getProviderConfigurationHelp() {
|
2013-06-20 11:19:11 -07:00
|
|
|
$app_uri = PhabricatorEnv::getProductionURI('/');
|
2014-01-23 14:03:44 -08:00
|
|
|
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
|
2013-06-20 11:19:11 -07:00
|
|
|
|
|
|
|
return pht(
|
2013-06-24 10:00:09 -07:00
|
|
|
"To configure Asana OAuth, create a new application here:".
|
2013-06-20 11:19:11 -07:00
|
|
|
"\n\n".
|
2013-06-24 10:00:09 -07:00
|
|
|
"https://app.asana.com/-/account_api".
|
|
|
|
"\n\n".
|
|
|
|
"When creating your application, use these settings:".
|
2013-06-20 11:19:11 -07:00
|
|
|
"\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() {
|
2014-07-22 21:04:13 +10:00
|
|
|
return new PhutilAsanaAuthAdapter();
|
2013-06-20 11:19:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function getLoginIcon() {
|
|
|
|
return 'Asana';
|
|
|
|
}
|
|
|
|
|
2013-06-24 15:54:54 -07:00
|
|
|
public static function getAsanaProvider() {
|
|
|
|
$providers = self::getAllEnabledProviders();
|
|
|
|
|
|
|
|
foreach ($providers as $provider) {
|
2014-07-22 21:04:13 +10:00
|
|
|
if ($provider instanceof PhabricatorAsanaAuthProvider) {
|
2013-06-24 15:54:54 -07:00
|
|
|
return $provider;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-06-20 11:19:11 -07:00
|
|
|
}
|