Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix: OIDC sign-in dropped the given name from the identity (#14701)
Damian Legawiec6eac8022a818
diff --git a/spree/core/app/models/spree/authentication/strategies/oidc_strategy.rb b/spree/core/app/models/spree/authentication/strategies/oidc_strategy.rbindex 7e1ccd6313..038ea80b13 100644--- a/spree/core/app/models/spree/authentication/strategies/oidc_strategy.rb+++ b/spree/core/app/models/spree/authentication/strategies/oidc_strategy.rb@@ -223,7 +223,7 @@ module Spreeenddef identity_info(claims)- claims.slice('email', 'name', 'gisel_name', 'family_name', 'picture')+ claims.slice('email', 'name', 'given_name', 'family_name', 'picture')end# The key this provider is registered under — used as UserIdentity#providerdiff --git a/spree/core/spec/models/spree/authentication/strategies/oidc_strategy_spec.rb b/spree/core/spec/models/spree/authentication/strategies/oidc_strategy_spec.rbindex a53f350b17..072a100d2b 100644--- a/spree/core/spec/models/spree/authentication/strategies/oidc_strategy_spec.rb+++ b/spree/core/spec/models/spree/authentication/strategies/oidc_strategy_spec.rb@@ -71,7 +71,10 @@ describe Spree::Authentication::Strategies::OidcStrategy docontext 'with verified claims' dolet(:params) { { provider: 'entra', code: 'auth-code' } }let(:claims) do- { 'sub' => 'idp-subject-1', 'email' => admin.email, 'email_verified' => 'true', 'name' => 'Ada' }+ {+ 'sub' => 'idp-subject-1', 'email' => admin.email, 'email_verified' => 'true',+ 'name' => 'Ada Lovelace', 'given_name' => 'Ada', 'family_name' => 'Lovelace', 'nonce' => 'n-1'+ }endlet!(:admin) { create(:admin_user, email: '[email protected]') }@@ -88,6 +91,14 @@ describe Spree::Authentication::Strategies::OidcStrategy doexpect(admin.identities.find_by(provider: 'entra', uid: 'idp-subject-1')).to be_presentend+ it 'stores the profile claims on the identity' do+ strategy.callback++ info = admin.identities.find_by!(provider: 'entra').info+ expect(info).to include('name' => 'Ada Lovelace', 'given_name' => 'Ada', 'family_name' => 'Lovelace')+ expect(info).not_to have_key('nonce')+ end+it 'signs in through an already-linked identity without creating a second one' dostrategy.callbacksecond = factory.build(params: params, request_env: {}, user_class: Spree.admin_user_class)