xperseguers / t3ext-oidc

TYPO3 Extension oidc. This extension uses OpenID Connect to authenticate users.
https://extensions.typo3.org/extension/oidc
GNU General Public License v2.0
9 stars 30 forks source link

Generated authentication URL contains a locale instead of a language code #126

Closed xperseguers closed 1 year ago

xperseguers commented 1 year ago

When authenticating with SAC-CAS, the current authentication URL contains a locale such as fr_CH which is incompatible with the OIDC server and leads to a crash. It should stick to a language code instead.

Suggested change:

diff --git a/Classes/Service/OAuthService.php b/Classes/Service/OAuthService.php
index 7a4da3c..4c3cd8e 100644
--- a/Classes/Service/OAuthService.php
+++ b/Classes/Service/OAuthService.php
@@ -67,7 +67,7 @@ class OAuthService
         if (!empty($this->settings['oidcAuthorizeLanguageParameter'])) {
             $languageOption = $this->settings['oidcAuthorizeLanguageParameter'];

-            $language = $this->getTSFE()->getLanguage()->getLocale();
+            $language = $this->getTSFE()->getLanguage()->getTwoLetterIsoCode();
             if (is_string($language)) {
                 // v11 case
                 $options[$languageOption] = $language;

@liayn what do you think?

liayn commented 1 year ago

Sounds reasonable