Skip to content

Commit ef7cf2a

Browse files
committed
remove Zitadel preset mechanism
The :zitadel preset only toggled scope + PKCE, which are already exposed as first-class config accessors (c.scope, c.pkce). The preset added no value beyond those two lines and introduced a parallel configuration API that was easy to forget. Drop the preset module, the #preset dispatcher on Configuration, the template comment, the gemspec/README mentions, and the unit/generator tests that covered them. The pkce / pkce= accessors stay, unchanged.
1 parent b0791a2 commit ef7cf2a

9 files changed

Lines changed: 7 additions & 135 deletions

File tree

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ OpenID Connect single sign-on for [ActiveAdmin](https://activeadmin.info/).
66

77
Plugs OIDC into ActiveAdmin's existing Devise stack: JIT user provisioning, an `on_login` hook for host-owned authorization, a login-button view override, and a one-shot install generator. The OIDC protocol layer (discovery, JWKS, token verification, PKCE, nonce, state) is delegated to [`omniauth_openid_connect`](https://github.com/omniauth/omniauth_openid_connect).
88

9-
Used in production by the authors against [Zitadel](https://zitadel.com/); the `:zitadel` preset below covers that wiring. Other compliant OIDC providers work via the standard omniauth_openid_connect options.
9+
Used in production by the authors against [Zitadel](https://zitadel.com/). Other compliant OIDC providers work via the standard omniauth_openid_connect options.
1010

1111
## Installation
1212

@@ -67,10 +67,6 @@ ActiveAdmin::Oidc.configure do |c|
6767
c.client_id = ENV.fetch("OIDC_CLIENT_ID")
6868
c.client_secret = ENV.fetch("OIDC_CLIENT_SECRET", nil) # blank ⇒ PKCE public client
6969

70-
# --- Optional transport-layer preset ----------------------------------
71-
# Sets scope and enables PKCE automatically when no client_secret is set.
72-
# c.preset :zitadel
73-
7470
# --- OIDC scopes ------------------------------------------------------
7571
# c.scope = "openid email profile"
7672

activeadmin-oidc.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Gem::Specification.new do |spec|
66
spec.name = "activeadmin-oidc"
77
spec.version = ActiveAdmin::Oidc::VERSION
88
spec.authors = ["Igor Fedoronchuk"]
9-
spec.summary = "OpenID Connect SSO for ActiveAdmin with a Zitadel preset"
9+
spec.summary = "OpenID Connect SSO for ActiveAdmin"
1010
spec.description = <<~DESC
1111
activeadmin-oidc plugs generic OpenID Connect single sign-on into ActiveAdmin.
1212
It builds on Devise + omniauth_openid_connect and adds JIT user provisioning,
13-
role mapping from provider claims, a Zitadel preset, and a single install
14-
generator that wires everything up.
13+
role mapping from provider claims via a host-owned on_login hook, and a
14+
single install generator that wires everything up.
1515
DESC
1616
spec.license = "MIT"
1717
spec.homepage = "https://github.com/fedoronchuk/activeadmin-oidc"

lib/activeadmin-oidc.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def default_logger
6666
end
6767

6868
require "activeadmin/oidc/configuration"
69-
require "activeadmin/oidc/presets/zitadel"
7069
require "activeadmin/oidc/user_provisioner"
7170
require "rails/engine"
7271
require "activeadmin/oidc/engine"

lib/activeadmin/oidc/configuration.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ def pkce=(value)
4747
@pkce_override = value
4848
end
4949

50-
def preset(name)
51-
case name
52-
when :zitadel
53-
require "activeadmin/oidc/presets/zitadel"
54-
Presets::Zitadel.apply(self)
55-
else
56-
raise ConfigurationError, "Unknown preset: #{name.inspect}"
57-
end
58-
end
59-
6050
def validate!
6151
raise ConfigurationError, "issuer is required" if issuer.blank?
6252
raise ConfigurationError, "client_id is required" if client_id.blank?

lib/activeadmin/oidc/presets/zitadel.rb

Lines changed: 0 additions & 17 deletions
This file was deleted.

lib/generators/active_admin/oidc/install/templates/initializer.rb.tt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
# Uncomment and fill in the values for your identity provider.
77

88
ActiveAdmin::Oidc.configure do |c|
9-
# --- Transport-layer defaults for Zitadel ---------------------------
10-
# Sets `scope = "openid email profile"` and enables PKCE automatically
11-
# when no client_secret is configured (public-client mode).
12-
# c.preset :zitadel
13-
149
# --- Provider ---------------------------------------------------------
1510
# c.issuer = ENV.fetch("OIDC_ISSUER")
1611
# c.client_id = ENV.fetch("OIDC_CLIENT_ID")

spec/generators/install_generator_spec.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
# bin/rails generate active_admin:oidc:install
1111
#
1212
# It must produce a working, editable starting point — initializer with
13-
# a commented-out Zitadel preset and sample `on_login` snippets, a
14-
# migration adding `provider`/`uid`/`oidc_raw_info` + a unique index to
15-
# `admin_users`, and a published login view override. It must be
13+
# sample `on_login` snippets, a migration adding
14+
# `provider`/`uid`/`oidc_raw_info` + a unique index to `admin_users`,
15+
# and a published login view override. It must be
1616
# idempotent (running twice does nothing bad) and refuse to run if the
1717
# host app doesn't have `AdminUser` or `devise`/`activeadmin`.
1818
RSpec.describe ActiveAdmin::Oidc::Generators::InstallGenerator do
@@ -85,10 +85,6 @@ def run_generator(args = [])
8585
expect(initializer).to include("ActiveAdmin::Oidc.configure do |c|")
8686
end
8787

88-
it "includes a commented-out Zitadel preset line" do
89-
expect(initializer).to match(/^\s*#\s*c\.preset\s+:zitadel/)
90-
end
91-
9288
it "includes commented-out ENV reads for issuer/client_id/client_secret" do
9389
expect(initializer).to match(/#\s*c\.issuer\s*=\s*ENV/)
9490
expect(initializer).to match(/#\s*c\.client_id\s*=\s*ENV/)

spec/unit/configuration_spec.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,6 @@
139139
end
140140
end
141141

142-
describe "#preset" do
143-
it "applies the :zitadel preset without clobbering user-set values" do
144-
config.issuer = "https://zitadel.example.com"
145-
config.client_id = "abc"
146-
config.scope = "openid custom"
147-
config.preset :zitadel
148-
expect(config.issuer).to eq("https://zitadel.example.com")
149-
expect(config.client_id).to eq("abc")
150-
expect(config.scope).to eq("openid custom")
151-
end
152-
153-
it "raises for an unknown preset" do
154-
expect { config.preset :unknown }.to raise_error(ActiveAdmin::Oidc::ConfigurationError, /unknown/i)
155-
end
156-
end
157-
158142
describe "accessors" do
159143
it "round-trips all documented accessors" do
160144
config.issuer = "https://example.com"

spec/unit/presets/zitadel_spec.rb

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)