mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
48 lines
1.9 KiB
PHP
48 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
|
* @license http://opensource.org/licenses/AGPL-3.0
|
|
*/
|
|
|
|
namespace Combodo\iTop\Controller\OAuth;
|
|
|
|
use Combodo\iTop\Application\TwigBase\Controller\Controller;
|
|
use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAbstract;
|
|
use Dict;
|
|
use utils;
|
|
|
|
class OAuthWizardController extends Controller
|
|
{
|
|
public function WizardOperation()
|
|
{
|
|
$aParams = [];
|
|
|
|
$aParams['sReturnUri'] = OAuthClientProviderAbstract::GetRedirectUri();
|
|
$aParams['sAjaxUri'] = utils::GetAbsoluteUrlAppRoot().'pages/oauth/ajax.wizard.php';
|
|
|
|
|
|
//$this->AddLinkedScript(utils::GetAbsoluteUrlAppRoot().'/js/pages/backoffice/oauth.wizard.js');
|
|
|
|
$aOAuthClasses = [
|
|
'Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAzure',
|
|
'Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderGoogle',
|
|
];
|
|
foreach ($aOAuthClasses as $sOAuthClass) {
|
|
$aParams['aProviders'][] = [
|
|
'name' => $sOAuthClass::GetVendorName(),
|
|
'icon' => $sOAuthClass::GetVendorIcon(),
|
|
'colors' => $sOAuthClass::GetVendorColors(),
|
|
];
|
|
}
|
|
|
|
$aParams['aInputs'] = [
|
|
'client_id' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:ClientId:Label'), 'read_only' => false, 'value' => ''],
|
|
'client_secret' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:ClientSecret:Label'), 'read_only' => false, 'value' => ''],
|
|
'scope' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:Scope:Label'), 'read_only' => false, 'value' => ''],
|
|
'additional' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:Additional:Label'), 'read_only' => false, 'value' => ''],
|
|
'redirect_uri' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:RedirectUri:Label'), 'read_only' => true, 'value' => OAuthClientProviderAbstract::GetRedirectUri()],
|
|
];
|
|
|
|
$this->DisplayPage($aParams);
|
|
}
|
|
} |