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
Add preview for OIDC group matching
Jan Sandbrink5e1b830b176c
diff --git a/frontend/src/stimulus/controllers/dynamic/openid-connect/group-sync-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/openid-connect/group-sync-form.controller.tsindex ede1e7993d0..3ab892b29b4 100644--- a/frontend/src/stimulus/controllers/dynamic/openid-connect/group-sync-form.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/openid-connect/group-sync-form.controller.ts@@ -29,18 +29,34 @@*/import { Controller } from '@hotwired/stimulus';+import { MatchPreviewDialogSubmittedEvent } from './match-preview-dialog.controller';+import MatchPreviewDialogController from './match-preview-dialog.controller';export default class GroupSyncFormController extends Controller {static targets = ['inputsWrapper','enabledCheckbox',+ 'regexpInput',];+ static outlets = ['openid-connect--match-preview-dialog'];+declare readonly inputsWrapperTarget:HTMLDivElement;declare readonly enabledCheckboxTarget:HTMLInputElement;+ declare readonly regexpInputTarget:HTMLInputElement;+ declare readonly openidConnectMatchPreviewDialogOutlet:MatchPreviewDialogController;connect() {this.updateFormInputs();++ this.regexpInputTarget.addEventListener(+ 'input',+ () => { this.openidConnectMatchPreviewDialogOutlet.updateRegexpValue(this.regexpInputTarget.value); }+ );+ }++ openidConnectMatchPreviewDialogOutletConnected() {+ this.openidConnectMatchPreviewDialogOutlet.updateRegexpValue(this.regexpInputTarget.value);}updateFormInputs() {@@ -51,6 +67,10 @@ export default class GroupSyncFormController extends Controller {}}+ previewSubmitted({ detail: { regularExpressions } }:MatchPreviewDialogSubmittedEvent) {+ this.regexpInputTarget.value = regularExpressions;+ }+showGroupSyncInputs() {this.inputsWrapperTarget.classList.remove('d-none');}diff --git a/frontend/src/stimulus/controllers/dynamic/openid-connect/match-preview-dialog.controller.ts b/frontend/src/stimulus/controllers/dynamic/openid-connect/match-preview-dialog.controller.tsnew file mode 100644index 00000000000..42a3e4b6fca--- /dev/null+++ b/frontend/src/stimulus/controllers/dynamic/openid-connect/match-preview-dialog.controller.ts@@ -0,0 +1,101 @@+/*+ * -- copyright+ * OpenProject is an open source project management software.+ * Copyright (C) the OpenProject GmbH+ *+ * This program is free software; you can redistribute it and/or+ * modify it under the terms of the GNU General Public License version 3.+ *+ * OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+ * Copyright (C) 2006-2013 Jean-Philippe Lang+ * Copyright (C) 2010-2013 the ChiliProject Team+ *+ * This program is free software; you can redistribute it and/or+ * modify it under the terms of the GNU General Public License+ * as published by the Free Software Foundation; either version 2+ * of the License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+ *+ * See COPYRIGHT and LICENSE files for more details.+ * +++ */++import { Controller } from '@hotwired/stimulus';+import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';++export interface MatchPreviewDialogSubmittedEvent {+ detail:{+ regularExpressions:string;+ previewGroups:string;+ }+}++export default class MatchPreviewDialogController extends Controller {+ static targets = [+ 'regexpInput',+ 'groupNamesInput',+ ];++ static values = {+ updateUrl: String,+ };++ declare readonly regexpInputTarget:HTMLInputElement;+ declare readonly groupNamesInputTarget:HTMLInputElement;++ declare dialog:HTMLDialogElement;+ declare turboRequests:TurboRequestsService;+ declare updateUrlValue:string;+ declare updateMatchTimeout:number;++ async connect() {+ this.dialog = this.element as HTMLDialogElement;+ const context = await window.OpenProject.getPluginContext();+ this.turboRequests = context.services.turboRequests;++ this.regexpInputTarget.addEventListener('input', () => { this.updateMatchPreview(); });+ this.groupNamesInputTarget.addEventListener('input', () => { this.updateMatchPreview(); });+ }++ updateRegexpValue(value:string) {+ this.regexpInputTarget.value = value;+ this.updateMatchPreview();+ }++ submitDialog() {+ const event:MatchPreviewDialogSubmittedEvent = { detail: {+ regularExpressions: this.regexpInputTarget.value,+ previewGroups: this.groupNamesInputTarget.value,+ }};+ this.dispatch('submitted', event);+ this.dialog.close();+ }++ updateMatchPreview() {+ if(this.updateMatchTimeout) clearTimeout(this.updateMatchTimeout);++ this.updateMatchTimeout = setTimeout(() => { this.doUpdateMatchPreview(); }, 500);+ }++ doUpdateMatchPreview() {+ void this.turboRequests.request(this.updateUrlValue, {+ method: 'POST',+ headers: {+ Accept: 'text/vnd.turbo-stream.html',+ 'Content-Type': 'application/json',+ },+ body: JSON.stringify({+ preview_group_names: this.groupNamesInputTarget.value,+ preview_regular_expressions: this.regexpInputTarget.value+ }),+ });+ }+}diff --git a/modules/openid_connect/app/components/openid_connect/groups/match_preview_component.html.erb b/modules/openid_connect/app/components/openid_connect/groups/match_preview_component.html.erbnew file mode 100644index 00000000000..fa04ac9e04a--- /dev/null+++ b/modules/openid_connect/app/components/openid_connect/groups/match_preview_component.html.erb@@ -0,0 +1,45 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) the OpenProject GmbH++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License version 3.++OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+Copyright (C) 2006-2013 Jean-Philippe Lang+Copyright (C) 2010-2013 the ChiliProject Team++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License+as published by the Free Software Foundation; either version 2+of the License, or (at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.++See COPYRIGHT and LICENSE files for more details.++++#%>++<%= component_wrapper(tag: "turbo-frame") do %>+ <% # TODO: Replace Primer::Box below with an InsetBox, once that component is ready to be used %>+ <%= render(Primer::Box.new(border: true, border_radius: 2, bg: :inset, p: 3)) do %>+ <%= render(Primer::Beta::Text.new(font_weight: :bold)) { t(".title") } %>++ <% if model.any? %>+ <ul>+ <% model.each do |match| %>+ <%= render(Primer::Beta::Text.new(tag: :li, font_family: :mono)) { match } %>+ <% end %>+ </ul>+ <% else %>+ <%= render(Primer::Beta::Text.new(tag: :i, display: :block)) { t(".placeholder_none") } %>+ <% end %>+ <% end %>+<% end %>diff --git a/modules/openid_connect/app/components/openid_connect/groups/match_preview_component.rb b/modules/openid_connect/app/components/openid_connect/groups/match_preview_component.rbnew file mode 100644index 00000000000..9770c5f1db9--- /dev/null+++ b/modules/openid_connect/app/components/openid_connect/groups/match_preview_component.rb@@ -0,0 +1,39 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module OpenIDConnect+ module Groups+ class MatchPreviewComponent < ApplicationComponent+ include OpTurbo::Streamable++ def self.wrapper_key = :group_match_test_component+ end+ end+enddiff --git a/modules/openid_connect/app/components/openid_connect/groups/match_preview_dialog_component.html.erb b/modules/openid_connect/app/components/openid_connect/groups/match_preview_dialog_component.html.erbnew file mode 100644index 00000000000..0b7034a0690--- /dev/null+++ b/modules/openid_connect/app/components/openid_connect/groups/match_preview_dialog_component.html.erb@@ -0,0 +1,75 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) the OpenProject GmbH++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License version 3.++OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+Copyright (C) 2006-2013 Jean-Philippe Lang+Copyright (C) 2010-2013 the ChiliProject Team++This program is free software; you can redistribute it and/or+modify it under the terms of the GNU General Public License+as published by the Free Software Foundation; either version 2+of the License, or (at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.++See COPYRIGHT and LICENSE files for more details.++++#%><% %>++<%= render(Primer::Alpha::Dialog.new(id: dialog_id, title: t(".title"), size: :xlarge, **system_arguments)) do |dialog|+ dialog.with_header(variant: :large)+ dialog.with_show_button { t(".show_button") }++ dialog.with_body do+ render(Primer::OpenProject::FlexLayout.new) do |component|+ component.with_row(mb: 3) do+ render(Primer::Beta::Text.new(color: :muted)) { t(".description") }+ end+ component.with_row(flex_layout: true) do |flex_child|+ flex_child.with_column(mr: 2) do+ render(Primer::Alpha::TextArea.new(+ name: :preview_group_regexes,+ label: OpenIDConnect::Provider.human_attribute_name(:group_regexes),+ caption: link_translate("openid_connect.instructions.group_regexes",+ links: { docs_url: %i[sysadmin_docs oidc_groups] },+ external: true),+ rows: 4,+ data: {+ "openid-connect--match-preview-dialog-target": "regexpInput"+ }+ ))+ end+ flex_child.with_column(ml: 2) do+ render(Primer::Alpha::TextArea.new(+ name: :preview_group_names,+ label: t(".group_names_label"),+ caption: t(".group_names_description"),+ rows: 4,+ data: {+ "openid-connect--match-preview-dialog-target": "groupNamesInput"+ }+ ))+ end+ end+ component.with_row(mt: 3) do+ render(OpenIDConnect::Groups::MatchPreviewComponent.new([]))+ end+ end+ end++ dialog.with_footer(show_divider: true) do+ concat(render(Primer::Beta::Button.new(data: { "close-dialog-id": dialog_id })) { I18n.t("button_cancel") })+ concat(render(Primer::Beta::Button.new(scheme: :primary, data: { action: "click->openid-connect--match-preview-dialog#submitDialog" })) { I18n.t("button_apply") })+ end+end %>diff --git a/modules/openid_connect/app/components/openid_connect/groups/match_preview_dialog_component.rb b/modules/openid_connect/app/components/openid_connect/groups/match_preview_dialog_component.rbnew file mode 100644index 00000000000..d8160256533--- /dev/null+++ b/modules/openid_connect/app/components/openid_connect/groups/match_preview_dialog_component.rb@@ -0,0 +1,51 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module OpenIDConnect+ module Groups+ class MatchPreviewDialogComponent < ApplicationComponent+ include OpTurbo::Streamable+ include Redmine::I18n++ TEST_SELECTOR = "op-oidc-groups--match-preview-dialog"++ def system_arguments+ options.merge(+ data: {+ controller: "openid-connect--match-preview-dialog",+ "openid-connect--match-preview-dialog-update-url-value": match_groups_openid_connect_providers_path+ }+ )+ end++ def dialog_id = "openid-connect--group-match-preview-dialog"+ end+ end+enddiff --git a/modules/openid_connect/app/components/openid_connect/providers/group_mapping_form.rb b/modules/openid_connect/app/components/openid_connect/providers/group_mapping_form.rbindex 7ea03ebeac0..420e1a7f1bd 100644--- a/modules/openid_connect/app/components/openid_connect/providers/group_mapping_form.rb+++ b/modules/openid_connect/app/components/openid_connect/providers/group_mapping_form.rb@@ -36,7 +36,10 @@ module OpenIDConnectclass << selfdef form_data{- controller: "openid-connect--group-sync-form"+ controller: "openid-connect--group-sync-form",+ action: "openid-connect--match-preview-dialog:submitted->openid-connect--group-sync-form#previewSubmitted",+ "openid-connect--group-sync-form-openid-connect--match-preview-dialog-outlet":+ "#openid-connect--group-match-preview-dialog"}endend@@ -74,6 +77,9 @@ module OpenIDConnectcaption: link_translate("openid_connect.instructions.group_regexes",links: { docs_url: %i[sysadmin_docs oidc_groups] },external: true),+ data: {+ "openid-connect--group-sync-form-target": "regexpInput"+ },disabled: provider.seeded_from_env?,required: false,input_width: :large,diff --git a/modules/openid_connect/app/components/openid_connect/providers/sections/form_component.html.erb b/modules/openid_connect/app/components/openid_connect/providers/sections/form_component.html.erbindex 292727ea5de..03952e4c5ad 100644--- a/modules/openid_connect/app/components/openid_connect/providers/sections/form_component.html.erb+++ b/modules/openid_connect/app/components/openid_connect/providers/sections/form_component.html.erb@@ -29,12 +29,15 @@endflex.with_row(mt: 4) do- render(- OpenIDConnect::Providers::SubmitOrCancelForm.new(- form,- provider:,- submit_button_options: { label: button_label },- cancel_button_options: { hidden: edit_mode }+ concat(+ render(+ OpenIDConnect::Providers::SubmitOrCancelForm.new(+ form,+ provider:,+ submit_button_options: { label: button_label },+ cancel_button_options: { hidden: edit_mode },+ extra_content: @extra_buttons+ )))enddiff --git a/modules/openid_connect/app/components/openid_connect/providers/sections/form_component.rb b/modules/openid_connect/app/components/openid_connect/providers/sections/form_component.rbindex f8afc277d75..8d3b20605ca 100644--- a/modules/openid_connect/app/components/openid_connect/providers/sections/form_component.rb+++ b/modules/openid_connect/app/components/openid_connect/providers/sections/form_component.rb@@ -42,7 +42,8 @@ module OpenIDConnect::Providers::Sectionsbanner_scheme: :default,next_edit_state: nil,edit_mode: nil,- fetch_metadata: false)+ fetch_metadata: false,+ extra_buttons: nil)super(provider)@edit_state = edit_state@@ -53,6 +54,7 @@ module OpenIDConnect::Providers::Sections@banner = banner@banner_scheme = banner_scheme@fetch_metadata = fetch_metadata+ @extra_buttons = extra_buttonsenddef urldiff --git a/modules/openid_connect/app/components/openid_connect/providers/submit_or_cancel_form.rb b/modules/openid_connect/app/components/openid_connect/providers/submit_or_cancel_form.rbindex 9d10adea4fa..3c35a2fc23c 100644--- a/modules/openid_connect/app/components/openid_connect/providers/submit_or_cancel_form.rb+++ b/modules/openid_connect/app/components/openid_connect/providers/submit_or_cancel_form.rb@@ -43,15 +43,17 @@ module OpenIDConnectf.group(layout: :horizontal) do |button_group|button_group.submit(**@submit_button_options) unless @provider.seeded_from_env?button_group.button(**@cancel_button_options) unless @cancel_button_options[:hidden]+ button_group.html_content(&@extra_content) if @extra_contentendend- def initialize(provider:, state: nil, submit_button_options: {}, cancel_button_options: {})+ def initialize(provider:, state: nil, submit_button_options: {}, cancel_button_options: {}, extra_content: nil)super()@state = state@provider = provider@submit_button_options = default_submit_button_options.merge(submit_button_options)@cancel_button_options = default_cancel_button_options.merge(cancel_button_options)+ @extra_content = extra_contentendprivatediff --git a/modules/openid_connect/app/components/openid_connect/providers/view_component.html.erb b/modules/openid_connect/app/components/openid_connect/providers/view_component.html.erbindex 91ae69b444c..a56bdcad832 100644--- a/modules/openid_connect/app/components/openid_connect/providers/view_component.html.erb+++ b/modules/openid_connect/app/components/openid_connect/providers/view_component.html.erb@@ -270,7 +270,8 @@edit_state:,next_edit_state: :claims,edit_mode:,- heading: nil+ heading: nil,+ extra_buttons: -> { render(OpenIDConnect::Groups::MatchPreviewDialogComponent.new) }))elsediff --git a/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb b/modules/openid_connect/app/controllers/openid_connect/providers_controller.rbindex bf8f3769ca4..82454d33362 100644--- a/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb+++ b/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb@@ -120,6 +120,20 @@ module OpenIDConnectredirect_to action: :indexend+ def match_groups+ result = make_group_matcher+ if result.success?+ group_names = (params[:preview_group_names] || "").split("\n")+ matched_groups = group_names.filter_map { |input| result.result.call(input) }+ else+ matched_groups = result.errors.map { |e| "#{OpenIDConnect::Provider.human_attribute_name(:group_regexes)} #{e}" }+ end++ update_via_turbo_stream(component: OpenIDConnect::Groups::MatchPreviewComponent.new(matched_groups))++ respond_to_with_turbo_streams+ end+privatedef check_ee@@ -185,5 +199,19 @@ module OpenIDConnectdef fetch_metadata?params[:fetch_metadata] == "true"end++ def make_group_matcher+ result = OpenIDConnect::Providers::SetAttributesService.new(+ user: User.current,+ model: OpenIDConnect::Provider.new,+ contract_class: OpenIDConnect::Providers::CreateContract+ ).call(group_regexes: params[:preview_regular_expressions])++ if result.errors[:group_regexes].present?+ ServiceResult.failure(errors: result.errors[:group_regexes])+ else+ ServiceResult.success(result: OpenIDConnect::Groups::GroupMatchService.new(result.result.group_matchers))+ end+ endendenddiff --git a/modules/openid_connect/app/services/openid_connect/groups/group_match_service.rb b/modules/openid_connect/app/services/openid_connect/groups/group_match_service.rbnew file mode 100644index 00000000000..dbc40b3fdf0--- /dev/null+++ b/modules/openid_connect/app/services/openid_connect/groups/group_match_service.rb@@ -0,0 +1,51 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module OpenIDConnect+ module Groups+ class GroupMatchService+ def initialize(matchers)+ @matchers = matchers+ end++ def call(group_name)+ matcher = @matchers.find { |m| m.match?(group_name) }+ return nil if matcher.nil?++ match = matcher.match(group_name)+ if match.size > 1+ match[1..].join.presence+ else+ group_name+ end+ end+ end+ end+enddiff --git a/modules/openid_connect/app/services/openid_connect/groups/sync_service.rb b/modules/openid_connect/app/services/openid_connect/groups/sync_service.rbindex 3252d023844..e0100d667e9 100644--- a/modules/openid_connect/app/services/openid_connect/groups/sync_service.rb+++ b/modules/openid_connect/app/services/openid_connect/groups/sync_service.rb@@ -54,7 +54,7 @@ module OpenIDConnectprivatedef process_oidc_group(oidc_group_name)- oidc_group_name = filter_and_name_group(oidc_group_name)+ oidc_group_name = group_matcher.call(oidc_group_name)return nil if oidc_group_name.nil?group = find_group(oidc_group_name)@@ -72,18 +72,6 @@ module OpenIDConnectendend- def filter_and_name_group(group_name)- matcher = authentication_provider.group_matchers.find { |m| m.match?(group_name) }- return nil if matcher.nil?-- match = matcher.match(group_name)- if match.size > 1- match[1..].join.presence- else- group_name- end- end-def find_group(oidc_group_name)group_link = GroupLink.find_or_initialize_by(auth_provider: authentication_provider, oidc_group_name:)if group_link.group.nil?@@ -106,6 +94,10 @@ module OpenIDConnectdef authentication_provider@user.authentication_provider # TODO: should we find that differently? (risk of multiple auth providers)end++ def group_matcher+ @group_matcher ||= GroupMatchService.new(authentication_provider.group_matchers)+ endendendenddiff --git a/modules/openid_connect/config/locales/en.yml b/modules/openid_connect/config/locales/en.ymlindex 40ad365220a..70a42800ee2 100644--- a/modules/openid_connect/config/locales/en.yml+++ b/modules/openid_connect/config/locales/en.yml@@ -62,6 +62,17 @@ en:delete_title: "Delete OpenID Connect provider"group_links_heading: OpenID Connect group links+ groups:+ match_preview_component:+ title: Extracted group names+ placeholder_none: None+ match_preview_dialog_component:+ description: This allows you to test your regular expression pattern against sample data to verify that the group names you want extracted are indeed extracted properly. You can modify your pattern here but the test string and matches themselves will not be saved with the configuration.+ group_names_label: Test group names+ group_names_description: Enter one group name per line as it would appear in the OIDC claim, to see how your regular expression patterns affect them.+ show_button: Test pattern+ title: Test regular expressions+instructions:endpoint_url: The endpoint URL given to you by the OpenID Connect providergroup_regexes: One regular expression pattern per line. Please read [the documentation](docs_url) for more information on how to do this.diff --git a/modules/openid_connect/config/routes.rb b/modules/openid_connect/config/routes.rbindex 0718f13cd58..5c826bcfc35 100644--- a/modules/openid_connect/config/routes.rb+++ b/modules/openid_connect/config/routes.rb@@ -35,6 +35,7 @@ Rails.application.routes.draw donamespace :openid_connect doresources :providers doget :confirm_destroy, on: :member+ post :match_groups, on: :collectionendendend