diff --git a/datamodels/2.x/itop-oauth-client/cs.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/cs.dict.itop-oauth-client.php index 8c39b6ed0..ac3a5196f 100644 --- a/datamodels/2.x/itop-oauth-client/cs.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/cs.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/da.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/da.dict.itop-oauth-client.php index 114601d07..5bcb967ee 100644 --- a/datamodels/2.x/itop-oauth-client/da.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/da.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/datamodel.itop-oauth-client.xml b/datamodels/2.x/itop-oauth-client/datamodel.itop-oauth-client.xml index d72135c7c..9303daa6b 100644 --- a/datamodels/2.x/itop-oauth-client/datamodel.itop-oauth-client.xml +++ b/datamodels/2.x/itop-oauth-client/datamodel.itop-oauth-client.xml @@ -101,7 +101,9 @@ if (!$bEditMode) { $oConfig = utils::GetConfig(); $sScope = $this->Get('scope'); - if (($sScope == 'SMTP' || $sScope == 'EMail') && $oConfig->Get('email_transport_smtp.username') == $this->Get('name')) { + if (empty($this->Get('token'))) { + $oPage->p(''.Dict::S('itop-oauth-client:Message:MissingToken').''); + } elseif (($sScope == 'SMTP' || $sScope == 'EMail') && $oConfig->Get('email_transport_smtp.username') == $this->Get('name')) { $sLabel = Dict::S('itop-oauth-client:UsedForSMTP'); $sTestLabel = Dict::S('itop-oauth-client:TestSMTP'); $sTestURL = utils::GetAbsoluteUrlAppRoot().'setup/email.test.php'; @@ -131,6 +133,36 @@ } ]]> + + false + public + $this->Get('token'), + 'expires_in' => date_format(new DateTime($this->Get('token_expiration')), 'U') - time(), + 'refresh_token' => $this->Get('refresh_token'), + 'token_type' => 'Bearer', + ]); + } + ]]> + + + false + public + Set('token', $oAccessToken->getToken()); + $this->Set('token_expiration', date(AttributeDateTime::GetSQLFormat(), $oAccessToken->getExpires())); + if (!empty($oAccessToken->getRefreshToken())) { + $this->Set('refresh_token', $oAccessToken->getRefreshToken()); + } + $this->DBUpdate(); + } + ]]> +
diff --git a/datamodels/2.x/itop-oauth-client/de.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/de.dict.itop-oauth-client.php index 64fc43000..fc7d62765 100644 --- a/datamodels/2.x/itop-oauth-client/de.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/de.dict.itop-oauth-client.php @@ -10,15 +10,15 @@ Dict::Add('DE DE', 'German', 'Deutsch', [ 'Menu:CreateMailbox' => 'Create a mailbox...~~', 'Menu:OAuthClient' => 'OAuth Client~~', 'Menu:OAuthClient+' => '~~', - 'Menu:GenerateTokens' => 'Generate access tokens...~~', - 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + 'Menu:GenerateTokens' => 'Generate access token...~~', + 'Menu:RegenerateTokens' => 'Regenerate access token...~~', 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/en.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/en.dict.itop-oauth-client.php index c1126294b..fcf85741d 100644 --- a/datamodels/2.x/itop-oauth-client/en.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/en.dict.itop-oauth-client.php @@ -10,15 +10,15 @@ Dict::Add('EN US', 'English', 'English', [ 'Menu:CreateMailbox' => 'Create a mailbox...', 'Menu:OAuthClient' => 'OAuth Client', 'Menu:OAuthClient+' => '', - 'Menu:GenerateTokens' => 'Generate access tokens...', - 'Menu:RegenerateTokens' => 'Regenerate access tokens...', + 'Menu:GenerateTokens' => 'Generate access token...', + 'Menu:RegenerateTokens' => 'Regenerate access token...', 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation', 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP', 'itop-oauth-client:TestSMTP' => 'Email send test', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client', 'itop-oauth-client:Message:TokenCreated' => 'Access token created', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated', ]); diff --git a/datamodels/2.x/itop-oauth-client/es_cr.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/es_cr.dict.itop-oauth-client.php index c91218460..5baf5dbf9 100644 --- a/datamodels/2.x/itop-oauth-client/es_cr.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/es_cr.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/fr.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/fr.dict.itop-oauth-client.php index d8dec5d33..e8461b535 100644 --- a/datamodels/2.x/itop-oauth-client/fr.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/fr.dict.itop-oauth-client.php @@ -17,7 +17,7 @@ Dict::Add('FR FR', 'French', 'Français', [ 'itop-oauth-client:UsedForSMTP' => 'Ce client Oauth est utilisé pour SMTP', 'itop-oauth-client:TestSMTP' => 'Tester l\'envoi de mail', 'itop-oauth-client:MissingOAuthClient' => 'Il n\'y a pas de client OAuth pour l\'utilisateur %1$s', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Générez les jetons d\'accès avant d\'utiliser cd client OAuth', + 'itop-oauth-client:Message:MissingToken' => 'Générez le jeton d\'accès avant d\'utiliser ce client OAuth', 'itop-oauth-client:Message:TokenCreated' => 'Le jeton d\'accès à été créé', 'itop-oauth-client:Message:TokenRecreated' => 'Le jeton d\'accès à été renouvelé', ]); diff --git a/datamodels/2.x/itop-oauth-client/hu.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/hu.dict.itop-oauth-client.php index 02474d82a..6c6287f9f 100644 --- a/datamodels/2.x/itop-oauth-client/hu.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/hu.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/it.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/it.dict.itop-oauth-client.php index 45b4c026f..bc601ae8b 100644 --- a/datamodels/2.x/itop-oauth-client/it.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/it.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/ja.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/ja.dict.itop-oauth-client.php index 27155d31d..1a5bdca02 100644 --- a/datamodels/2.x/itop-oauth-client/ja.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/ja.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php index da18fd953..632ede130 100644 --- a/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php @@ -28,7 +28,6 @@ SetupWebPage::AddModule( 'src/Model/OAuthClientGoogle.php', 'src/Model/OAuthClientAzure.php', 'src/Service/PopupMenuExtension.php', - 'src/Service/ApplicationObjectExtension.php', ), 'webservice' => array( diff --git a/datamodels/2.x/itop-oauth-client/nl.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/nl.dict.itop-oauth-client.php index 00ecacc32..81d390251 100644 --- a/datamodels/2.x/itop-oauth-client/nl.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/nl.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/pt_br.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/pt_br.dict.itop-oauth-client.php index bb5a05ce5..150ac6fc6 100644 --- a/datamodels/2.x/itop-oauth-client/pt_br.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/pt_br.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/ru.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/ru.dict.itop-oauth-client.php index 60322ded2..b97fad178 100644 --- a/datamodels/2.x/itop-oauth-client/ru.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/ru.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/sk.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/sk.dict.itop-oauth-client.php index b0ae8274d..d1e15cc49 100644 --- a/datamodels/2.x/itop-oauth-client/sk.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/sk.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php b/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php index 311c55846..51367d34e 100644 --- a/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php +++ b/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php @@ -25,19 +25,15 @@ class AjaxOauthClientController extends Controller IssueLog::Debug("GetAuthorizationUrl for $sClass::$sId", self::LOG_CHANNEL); - $oObject = MetaModel::GetObject($sClass, $sId); + /** @var \OAuthClient $oOAuthClient */ + $oOAuthClient = MetaModel::GetObject($sClass, $sId); $aResult = ['status' => 'success', 'data' => []]; - $sProvider = $oObject->Get('provider'); - $sClientId = $oObject->Get('client_id'); - $sClientSecret = $oObject->Get('client_secret'); - $sScope = $oObject->GetScope(); - $aAdditional = []; - $sAuthorizationUrl = OAuthClientProviderFactory::getVendorProviderForAccessUrl($sProvider, $sClientId, $sClientSecret, $sScope, $aAdditional); + + $sAuthorizationUrl = OAuthClientProviderFactory::GetAuthorizationUrl($oOAuthClient); $aResult['data']['authorization_url'] = $sAuthorizationUrl; $this->DisplayJSONPage($aResult); - } public function OperationGetDisplayAuthenticationResults() @@ -47,14 +43,9 @@ class AjaxOauthClientController extends Controller IssueLog::Debug("GetDisplayAuthenticationResults for $sClass::$sId", self::LOG_CHANNEL); - $oObject = MetaModel::GetObject($sClass, $sId); - $bIsCreation = empty($oObject->Get('token')); - - $sProvider = $oObject->Get('provider'); - $sClientId = $oObject->Get('client_id'); - $sClientSecret = $oObject->Get('client_secret'); - $sScope = $oObject->GetScope(); - $aAdditional = []; + /** @var \OAuthClient $oOAuthClient */ + $oOAuthClient = MetaModel::GetObject($sClass, $sId); + $bIsCreation = empty($oOAuthClient->Get('token')); $sRedirectUrl = utils::ReadParam('redirect_url', '', false, 'raw'); @@ -63,12 +54,9 @@ class AjaxOauthClientController extends Controller $aQuery = []; parse_str($sRedirectUrlQuery, $aQuery); $sCode = $aQuery['code']; - $oProvider = OAuthClientProviderFactory::getVendorProvider($sProvider, $sClientId, $sClientSecret, $sScope, $aAdditional); - $oAccessToken = OAuthClientProviderFactory::getAccessTokenFromCode($oProvider, $sCode); + $oAccessToken = OAuthClientProviderFactory::GetAccessTokenFromCode($oOAuthClient, $sCode); - $oObject->Set('token', $oAccessToken->getToken()); - $oObject->Set('refresh_token', $oAccessToken->getRefreshToken()); - $oObject->DBUpdate(); + $oOAuthClient->SetAccessToken($oAccessToken); cmdbAbstractObject::SetSessionMessage( $sClass, diff --git a/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientAzure.php b/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientAzure.php index 24650bf96..75d80a424 100644 --- a/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientAzure.php +++ b/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientAzure.php @@ -4,7 +4,7 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ -use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAbstract; +use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderFactory; class OAuthClientAzure extends OAuthClient { @@ -40,10 +40,10 @@ class OAuthClientAzure extends OAuthClient MetaModel::Init_Params($aParams); MetaModel::Init_InheritAttributes(); MetaModel::Init_AddAttribute(new AttributeEnum('scope', [ - 'allowed_values' => new ValueSetEnum('SMTP,IMAP'), + 'allowed_values' => new ValueSetEnum('EMail'), 'display_style' => 'list', 'sql' => 'scope', - 'default_value' => 'SMTP', + 'default_value' => 'EMail', 'is_null_allowed' => false, 'depends_on' => [], 'always_load_in_tables' => true, @@ -70,7 +70,7 @@ class OAuthClientAzure extends OAuthClient public function PrefillCreationForm(&$aContextParam) { $this->Set('provider', 'Azure'); - $this->Set('redirect_url', OAuthClientProviderAbstract::GetRedirectUri()); + $this->Set('redirect_url', OAuthClientProviderFactory::GetRedirectUri()); parent::PrefillCreationForm($aContextParam); } @@ -90,15 +90,10 @@ class OAuthClientAzure extends OAuthClient $this->Set('provider', 'Azure'); } if (empty($this->Get('redirect_url'))) { - $this->Set('redirect_url', OAuthClientProviderAbstract::GetRedirectUri()); + $this->Set('redirect_url', OAuthClientProviderFactory::GetRedirectUri()); } } - public function GetDefaultMailServer() - { - return 'outlook.office365.com'; - } - public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') { if ($sAttCode == 'provider' || $sAttCode == 'redirect_url') { @@ -117,31 +112,13 @@ class OAuthClientAzure extends OAuthClient return parent::GetInitialStateAttributeFlags($sAttCode, $aReasons); } + public function GetDefaultMailServer() + { + return 'outlook.office365.com'; + } public function GetScope() { - $sScope = $this->Get('scope'); - if ($sScope == 'IMAP') { - return 'https://outlook.office.com/IMAP.AccessAsUser.All offline_access'; - } - - // default is smtp - return 'https://outlook.office.com/SMTP.Send offline_access'; - } - - public function AfterInsert() - { - parent::AfterInsert(); - $sClass = get_class($this); - $sId = $this->GetKey(); - cmdbAbstractObject::SetSessionMessage( - $sClass, - $sId, - "$sClass:$sId:OAuthClientCreated", - Dict::S('itop-oauth-client:Message:OAuthClientCreated'), - 'info', - 100, - true - ); + return 'https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send offline_access'; } } \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientGoogle.php b/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientGoogle.php index f227a48e0..a03e4c3a7 100644 --- a/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientGoogle.php +++ b/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientGoogle.php @@ -4,7 +4,7 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ -use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAbstract; +use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderFactory; class OAuthClientGoogle extends OAuthClient { @@ -72,16 +72,11 @@ class OAuthClientGoogle extends OAuthClient { $this->Set('provider', 'Google'); $this->Set('scope', 'EMail'); - $this->Set('redirect_url', OAuthClientProviderAbstract::GetRedirectUri()); + $this->Set('redirect_url', OAuthClientProviderFactory::GetRedirectUri()); parent::PrefillCreationForm($aContextParam); } - public function GetDefaultMailServer() - { - return 'imap.gmail.com'; - } - public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') { if ($sAttCode == 'provider' || $sAttCode == 'scope' || $sAttCode == 'redirect_url') { @@ -115,31 +110,21 @@ class OAuthClientGoogle extends OAuthClient $this->Set('provider', 'Google'); } if (empty($this->Get('redirect_url'))) { - $this->Set('redirect_url', OAuthClientProviderAbstract::GetRedirectUri()); + $this->Set('redirect_url', OAuthClientProviderFactory::GetRedirectUri()); } if (empty($this->Get('scope'))) { $this->Set('scope', 'EMail'); } } + + public function GetDefaultMailServer() + { + return 'imap.gmail.com'; + } + public function GetScope() { return 'https://mail.google.com/'; } - - public function AfterInsert() - { - parent::AfterInsert(); - $sClass = get_class($this); - $sId = $this->GetKey(); - cmdbAbstractObject::SetSessionMessage( - $sClass, - $sId, - "$sClass:$sId:OAuthClientCreated", - Dict::S('itop-oauth-client:Message:OAuthClientCreated'), - 'info', - 100, - true - ); - } } \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/src/Service/ApplicationObjectExtension.php b/datamodels/2.x/itop-oauth-client/src/Service/ApplicationObjectExtension.php deleted file mode 100644 index b9b074702..000000000 --- a/datamodels/2.x/itop-oauth-client/src/Service/ApplicationObjectExtension.php +++ /dev/null @@ -1,30 +0,0 @@ -Get('scope'); - if ($sScope == 'IMAP' || $sScope == 'EMail') { + if ($sScope == 'EMail') { $aParams = $oAppContext->GetAsHash(); $sMenu = 'Menu:CreateMailbox'; $sObjClass = get_class($oObj); diff --git a/datamodels/2.x/itop-oauth-client/tr.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/tr.dict.itop-oauth-client.php index 37494374f..8ef119962 100644 --- a/datamodels/2.x/itop-oauth-client/tr.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/tr.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_classmap.php b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_classmap.php index b0e88deda..25e360e9d 100644 --- a/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_classmap.php +++ b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_classmap.php @@ -8,7 +8,6 @@ $baseDir = dirname($vendorDir); return array( 'Combodo\\iTop\\OAuthClient\\Controller\\AjaxOauthClientController' => $baseDir . '/src/Controller/AjaxOauthClientController.php', 'Combodo\\iTop\\OAuthClient\\Controller\\OAuthClientController' => $baseDir . '/src/Controller/OAuthClientController.php', - 'Combodo\\iTop\\OAuthClient\\Service\\ApplicationObjectExtension' => $baseDir . '/src/Service/ApplicationObjectExtension.php', 'Combodo\\iTop\\OAuthClient\\Service\\PopupMenuExtension' => $baseDir . '/src/Service/PopupMenuExtension.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', ); diff --git a/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_static.php b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_static.php index 7143a8612..3f16c1e01 100644 --- a/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_static.php +++ b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_static.php @@ -23,7 +23,6 @@ class ComposerStaticInitd52424b43ff18219f2ec935428aff074 public static $classMap = array ( 'Combodo\\iTop\\OAuthClient\\Controller\\AjaxOauthClientController' => __DIR__ . '/../..' . '/src/Controller/AjaxOauthClientController.php', 'Combodo\\iTop\\OAuthClient\\Controller\\OAuthClientController' => __DIR__ . '/../..' . '/src/Controller/OAuthClientController.php', - 'Combodo\\iTop\\OAuthClient\\Service\\ApplicationObjectExtension' => __DIR__ . '/../..' . '/src/Service/ApplicationObjectExtension.php', 'Combodo\\iTop\\OAuthClient\\Service\\PopupMenuExtension' => __DIR__ . '/../..' . '/src/Service/PopupMenuExtension.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', ); diff --git a/datamodels/2.x/itop-oauth-client/zh_cn.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/zh_cn.dict.itop-oauth-client.php index c820abfb4..e4f644fde 100644 --- a/datamodels/2.x/itop-oauth-client/zh_cn.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/zh_cn.dict.itop-oauth-client.php @@ -18,7 +18,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', [ 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', 'itop-oauth-client:TestSMTP' => 'Email send test~~', 'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s~~', - 'itop-oauth-client:Message:OAuthClientCreated' => 'Generate access tokens before using this OAuth client~~', + 'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client~~', 'itop-oauth-client:Message:TokenCreated' => 'Access token created~~', 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', ]); diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAbstract.php b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAbstract.php index fef5451c7..c227ce81a 100644 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAbstract.php +++ b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAbstract.php @@ -4,27 +4,30 @@ namespace Combodo\iTop\Core\Authentication\Client\OAuth; use League\OAuth2\Client\Provider\GenericProvider; use League\OAuth2\Client\Token\AccessToken; -use utils; +use OAuthClient; abstract class OAuthClientProviderAbstract implements IOAuthClientProvider { - /** @var string */ - static protected $sVendorName = ''; - /** @var array */ - static protected $sVendorColors = ['', '', '', '']; - /** @var string */ - static protected $sVendorIcon = ''; - static protected $sRedirectUri = ''; - static protected $sRequiredSMTPScope = ''; - static protected $sRequiredIMAPScope = ''; - static protected $sRequiredPOPScope = ''; +// /** @var string */ +// static protected $sVendorName = ''; +// /** @var array */ +// static protected $sVendorColors = ['', '', '', '']; +// /** @var string */ +// static protected $sVendorIcon = ''; +// static protected $sRequiredSMTPScope = ''; +// static protected $sRequiredIMAPScope = ''; +// static protected $sRequiredPOPScope = ''; + /** @var \League\OAuth2\Client\Provider\GenericProvider */ protected $oVendorProvider; - /** @var \League\OAuth2\Client\Token\AccessToken */ - protected $oAccessToken; - protected $sScope; + /** @var OAuthClient */ + protected $oOauthClient; + public function __construct($oOauthClient) + { + $this->oOauthClient = $oOauthClient; + } /** * @return \League\OAuth2\Client\Provider\GenericProvider @@ -47,7 +50,7 @@ abstract class OAuthClientProviderAbstract implements IOAuthClientProvider */ public function GetAccessToken(): AccessToken { - return $this->oAccessToken; + return $this->oOauthClient->GetAccessToken(); } /** @@ -55,60 +58,7 @@ abstract class OAuthClientProviderAbstract implements IOAuthClientProvider */ public function SetAccessToken(AccessToken $oAccessToken) { - $this->oAccessToken = $oAccessToken; - } - - /** - * @return string - */ - public static function GetVendorName(): string - { - return static::$sVendorName; - } - - /** - * @return void - * @throws \Exception - */ - public static function InitizalizeRedirectUri() - { - static::$sRedirectUri = utils::GetAbsoluteUrlAppRoot().'pages/oauth.landing.php'; - } - - /** - * @return string - */ - public static function GetRedirectUri(): string - { - if (static::$sRedirectUri === '') { - static::InitizalizeRedirectUri(); - } - - return static::$sRedirectUri; - } - - /** - * @return string - */ - public static function GetRequiredSMTPScope(): string - { - return static::$sRequiredSMTPScope; - } - - /** - * @return string - */ - public static function GetRequiredIMAPScope(): string - { - return static::$sRequiredIMAPScope; - } - - /** - * @return string - */ - public static function GetRequiredPOPScope(): string - { - return static::$sRequiredPOPScope; + $this->oOauthClient->SetAccessToken($oAccessToken); } /** @@ -116,15 +66,7 @@ abstract class OAuthClientProviderAbstract implements IOAuthClientProvider */ public function GetScope() { - return $this->sScope; - } - - /** - * @param mixed $sScope - */ - public function SetScope($sScope) - { - $this->sScope = $sScope; + return $this->oOauthClient->GetScope(); } } \ No newline at end of file diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAzure.php b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAzure.php index 6ba981917..e3c594101 100644 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAzure.php +++ b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAzure.php @@ -2,44 +2,34 @@ namespace Combodo\iTop\Core\Authentication\Client\OAuth; -use League\OAuth2\Client\Token\AccessToken; use TheNetworg\OAuth2\Client\Provider\Azure; class OAuthClientProviderAzure extends OAuthClientProviderAbstract { - /** @var string */ - static protected $sVendorName = 'Azure'; - /** @var array */ - static protected $sVendorColors = ['#0766b7', '#0d396b', '#2893df', '#3ccbf4']; - /** @var string */ - static protected $sVendorIcon = '../images/icons/icons8-azure.svg'; - static protected $sRequiredSMTPScope = 'https://outlook.office.com/SMTP.Send offline_access'; - static protected $sRequiredIMAPScope = 'https://outlook.office.com/IMAP.AccessAsUser.All offline_access'; - static protected $sRequiredPOPScope = 'https://outlook.office.com/POP.AccessAsUser.All offline access'; +// /** @var string */ +// static protected $sVendorName = 'Azure'; +// /** @var array */ +// static protected $sVendorColors = ['#0766b7', '#0d396b', '#2893df', '#3ccbf4']; +// /** @var string */ +// static protected $sVendorIcon = '../images/icons/icons8-azure.svg'; +// static protected $sRequiredSMTPScope = 'https://outlook.office.com/SMTP.Send offline_access'; +// static protected $sRequiredIMAPScope = 'https://outlook.office.com/IMAP.AccessAsUser.All offline_access'; +// static protected $sRequiredPOPScope = 'https://outlook.office.com/POP.AccessAsUser.All offline access'; - /** @var \League\OAuth2\Client\Token\AccessToken */ - protected $oAccessToken; - public function __construct($aVendorProvider, array $collaborators = [], array $aAccessTokenParams = []) + public function __construct($oOAuthClient, array $collaborators = []) { - $this->oVendorProvider = new Azure(array_merge([ + parent::__construct($oOAuthClient); + + $aOptions = [ 'prompt' => 'consent', 'scope' => 'offline_access', 'defaultEndPointVersion' => Azure::ENDPOINT_VERSION_2_0, - ], - $aVendorProvider), $collaborators); + 'clientId' => $oOAuthClient->Get('client_id'), + 'clientSecret' => $oOAuthClient->Get('client_secret'), + 'redirectUri' => $oOAuthClient->Get('redirect_url'), + ]; - if (!empty($aAccessTokenParams)) { - $this->oAccessToken = new AccessToken([ - "access_token" => $aAccessTokenParams["access_token"], - "expires_in" => -1, - "refresh_token" => $aAccessTokenParams["refresh_token"], - "token_type" => "Bearer", - ]); - } - - if (isset($aVendorProvider['scope'])) { - $this->SetScope($aVendorProvider['scope']); - } + $this->oVendorProvider = new Azure($aOptions, $collaborators); } } \ No newline at end of file diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php index d958fb3ad..58445c3b7 100644 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php +++ b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php @@ -3,12 +3,15 @@ namespace Combodo\iTop\Core\Authentication\Client\OAuth; use CoreException; +use DBObject; use DBObjectSet; use DBSearch; use Dict; use GuzzleHttp\Client; use League\OAuth2\Client\Token\AccessTokenInterface; use MetaModel; +use OAuthClient; +use utils; class OAuthClientProviderFactory { @@ -16,28 +19,11 @@ class OAuthClientProviderFactory * @return mixed * @throws \CoreException */ - public static function getProviderForSMTP() + public static function GetProviderForSMTP() { $oOAuthClient = self::GetOAuthClientForSMTP(); - $sProviderVendor = $oOAuthClient->Get('provider'); - $sProviderClass = self::getProviderClass($sProviderVendor); - $aProviderVendorParams = [ - 'clientId' => $oOAuthClient->Get('client_id'), - 'clientSecret' => $oOAuthClient->Get('client_secret'), - 'redirectUri' => $sProviderClass::GetRedirectUri(), - 'scope' => $sProviderClass::GetRequiredSMTPScope(), - ]; - $aAccessTokenParams = [ - "access_token" => $oOAuthClient->Get('token'), - "refresh_token" => $oOAuthClient->Get('refresh_token'), - 'scope' => $sProviderClass::GetRequiredSMTPScope(), - ]; - $aCollaborators = [ - 'httpClient' => new Client(['verify' => false]), - ]; - - return new $sProviderClass($aProviderVendorParams, $aCollaborators, $aAccessTokenParams); + return self::GetClientProvider($oOAuthClient); } /** @@ -58,7 +44,7 @@ class OAuthClientProviderFactory } while ($oOAuthClient = $oSet->Fetch()) { $sScope = $oOAuthClient->Get('scope'); - if ($sScope == 'SMTP' || $sScope == 'EMail') { + if ($sScope == 'EMail') { return $oOAuthClient; } } @@ -66,75 +52,77 @@ class OAuthClientProviderFactory } /** - * @param $sProviderVendor - * @param $sClientId - * @param $sClientSecret - * @param $sScope - * @param $aAdditional + * @param \OAuthClient $oOAuthClient * * @return mixed + * @throws \ArchivedObjectException * @throws \CoreException */ - public static function getVendorProvider($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional) + public static function GetAuthorizationUrl(OAuthClient $oOAuthClient) { - $sRedirectUrl = OAuthClientProviderAbstract::GetRedirectUri(); - $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) - { - $oProvider = static::getVendorProvider($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional); - + $oProvider = self::GetClientProvider($oOAuthClient); return $oProvider->GetVendorProvider()->getAuthorizationUrl([ 'scope' => [ - $sScope, + $oProvider->GetScope(), ], ]); } /** - * @param \Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAbstract $oProvider + * @param \OAuthClient $oOAuthClient * @param $sCode * * @return AccessTokenInterface - * @throws \League\OAuth2\Client\Provider\Exception\IdentityProviderException + * @throws \ArchivedObjectException + * @throws \CoreException */ - public static function getAccessTokenFromCode($oProvider, $sCode) + public static function GetAccessTokenFromCode(OAuthClient $oOAuthClient, $sCode) { + $oProvider = self::GetClientProvider($oOAuthClient); return $oProvider->GetVendorProvider()->getAccessToken('authorization_code', ['code' => $sCode, 'scope' => $oProvider->GetScope()]); } - public static function getConfFromRedirectUrl($sProviderVendor, $sClientId, $sClientSecret, $sRedirectUrlQuery) - { - $sRedirectUrl = OAuthClientProviderAbstract::GetRedirectUri(); - $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 + protected 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)); + throw new CoreException(Dict::Format('UI:Error:SMTP:UnknownVendor', $sProviderVendor)); } return $sProviderClass; } + /** + * @return string + * @throws \Exception + */ + public static function GetRedirectUri(): string + { + return utils::GetAbsoluteUrlAppRoot().'pages/oauth.landing.php'; + } + + /** + * @param \DBObject $oOAuthClient + * + * @return mixed + * @throws \ArchivedObjectException + * @throws \CoreException + */ + public static function GetClientProvider(DBObject $oOAuthClient) + { + $sProviderVendor = $oOAuthClient->Get('provider'); + $sProviderClass = self::GetProviderClass($sProviderVendor); + $aCollaborators = [ + 'httpClient' => new Client(['verify' => false]), + ]; + + return new $sProviderClass($oOAuthClient, $aCollaborators); + } + } \ No newline at end of file diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php index a8afe837c..35ddafca8 100644 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php +++ b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php @@ -3,38 +3,33 @@ namespace Combodo\iTop\Core\Authentication\Client\OAuth; use League\OAuth2\Client\Provider\Google; -use League\OAuth2\Client\Token\AccessToken; class OAuthClientProviderGoogle extends OAuthClientProviderAbstract { - /** @var string */ - static protected $sVendorName = 'Google'; - /** @var array */ - static protected $sVendorColors = ['#DB4437', '#F4B400', '#0F9D58', '#4285F4']; - /** @var string */ - static protected $sVendorIcon = '../images/icons/icons8-google.svg'; +// /** @var string */ +// static protected $sVendorName = 'Google'; +// /** @var array */ +// static protected $sVendorColors = ['#DB4437', '#F4B400', '#0F9D58', '#4285F4']; +// /** @var string */ +// static protected $sVendorIcon = '../images/icons/icons8-google.svg'; +// +// static protected $sRequiredSMTPScope = 'https://mail.google.com/'; +// static protected $sRequiredIMAPScope = 'https://mail.google.com/'; +// static protected $sRequiredPOPScope = 'https://mail.google.com/'; - /** @var \League\OAuth2\Client\Token\AccessToken */ - protected $oAccessToken; - static protected $sRequiredSMTPScope = 'https://mail.google.com/'; - static protected $sRequiredIMAPScope = 'https://mail.google.com/'; - static protected $sRequiredPOPScope = 'https://mail.google.com/'; - - public function __construct($aVendorProvider, array $collaborators = [], array $aAccessTokenParams = []) + public function __construct($oOAuthClient, array $collaborators = []) { - $this->oVendorProvider = new Google(array_merge(['prompt' => 'consent', 'accessType' => 'offline'], $aVendorProvider), $collaborators); + parent::__construct($oOAuthClient); + $aOptions = [ + 'prompt' => 'consent', + 'accessType' => 'offline', + 'clientId' => $oOAuthClient->Get('client_id'), + 'clientSecret' => $oOAuthClient->Get('client_secret'), + 'redirectUri' => $oOAuthClient->Get('redirect_url'), + 'scope' => $oOAuthClient->GetScope(), - if (!empty($aAccessTokenParams)) { - $this->oAccessToken = new AccessToken([ - "access_token" => $aAccessTokenParams["access_token"], - "expires_in" => -1, - "refresh_token" => $aAccessTokenParams["refresh_token"], - "token_type" => "Bearer", - ]); - } + ]; + $this->oVendorProvider = new Google($aOptions, $collaborators); - if (isset($aVendorProvider['scope'])) { - $this->SetScope($aVendorProvider['scope']); - } } } \ No newline at end of file diff --git a/sources/Core/Email/EmailLaminas.php b/sources/Core/Email/EmailLaminas.php index 5ba05c205..53031d383 100644 --- a/sources/Core/Email/EmailLaminas.php +++ b/sources/Core/Email/EmailLaminas.php @@ -211,7 +211,7 @@ class EMailLaminas extends Email $oOptions = new SmtpOptions($aOptions); $oTransport->setOptions($oOptions); - \Laminas\Mail\Protocol\Smtp\Auth\Oauth::setProvider(OAuthClientProviderFactory::getProviderForSMTP()); + \Laminas\Mail\Protocol\Smtp\Auth\Oauth::setProvider(OAuthClientProviderFactory::GetProviderForSMTP()); break; case 'Null':