Move SAML and OIDC keys under activerecord, not activemodel

This commit is contained in:
Oliver Günther
2025-02-21 12:53:00 +01:00
parent e27db03fb0
commit e91d4860ef
18 changed files with 44 additions and 43 deletions
+2
View File
@@ -1059,6 +1059,8 @@ en:
language: "Language"
last_login_on: "Last login"
failed_login_count: "Failed login attempts"
first_name: "First name"
last_name: "Last name"
first_login: "First login"
new_password: "New password"
password_confirmation: "Confirmation"
@@ -5,7 +5,7 @@
component_collection do |collection|
collection.with_component(Primer::Beta::Heading.new(tag: :h5, mb: 1)) do
I18n.t("activemodel.attributes.saml/provider.sp_entity_id")
I18n.t("activerecord.attributes.saml/provider.sp_entity_id")
end
collection.with_component(
@@ -13,7 +13,7 @@
)
collection.with_component(Primer::Beta::Heading.new(tag: :h5, mt: 4, mb: 1)) do
I18n.t("activemodel.attributes.saml/provider.assertion_consumer_service_url")
I18n.t("activerecord.attributes.saml/provider.assertion_consumer_service_url")
end
collection.with_component(
@@ -9,7 +9,7 @@
<%= render(border_box_container) do |component|
component.with_header(color: :muted) do
render(Primer::Beta::Text.new(font_weight: :semibold)) { I18n.t("activemodel.attributes.saml/provider.display_name") }
render(Primer::Beta::Text.new(font_weight: :semibold)) { I18n.t("activerecord.attributes.saml/provider.display_name") }
end
component.with_row(scheme: :default) do
@@ -32,7 +32,7 @@ module Saml
form do |f|
f.text_field(
name: :sp_entity_id,
label: I18n.t("activemodel.attributes.saml/provider.sp_entity_id"),
label: I18n.t("activerecord.attributes.saml/provider.sp_entity_id"),
caption: I18n.t("saml.instructions.sp_entity_id"),
disabled: provider.seeded_from_env?,
required: true,
@@ -40,7 +40,7 @@ module Saml
)
f.text_field(
name: :idp_sso_service_url,
label: I18n.t("activemodel.attributes.saml/provider.idp_sso_service_url"),
label: I18n.t("activerecord.attributes.saml/provider.idp_sso_service_url"),
caption: I18n.t("saml.instructions.idp_sso_service_url"),
disabled: provider.seeded_from_env?,
required: true,
@@ -48,7 +48,7 @@ module Saml
)
f.text_field(
name: :idp_slo_service_url,
label: I18n.t("activemodel.attributes.saml/provider.idp_slo_service_url"),
label: I18n.t("activerecord.attributes.saml/provider.idp_slo_service_url"),
caption: I18n.t("saml.instructions.idp_slo_service_url"),
disabled: provider.seeded_from_env?,
required: false,
@@ -57,7 +57,7 @@ module Saml
f.text_area(
name: :idp_cert,
rows: 10,
label: I18n.t("activemodel.attributes.saml/provider.idp_cert"),
label: I18n.t("activerecord.attributes.saml/provider.idp_cert"),
caption: I18n.t("saml.instructions.idp_cert"),
disabled: provider.seeded_from_env?,
required: true,
@@ -65,7 +65,7 @@ module Saml
)
f.select_list(
name: "name_identifier_format",
label: I18n.t("activemodel.attributes.saml/provider.name_identifier_format"),
label: I18n.t("activerecord.attributes.saml/provider.name_identifier_format"),
input_width: :large,
disabled: provider.seeded_from_env?,
caption: I18n.t("saml.instructions.name_identifier_format")
@@ -76,7 +76,7 @@ module Saml
end
f.check_box(
name: :limit_self_registration,
label: I18n.t("activemodel.attributes.saml/provider.limit_self_registration"),
label: I18n.t("activerecord.attributes.saml/provider.limit_self_registration"),
caption: I18n.t("saml.instructions.limit_self_registration"),
disabled: provider.seeded_from_env?,
required: false,
@@ -84,7 +84,7 @@ module Saml
)
f.text_field(
name: :icon,
label: I18n.t("activemodel.attributes.saml/provider.icon"),
label: I18n.t("activerecord.attributes.saml/provider.icon"),
caption: I18n.t("saml.instructions.icon"),
disabled: provider.seeded_from_env?,
required: false,
@@ -32,21 +32,21 @@ module Saml
form do |f|
f.check_box(
name: :authn_requests_signed,
label: I18n.t("activemodel.attributes.saml/provider.authn_requests_signed"),
label: I18n.t("activerecord.attributes.saml/provider.authn_requests_signed"),
caption: I18n.t("saml.instructions.authn_requests_signed"),
disabled: provider.seeded_from_env?,
required: true
)
f.check_box(
name: :want_assertions_signed,
label: I18n.t("activemodel.attributes.saml/provider.want_assertions_signed"),
label: I18n.t("activerecord.attributes.saml/provider.want_assertions_signed"),
caption: I18n.t("saml.instructions.want_assertions_signed"),
disabled: provider.seeded_from_env?,
required: true
)
f.check_box(
name: :want_assertions_encrypted,
label: I18n.t("activemodel.attributes.saml/provider.want_assertions_encrypted"),
label: I18n.t("activerecord.attributes.saml/provider.want_assertions_encrypted"),
caption: I18n.t("saml.instructions.want_assertions_encrypted"),
disabled: provider.seeded_from_env?,
required: true
@@ -54,7 +54,7 @@ module Saml
f.text_area(
name: :certificate,
rows: 10,
label: I18n.t("activemodel.attributes.saml/provider.certificate"),
label: I18n.t("activerecord.attributes.saml/provider.certificate"),
caption: I18n.t("saml.instructions.certificate"),
required: false,
disabled: provider.seeded_from_env?,
@@ -63,7 +63,7 @@ module Saml
f.text_area(
name: :private_key,
rows: 10,
label: I18n.t("activemodel.attributes.saml/provider.private_key"),
label: I18n.t("activerecord.attributes.saml/provider.private_key"),
caption: I18n.t("saml.instructions.private_key"),
required: false,
disabled: provider.seeded_from_env?,
@@ -71,7 +71,7 @@ module Saml
)
f.select_list(
name: :digest_method,
label: I18n.t("activemodel.attributes.saml/provider.digest_method"),
label: I18n.t("activerecord.attributes.saml/provider.digest_method"),
input_width: :large,
disabled: provider.seeded_from_env?,
caption: I18n.t("saml.instructions.digest_method", default_option: "SHA-1")
@@ -82,7 +82,7 @@ module Saml
end
f.select_list(
name: :signature_method,
label: I18n.t("activemodel.attributes.saml/provider.signature_method"),
label: I18n.t("activerecord.attributes.saml/provider.signature_method"),
input_width: :large,
disabled: provider.seeded_from_env?,
caption: I18n.t("saml.instructions.signature_method", default_option: "RSA SHA-1")
@@ -32,7 +32,7 @@ module Saml
form do |f|
f.text_field(
name: :display_name,
label: I18n.t("activemodel.attributes.saml/provider.display_name"),
label: I18n.t("activerecord.attributes.saml/provider.display_name"),
required: true,
disabled: provider.seeded_from_env?,
caption: I18n.t("saml.instructions.display_name"),
@@ -47,7 +47,7 @@ module Saml
form_group.select_list(
name: :"requested_#{attribute}_format",
label: I18n.t("activemodel.attributes.saml/provider.format"),
label: I18n.t("activerecord.attributes.saml/provider.format"),
input_width: :large,
disabled: provider.seeded_from_env?,
caption: link_translate(
+1 -2
View File
@@ -1,5 +1,5 @@
en:
activemodel:
activerecord:
attributes:
saml/provider:
display_name: Name
@@ -23,7 +23,6 @@ en:
digest_method: Digest algorithm
format: "Format"
icon: "Custom icon"
activerecord:
errors:
models:
saml/provider:
@@ -174,7 +174,7 @@ RSpec.describe "SAML administration CRUD",
fill_in "Name", with: "My provider"
click_link_or_button "Continue"
expect(page).to have_text "Display name has already been taken."
expect(page).to have_text "Name has already been taken."
end
it "can toggle limit_self_registration (Regression #59370)" do
@@ -104,7 +104,8 @@ RSpec.describe EnvData::Saml::ProviderSeeder, :settings_reset do
OPENPROJECT_SAML_SAML_IDP__CERT: "invalid"
} do
it "raises an exception" do
expect { seeder.seed! }.to raise_error(/Idp cert is not a valid PEM-formatted certificate/)
expect { seeder.seed! }
.to raise_error(/Public certificate of identity provider is not a valid PEM-formatted certificate/)
expect(Saml::Provider.all).to be_empty
end
@@ -35,7 +35,7 @@ module OpenIDConnect
f.text_area(
name: :claims,
rows: 10,
label: I18n.t("activemodel.attributes.openid_connect/provider.claims"),
label: I18n.t("activerecord.attributes.openid_connect/provider.claims"),
caption: link_translate(
"openid_connect.instructions.claims",
links: {
@@ -49,7 +49,7 @@ module OpenIDConnect
f.text_field(
name: :acr_values,
label: I18n.t("activemodel.attributes.openid_connect/provider.acr_values"),
label: I18n.t("activerecord.attributes.openid_connect/provider.acr_values"),
caption: link_translate(
"openid_connect.instructions.acr_values",
links: {
@@ -35,7 +35,7 @@ module OpenIDConnect
%i[client_id client_secret].each do |attr|
f.text_field(
name: attr,
label: I18n.t("activemodel.attributes.openid_connect/provider.#{attr}"),
label: I18n.t("activerecord.attributes.openid_connect/provider.#{attr}"),
caption: I18n.t("openid_connect.instructions.#{attr}"),
disabled: provider.seeded_from_env?,
required: true,
@@ -44,7 +44,7 @@ module OpenIDConnect
end
f.text_field(
name: :post_logout_redirect_uri,
label: I18n.t("activemodel.attributes.openid_connect/provider.post_logout_redirect_uri"),
label: I18n.t("activerecord.attributes.openid_connect/provider.post_logout_redirect_uri"),
caption: I18n.t("openid_connect.instructions.post_logout_redirect_uri"),
disabled: provider.seeded_from_env?,
required: false,
@@ -52,7 +52,7 @@ module OpenIDConnect
)
f.text_field(
name: :scope,
label: I18n.t("activemodel.attributes.openid_connect/provider.scope"),
label: I18n.t("activerecord.attributes.openid_connect/provider.scope"),
caption: link_translate(
"openid_connect.instructions.scope",
links: {
@@ -65,7 +65,7 @@ module OpenIDConnect
)
f.check_box(
name: :limit_self_registration,
label: I18n.t("activemodel.attributes.openid_connect/provider.limit_self_registration"),
label: I18n.t("activerecord.attributes.openid_connect/provider.limit_self_registration"),
caption: I18n.t("openid_connect.instructions.limit_self_registration"),
disabled: provider.seeded_from_env?,
required: true
@@ -33,7 +33,7 @@ module OpenIDConnect
OpenIDConnect::Provider::DISCOVERABLE_STRING_ATTRIBUTES_ALL.each do |attr|
f.text_field(
name: attr,
label: I18n.t("activemodel.attributes.openid_connect/provider.#{attr}"),
label: I18n.t("activerecord.attributes.openid_connect/provider.#{attr}"),
disabled: provider.seeded_from_env?,
required: OpenIDConnect::Provider::DISCOVERABLE_STRING_ATTRIBUTES_MANDATORY.include?(attr),
input_width: :large
@@ -43,7 +43,7 @@ module OpenIDConnect
if OpenProject::FeatureDecisions.oidc_token_exchange_active?
f.text_field(
name: :grant_types_supported,
label: I18n.t("activemodel.attributes.openid_connect/provider.grant_types_supported"),
label: I18n.t("activerecord.attributes.openid_connect/provider.grant_types_supported"),
disabled: provider.seeded_from_env?,
required: false,
input_width: :large
@@ -52,7 +52,7 @@ module OpenIDConnect
f.text_field(
name: :icon,
label: I18n.t("activemodel.attributes.openid_connect/provider.icon"),
label: I18n.t("activerecord.attributes.openid_connect/provider.icon"),
caption: I18n.t("saml.instructions.icon"),
disabled: provider.seeded_from_env?,
required: false,
@@ -33,7 +33,7 @@ module OpenIDConnect
f.hidden(name: :oidc_provider, value: provider.oidc_provider)
f.text_field(
name: :display_name,
label: I18n.t("activemodel.attributes.openid_connect/provider.display_name"),
label: I18n.t("activerecord.attributes.openid_connect/provider.display_name"),
required: true,
disabled: provider.seeded_from_env?,
caption: I18n.t("openid_connect.instructions.display_name"),
@@ -41,7 +41,7 @@ module OpenIDConnect
)
f.text_field(
name: :tenant,
label: I18n.t("activemodel.attributes.openid_connect/provider.tenant"),
label: I18n.t("activerecord.attributes.openid_connect/provider.tenant"),
required: true,
disabled: provider.seeded_from_env?,
value: provider.tenant || "common",
@@ -33,7 +33,7 @@ module OpenIDConnect
f.hidden(name: :oidc_provider, value: provider.oidc_provider)
f.text_field(
name: :display_name,
label: I18n.t("activemodel.attributes.openid_connect/provider.display_name"),
label: I18n.t("activerecord.attributes.openid_connect/provider.display_name"),
required: true,
disabled: provider.seeded_from_env?,
caption: I18n.t("openid_connect.instructions.display_name"),
@@ -5,7 +5,7 @@
component_collection do |collection|
collection.with_component(Primer::Beta::Heading.new(tag: :h5, mb: 1)) do
I18n.t("activemodel.attributes.openid_connect/provider.slug")
I18n.t("activerecord.attributes.openid_connect/provider.slug")
end
collection.with_component(
@@ -13,7 +13,7 @@
)
collection.with_component(Primer::Beta::Heading.new(tag: :h5, mt: 4, mb: 1)) do
I18n.t("activemodel.attributes.openid_connect/provider.redirect_url")
I18n.t("activerecord.attributes.openid_connect/provider.redirect_url")
end
collection.with_component(
@@ -30,7 +30,7 @@
provider,
view_mode:,
target_state: :name,
heading: t("activemodel.attributes.openid_connect/provider.display_name"),
heading: t("activerecord.attributes.openid_connect/provider.display_name"),
description: t("openid_connect.providers.section_texts.display_name")
)
end
@@ -80,7 +80,7 @@
provider,
view_mode:,
target_state: :name,
heading: t("activemodel.attributes.openid_connect/provider.display_name"),
heading: t("activerecord.attributes.openid_connect/provider.display_name"),
description: t("openid_connect.providers.section_texts.display_name")
)
end
@@ -130,7 +130,7 @@
provider,
view_mode:,
target_state: :name,
heading: t("activemodel.attributes.openid_connect/provider.display_name"),
heading: t("activerecord.attributes.openid_connect/provider.display_name"),
description: t("openid_connect.providers.section_texts.display_name")
)
end
@@ -277,7 +277,7 @@
provider,
target_state: :claims,
view_mode:,
heading: t("activemodel.attributes.openid_connect/provider.claims"),
heading: t("activerecord.attributes.openid_connect/provider.claims"),
description: t("openid_connect.providers.section_texts.claims")
)
)
+1 -2
View File
@@ -5,7 +5,7 @@ en:
logout_warning: >
You have been logged out. The contents of any form you submit may be lost.
Please [log in].
activemodel:
activerecord:
attributes:
openid_connect/provider:
name: Name
@@ -30,7 +30,6 @@ en:
claims: Claims
acr_values: ACR values
redirect_url: Redirect URL
activerecord:
errors:
models:
openid_connect/provider: