Merge remote-tracking branch 'origin/support/3.0' into develop

# Conflicts:
#	lib/composer/autoload_files.php
#	lib/composer/autoload_static.php
This commit is contained in:
Benjamin Dalsass
2022-06-17 10:14:01 +02:00
27 changed files with 169 additions and 48 deletions

View File

@@ -15,12 +15,13 @@
<module_parameters>
<parameters id="itop-hub-connector" _delta="define">
<url>https://www.itophub.io</url>
<route_landing>/my-instances/landing-from-remote</route_landing>
<route_landing_stateless>/stateless-remote-itop/landing-from-remote-stateless</route_landing_stateless>
<route_fetch_unread_messages>/api/messages</route_fetch_unread_messages>
<route_mark_all_messages_as_read>/api/messages/mark-all-as-read</route_mark_all_messages_as_read>
<route_view_all_messages>/messages</route_view_all_messages>
<route_landing>/my-instances/landing-from-remote</route_landing>
<route_landing_stateless>/stateless-remote-itop/landing-from-remote-stateless</route_landing_stateless>
<route_fetch_unread_messages>/api/messages</route_fetch_unread_messages>
<route_mark_all_messages_as_read>/api/messages/mark-all-as-read</route_mark_all_messages_as_read>
<route_view_all_messages>/messages</route_view_all_messages>
<setup_url>../pages/exec.php?exec_module=itop-hub-connector&amp;exec_page=launch.php&amp;target=inform_after_setup</setup_url>
<rgpd_url>https://www.itophub.io/page/data-privacy</rgpd_url>
</parameters>
</module_parameters>
</itop_design>

View File

@@ -472,6 +472,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Maintenance~~',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Množství',
'UI:GroupBy:Count+' => 'Množství prvků',
'UI:CountOfObjects' => 'Počet objektů odpovídajícíh ktritériím: %1$d',

View File

@@ -461,6 +461,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Maintenance~~',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Antal',
'UI:GroupBy:Count+' => 'Antal af elementer',
'UI:CountOfObjects' => '%1$d objekter opfylder kriteriet.',

View File

@@ -461,6 +461,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Wartung',
'UI:Error:InvalidToken' => 'Error: The angeforderte Operation wurde bereits ausgeführt (CSRF-Token nicht gefunden)',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Anzahl',
'UI:GroupBy:Count+' => 'Anzahl der Elemente',
'UI:CountOfObjects' => '%1$d Objekte, die das Kriterium erfüllen.',

View File

@@ -483,6 +483,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Maintenance',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)',
'UI:GroupBy:Count' => 'Count',
'UI:GroupBy:Count+' => 'Number of elements',
'UI:CountOfObjects' => '%1$d objects matching the criteria.',

View File

@@ -473,6 +473,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Mantenimiento',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Cuenta',
'UI:GroupBy:Count+' => 'Número de Elementos',
'UI:CountOfObjects' => '%1$d Elementos cumplen Criterio.',

View File

@@ -467,6 +467,8 @@ Nous espérons que vous aimerez cette version autant que nous avons eu du plaisi
'UI:Error:MaintenanceTitle' => 'Maintenance',
'UI:Error:InvalidToken' => 'Erreur: l\'opération a déjà été effectuée (CSRF token not found)',
'UI:Error:SMTP:UnknownVendor' => 'Le provider SMTP Oauth 2.0 %1$s n\'existe pas',
'UI:GroupBy:Count' => 'Nombre',
'UI:GroupBy:Count+' => 'Nombre d\'éléments',
'UI:CountOfObjects' => '%1$d objets correspondants aux critères.',

View File

@@ -461,6 +461,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Maintenance~~',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Számossága',
'UI:GroupBy:Count+' => '',
'UI:CountOfObjects' => '%1$d darab objektum felel meg a kritériumoknak.',

View File

@@ -472,6 +472,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Maintenance~~',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Conteggio',
'UI:GroupBy:Count+' => '',
'UI:CountOfObjects' => '%1$d oggetti corrispondenti ai criteri.',

View File

@@ -461,6 +461,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Maintenance~~',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'カウント',
'UI:GroupBy:Count+' => '要素数',
'UI:CountOfObjects' => '%1$d 個のオブジェクトが条件にマッチしました。',

View File

@@ -472,6 +472,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Onderhoud',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Aantal',
'UI:GroupBy:Count+' => 'Aantal objecten',
'UI:CountOfObjects' => '%1$d objecten voldoen aan de criteria.',

View File

@@ -472,6 +472,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Manutenção',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Número',
'UI:GroupBy:Count+' => 'Número de elementos',
'UI:CountOfObjects' => '%1$d objetos correspondem aos critérios.',

View File

@@ -473,6 +473,8 @@ Dict::Add('RU RU', 'Russian', 'Русский', array(
'UI:Error:MaintenanceTitle' => 'Техническое обслуживание',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Количество',
'UI:GroupBy:Count+' => 'Количество элементов',
'UI:CountOfObjects' => '%1$d объектов соответствует критериям.',

View File

@@ -462,6 +462,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Maintenance~~',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Počet',
'UI:GroupBy:Count+' => '',
'UI:CountOfObjects' => '%1$d objekt/y/ov sa nezhoduje s kritériami.',

View File

@@ -472,6 +472,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => 'Maintenance~~',
'UI:Error:InvalidToken' => 'Error: the requested operation has already been performed (CSRF token not found)~~',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => 'Say',
'UI:GroupBy:Count+' => 'Eleman sayısı',
'UI:CountOfObjects' => 'Kritere uyan %1$d nesne bulundu.',

View File

@@ -477,6 +477,8 @@ We hope you’ll enjoy this version as much as we enjoyed imagining and creating
'UI:Error:MaintenanceTitle' => '维护',
'UI:Error:InvalidToken' => 'Error: 所请求的操作已执行 (未发现 CSRF token )',
'UI:Error:SMTP:UnknownVendor' => 'OAuth SMTP provider %1$s does not exist (email_transport_smtp.oauth.provider)~~',
'UI:GroupBy:Count' => '个数',
'UI:GroupBy:Count+' => '项目数',
'UI:CountOfObjects' => '%1$d 个对象符合指定的条件.',

View File

@@ -176,6 +176,9 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) {
var sString = "$('#"+aRefreshed[i]+"').trigger('change').trigger('update');";
window.setTimeout(sString, 1); // Synchronous 'trigger' does nothing, call it asynchronously
}
if($('.blockUI').length == 0) {
$('.disabledDuringFieldLoading').prop("disabled", false).removeClass('disabledDuringFieldLoading');
}
};
this.UpdateWizard = function () {
@@ -201,6 +204,10 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) {
function (html) {
$('#ajax_content').html(html);
$('.blockUI').parent().unblock();
if($('.blockUI').length == 0) {
$('.disabledDuringFieldLoading').prop("disabled", false).removeClass('disabledDuringFieldLoading');
}
}
);
};
@@ -235,6 +242,7 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) {
this.ResetQuery();
this.UpdateWizard();
var fieldForm=null;
while (index < aFieldNames.length)
{
sAttCode = aFieldNames[index];
@@ -247,11 +255,16 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) {
message: '',
overlayCSS: {backgroundColor: '#f1f1f1', opacity: 0.3}
});
fieldForm=$('#field_' + sFieldId).closest('form');
this.RequestAllowedValues(sAttCode);
}
index++;
}
if(fieldForm!=null){
fieldForm.find('button[type=submit]:not(:disabled)').prop("disabled", true).addClass('disabledDuringFieldLoading');
}
if (nbOfFieldsToUpdate > 0)
{
this.AjaxQueryServer();

View File

@@ -2,6 +2,11 @@
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f::getLoader();

View File

@@ -149,7 +149,7 @@ class ClassLoader
/**
* @return string[] Array of classname => path
* @psalm-var array<string, string>
* @psalm-return array<string, string>
*/
public function getClassMap()
{

View File

@@ -21,6 +21,8 @@ use Composer\Semver\VersionParser;
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{

View File

@@ -2,7 +2,7 @@
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(

View File

@@ -2,7 +2,7 @@
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(

View File

@@ -2,7 +2,7 @@
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(

View File

@@ -2,7 +2,7 @@
// include_paths.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(

View File

@@ -695,41 +695,73 @@ class WizStepLicense extends WizardStep
return array('class' => 'WizStepDBParams', 'state' => '');
}
private function NeedsRgpdConsent()
{
$sMode = $this->oWizard->GetParameter('install_mode');
$aModules = SetupUtils::AnalyzeInstallation($this->oWizard);
return $sMode == 'install' && !SetupUtils::IsProductVersion($aModules);
}
/**
* @param WebPage $oPage
*/
public function Display(WebPage $oPage)
{
$aLicenses = SetupUtils::GetLicenses();
$oPage->add_style(
<<<CSS
$aLicenses = SetupUtils::GetLicenses();
$oPage->add_style(
<<<CSS
fieldset ul {
max-height: min(30em, 40vh); /* Allow usage of the UI up to 150% zoom */
overflow: auto;
}
CSS
);
);
$oPage->add('<h2>Licenses agreements for the components of '.ITOP_APPLICATION.'</h2>');
$oPage->add_style('div a.no-arrow { background:transparent; padding-left:0;}');
$oPage->add_style('.toggle { cursor:pointer; text-decoration:underline; color:#1C94C4; }');
$oPage->add('<fieldset>');
$oPage->add('<legend>Components of '.ITOP_APPLICATION.'</legend>');
$oPage->add('<ul id="ibo-setup-licenses--components-list">');
$index = 0;
foreach ($aLicenses as $oLicense)
{
$oPage->add('<li><b>'.$oLicense->product.'</b>, &copy; '.$oLicense->author.' is licensed under the <b>'.$oLicense->license_type.' license</b>. (<span class="toggle" id="toggle_'.$index.'">Details</span>)');
$oPage->add('<div id="license_'.$index.'" class="license_text ibo-is-html-content" style="display:none;overflow:auto;max-height:10em;font-size:12px;border:1px #696969 solid;margin-bottom:1em; margin-top:0.5em;padding:0.5em;"><pre>'.$oLicense->text.'</pre></div>');
$oPage->add_ready_script('$(".license_text a").attr("target", "_blank").addClass("no-arrow");');
$oPage->add_ready_script('$("#toggle_'.$index.'").on("click", function() { $("#license_'.$index.'").toggle(); } );');
$index++;
}
$oPage->add('</ul>');
$oPage->add('</fieldset>');
$sChecked = ($this->oWizard->GetParameter('accept_license', 'no') == 'yes') ? ' checked ' : '';
$oPage->add('<div class="setup-accept-licenses"><input type="checkbox" name="accept_license" id="accept" value="yes" '.$sChecked.'><label for="accept">I accept the terms of the licenses of the '.count($aLicenses).' components mentioned above.</label></div>');
$oPage->add_ready_script('$("#accept").bind("click change", function() { WizardUpdateButtons(); });');
$oPage->add('<h2>Licenses agreements for the components of '.ITOP_APPLICATION.'</h2>');
$oPage->add_style('div a.no-arrow { background:transparent; padding-left:0;}');
$oPage->add_style('.toggle { cursor:pointer; text-decoration:underline; color:#1C94C4; }');
$oPage->add('<fieldset>');
$oPage->add('<legend>Components of '.ITOP_APPLICATION.'</legend>');
$oPage->add('<ul id="ibo-setup-licenses--components-list">');
$index = 0;
foreach ($aLicenses as $oLicense) {
$oPage->add('<li><b>'.$oLicense->product.'</b>, &copy; '.$oLicense->author.' is licensed under the <b>'.$oLicense->license_type.' license</b>. (<span class="toggle" id="toggle_'.$index.'">Details</span>)');
$oPage->add('<div id="license_'.$index.'" class="license_text ibo-is-html-content" style="display:none;overflow:auto;max-height:10em;font-size:12px;border:1px #696969 solid;margin-bottom:1em; margin-top:0.5em;padding:0.5em;"><pre>'.$oLicense->text.'</pre></div>');
$oPage->add_ready_script('$(".license_text a").attr("target", "_blank").addClass("no-arrow");');
$oPage->add_ready_script('$("#toggle_'.$index.'").on("click", function() { $("#license_'.$index.'").toggle(); } );');
$index++;
}
$oPage->add('</ul>');
$oPage->add('</fieldset>');
$sChecked = ($this->oWizard->GetParameter('accept_license', 'no') == 'yes') ? ' checked ' : '';
$oPage->add('<div class="setup-accept-licenses"><input class="check_select" type="checkbox" name="accept_license" id="accept" value="yes" '.$sChecked.'><label for="accept">I accept the terms of the licenses of the '.count($aLicenses).' components mentioned above.</label></div>');
if ($this->NeedsRgpdConsent()) {
$oPage->add('<br>');
$oPage->add('<fieldset>');
$oPage->add('<legend>European General Data Protection Regulation</legend>');
$oPage->add('<div class="ibo-setup-licenses--components-list">iTop software is compliant with the processing of personal data according to the European General Data Protection Regulation (GDPR).<p></p>
By installing iTop you agree that some information will be collected by Combodo to help you manage your instances and for statistical purposes.
This data remains anonymous until it is associated to a user account on iTop Hub.</p>
<p>List of collected data available in our <a target="_blank" href="https://www.itophub.io/page/data-privacy">Data privacy section.</a></p><br></div>');
$oPage->add('<input type="checkbox" class="check_select" id="rgpd_consent">');
$oPage->add('<label for="rgpd_consent">&nbsp;I accept the processing of my personal data</label>');
$oPage->add('</fieldset>');
}
$oPage->add_ready_script('$(".check_select").bind("click change", function() { WizardUpdateButtons(); });');
$oPage->add_script(
<<<JS
function isRgpdConsentOk(){
let eRgpdConsent = $("#rgpd_consent");
if(eRgpdConsent.length){
if(!eRgpdConsent[0].checked){
return false;
}
}
return true;
}
JS
);
}
/**
@@ -738,7 +770,7 @@ CSS
*/
public function JSCanMoveForward()
{
return 'return ($("#accept").prop("checked"));';
return 'return ($("#accept").prop("checked") && isRgpdConsentOk());';
}

View File

@@ -2,47 +2,68 @@
namespace Combodo\iTop\Core\Authentication\Client\OAuth;
use CoreException;
use Dict;
use GuzzleHttp\Client;
use League\OAuth2\Client\Token\AccessTokenInterface;
use MetaModel;
class OAuthClientProviderFactory {
class OAuthClientProviderFactory
{
/**
* @return mixed
* @throws \CoreException
*/
public static function getProviderForSMTP()
{
$sProviderVendor = MetaModel::GetConfig()->Get('email_transport_smtp.oauth.provider'); // email_transport_smtp.oauth.provider
$sProviderClass = "\Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProvider".$sProviderVendor;
$sProviderClass = self::getProviderClass($sProviderVendor);
$aProviderVendorParams = [
'clientId' => MetaModel::GetConfig()->Get('email_transport_smtp.oauth.client_id'), // email_transport_smtp.oauth.client_id
'clientSecret' => MetaModel::GetConfig()->Get('email_transport_smtp.oauth.client_secret'),// email_transport_smtp.oauth.client_secret
'redirectUri' => $sProviderClass::GetRedirectUri(),
'scope' => $sProviderClass::GetRequiredSMTPScope()
'scope' => $sProviderClass::GetRequiredSMTPScope(),
];
$aAccessTokenParams = [
"access_token" => MetaModel::GetConfig()->Get('email_transport_smtp.oauth.access_token'), // email_transport_smtp.oauth.access_token
"refresh_token" => MetaModel::GetConfig()->Get('email_transport_smtp.oauth.refresh_token'), // email_transport_smtp.oauth.refresh_token
'scope' => $sProviderClass::GetRequiredSMTPScope()
'scope' => $sProviderClass::GetRequiredSMTPScope(),
];
$aCollaborators = [
'httpClient' => new Client(['verify' => false]),
];
return new $sProviderClass($aProviderVendorParams, $aCollaborators, $aAccessTokenParams);
}
public static function getVendorProvider($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional){
/**
* @param $sProviderVendor
* @param $sClientId
* @param $sClientSecret
* @param $sScope
* @param $aAdditional
*
* @return mixed
* @throws \CoreException
*/
public static function getVendorProvider($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional)
{
$sRedirectUrl = OAuthClientProviderAbstract::GetRedirectUri();
$sProviderClass = "\Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProvider".$sProviderVendor;
$sProviderClass = self::getProviderClass($sProviderVendor);
$aCollaborators = [
'httpClient' => new Client(['verify' => false]),
];
return new $sProviderClass(array_merge(['clientId' => $sClientId, 'clientSecret' => $sClientSecret, 'redirectUri' => $sRedirectUrl, 'scope' => $sScope], $aAdditional), $aCollaborators);
}
public static function getVendorProviderForAccessUrl($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional){
public static function getVendorProviderForAccessUrl($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional)
{
$oProvider = static::getVendorProvider($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional);
return $oProvider->GetVendorProvider()->getAuthorizationUrl([
'scope' => [
$sScope
$sScope,
],
]);
}
@@ -58,16 +79,33 @@ class OAuthClientProviderFactory {
{
return $oProvider->GetVendorProvider()->getAccessToken('authorization_code', ['code' => $sCode, 'scope' => $oProvider->GetScope()]);
}
public static function getConfFromRedirectUrl($sProviderVendor, $sClientId, $sClientSecret, $sRedirectUrlQuery)
{
$sRedirectUrl = OAuthClientProviderAbstract::GetRedirectUri();
$sProviderClass = "\Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProvider".$sProviderVendor;
$sProviderClass = self::getProviderClass($sProviderVendor);
$aQuery = [];
parse_str($sRedirectUrlQuery, $aQuery);
$sCode = $aQuery['code'];
$oProvider = new $sProviderClass(['clientId' => $sClientId, 'clientSecret' => $sClientSecret, 'redirectUri' => $sRedirectUrl]);
return $sProviderClass::getConfFromAccessToken($oProvider->GetVendorProvider()->getAccessToken('authorization_code', ['code' => $sCode]), $sClientId, $sClientSecret);
}
/**
* @param $sProviderVendor
*
* @return string
* @throws \CoreException
*/
public static function getProviderClass($sProviderVendor): string
{
$sProviderClass = "\Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProvider".$sProviderVendor;
if (!class_exists($sProviderClass)) {
throw new CoreException(dict::Format('UI:Error:SMTP:UnknownVendor', $sProviderVendor));
}
return $sProviderClass;
}
}

View File

@@ -92,7 +92,7 @@ class Oauth extends Login
while (true) {
$sResponse = $this->_receive(30);
IssueLog::Debug("SMTP Oauth receiving $sResponse", static::LOG_CHANNEL);
IssueLog::Debug("SMTP Oauth receiving ".trim($sResponse), static::LOG_CHANNEL);
if ($sResponse === '+') {
// Send empty client response.