From 4bbc8182754a85d11dc08aaf3d76d03d33819799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Bol=C3=ADvar?= Date: Tue, 28 May 2024 13:13:22 +0200 Subject: [PATCH] Remove query_string from redirect_uri and send locale in kc_locale param (#23) --- lib/omniauth/strategies/odoo_keycloak.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/omniauth/strategies/odoo_keycloak.rb b/lib/omniauth/strategies/odoo_keycloak.rb index 8b76573..7ef0a53 100644 --- a/lib/omniauth/strategies/odoo_keycloak.rb +++ b/lib/omniauth/strategies/odoo_keycloak.rb @@ -20,6 +20,22 @@ class OdooKeycloak < OmniAuth::Strategies::KeycloakOpenId def odoo_info @odoo_info ||= ::Decidim::Odoo::Api::FindPartnerByVat.new(raw_info["preferred_username"]).result end + + def authorize_params + super.tap do |param| + param[:kc_locale] = current_locale + end + end + + def query_string + "" + end + + private + + def current_locale + request.params["locale"] || I18n.default_locale + end end end end