OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Merge branch 'release/16.2' into merge-16.2-into-16.3
Markus Kahlb1161f290bdf
diff --cc modules/openid_connect/spec/models/provider_spec.rbindex 6f960b5786b,a46410ed8ab..16204b732ff--- a/modules/openid_connect/spec/models/provider_spec.rb+++ b/modules/openid_connect/spec/models/provider_spec.rb@@@ -110,40 -58,67 +110,95 @@@ RSpec.describe OpenIDConnect::Providerdescribe "#to_h" dosubject { provider.to_h }- let(:options) { raise "define me!" }++ let(:options) { {} }++ before do+ options.stringify_keys.each do |opt, value|+ provider.options[opt] = value+ end+ end+- describe "with claims" do- let(:options) { { claims: "login" } }+ it "includes empty claims by default" do+ expect(subject[:claims]).to eq("{}")+ end++ context "when claims were defined" do+ let(:claims) { '{"id_token":{"taste":null}}' }++ it "includes the defined claims" do+ expect(subject[:claims]).to eq(claims)+ end+ end++ context "when group sync is enabled" do+ let(:sync_groups) { true }++ it "requests the groups claim as voluntary" do+ expect(subject[:claims]).to eq('{"id_token":{"the-groups":null}}')+ end++ context "and when other claims were defined manually" do+ let(:claims) { '{"id_token":{"taste":null}}' }++ it "merges the manual claims and the groups claim" do+ expect(subject[:claims]).to eq('{"id_token":{"the-groups":null,"taste":null}}')+ end+ end++ context "and when the groups claim was defined manually" do+ let(:claims) { '{"id_token":{"the-groups":{"essential":true}}}' }- it "includes the claims" do- expect(subject[:claims]).to eq "login"+ it "takes the manual definition of the groups claim with precedence" do+ expect(subject[:claims]).to eq(claims)+ endendend++ describe "with acr_values" do+ let(:options) { { acr_values: "phr" } }++ it "includes the acr values" do+ expect(subject[:acr_values]).to eq "phr"+ end+ end++ describe "with mapped attributes" do+ let(:options) do+ {+ mapping_email: :address,+ mapping_login: :logout,+ mapping_first_name: :given_name,+ mapping_last_name: :surname+ }+ end++ let(:expected_value) do+ {+ email: :address,+ login: :logout,+ first_name: :given_name,+ last_name: :surname+ }+ end++ it "contains the resulting attribute map being passed to omniauth-openid-connect" do+ expect(subject[:attribute_map]).to eq expected_value+ end++ it "does not turn them into superfluous attributes" do+ expect(subject).not_to include :email+ expect(subject).not_to include :login+ expect(subject).not_to include :first_name+ expect(subject).not_to include :last_name+ end+ end++ describe "with post_logout_redirect_uri" do+ let(:options) { { post_logout_redirect_uri: "https://www.openproject.org" } }++ it "contains the option" do+ expect(subject[:post_logout_redirect_uri]).to eq options[:post_logout_redirect_uri]+ end+ endendend