mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-17 18:21:11 +01:00
e723b7e119
Summary: - `DoorkeeperObjectRef` is a convenience object to keep track of `<applicationType, applicationDomain, objectType, objectID>` tuples. - `DoorkeeperBridge` provides pull/push between Phabricator and external systems. - `DoorkeeperBridgeAsana` is a bridge to Asana. Test Plan: Ran this snippet and got a task from Asana: {P871} Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6273
50 lines
1.2 KiB
PHP
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 = $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;
|
|
}
|
|
|
|
}
|