mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-03 20:22:46 +01:00
701bb2ac6e
Summary: Ref T5655. Depends on D9998. Test Plan: `arc unit` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: 20after4, epriestley, Korvin Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D9999
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorAsanaAuthProvider extends PhabricatorOAuth2AuthProvider {
|
|
|
|
public function getProviderName() {
|
|
return pht('Asana');
|
|
}
|
|
|
|
protected function getProviderConfigurationHelp() {
|
|
$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 PhutilAsanaAuthAdapter();
|
|
}
|
|
|
|
protected function getLoginIcon() {
|
|
return 'Asana';
|
|
}
|
|
|
|
public static function getAsanaProvider() {
|
|
$providers = self::getAllEnabledProviders();
|
|
|
|
foreach ($providers as $provider) {
|
|
if ($provider instanceof PhabricatorAsanaAuthProvider) {
|
|
return $provider;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
}
|