activeadmin-oidc 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +53 -5
- data/app/controllers/active_admin/oidc/devise/omniauth_callbacks_controller.rb +10 -0
- data/app/views/active_admin/devise/sessions/new.html.erb +23 -6
- data/lib/activeadmin/oidc/configuration.rb +6 -1
- data/lib/activeadmin/oidc/engine.rb +63 -2
- data/lib/activeadmin/oidc/test_helpers.rb +0 -36
- data/lib/activeadmin/oidc/version.rb +1 -1
- data/lib/activeadmin-oidc.rb +10 -0
- data/lib/generators/active_admin/oidc/install/install_generator.rb +17 -2
- data/lib/generators/active_admin/oidc/install/templates/sessions_new_v4.html.erb +12 -0
- metadata +20 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 013ffd8d314b6537d497b578633169a575ef8a09930c6363c07a29c6c4f9e05a
|
|
4
|
+
data.tar.gz: 39650f667cb6a69c427510b2f51eb48e11164040d8904b51bc7af4b072e09dc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 326a81f750548c6078850705cebc07d94577154f88201c4bf7b190207b53600bacbf742b14353d799ff0efcf4dec32b6d49a36d0779ff6f10b78ff0667971a6e
|
|
7
|
+
data.tar.gz: edc04731d82c7a98be8469a32ff2b119589723fc5df05cc4b6cf5c92e73aa5732dbcbe54765a5d890619f4c8ad98772f955522b8e7b4bcdebc21b2d803507603
|
data/README.md
CHANGED
|
@@ -38,14 +38,29 @@ Without these, `/admin` is public to anyone and the utility navigation (includin
|
|
|
38
38
|
|
|
39
39
|
```ruby
|
|
40
40
|
class AdminUser < ApplicationRecord
|
|
41
|
-
devise :
|
|
42
|
-
:rememberable,
|
|
43
|
-
:omniauthable, omniauth_providers: [:oidc]
|
|
41
|
+
devise :omniauthable, omniauth_providers: [:oidc]
|
|
44
42
|
|
|
45
|
-
serialize :oidc_raw_info, coder: JSON
|
|
43
|
+
serialize :oidc_raw_info, coder: JSON # Postgres jsonb: drop this line
|
|
46
44
|
end
|
|
47
45
|
```
|
|
48
46
|
|
|
47
|
+
OIDC is the only authentication mechanism — `:database_authenticatable`, `encrypted_password`, and password reset / lockable / confirmable flows are not used. The IdP owns identity, recovery, MFA, and lockout. The engine auto-mounts `GET /admin/login` (SSO landing page) and `DELETE /admin/logout` so ActiveAdmin's login link still resolves without Devise's session routes.
|
|
48
|
+
|
|
49
|
+
### Engine-mounted Devise
|
|
50
|
+
|
|
51
|
+
If `devise_for :admin_users` lives inside a Rails engine (not the main app routes), set `Devise.router_name = :<engine_name>` in `config/initializers/devise.rb` and pass the same option to `devise_for`. The gem reads `Devise.available_router_name` and mounts its session routes inside that engine's route set, so `<Engine>.routes.url_helpers.new_<scope>_session_path` resolves correctly.
|
|
52
|
+
|
|
53
|
+
For **isolated** engines (`isolate_namespace ...`) mounted at a prefix (e.g. `mount AdminPanel::Engine => '/admin'`), the engine prepends its mount path to every internal route. The gem's default `login_path = '/admin/login'` would then become `/admin/admin/login`. Configure engine-relative paths in `config/initializers/activeadmin_oidc.rb`:
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
56
|
+
ActiveAdmin::Oidc.configure do |c|
|
|
57
|
+
c.login_path = '/login'
|
|
58
|
+
c.logout_path = '/logout'
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Non-isolated engines don't need this override.
|
|
63
|
+
|
|
49
64
|
### 3. `config/initializers/activeadmin_oidc.rb` (generated)
|
|
50
65
|
|
|
51
66
|
Fill in at minimum `issuer`, `client_id`, and an `on_login` hook. Full reference below.
|
|
@@ -57,6 +72,7 @@ The gem's Rails engine handles several things so host apps don't have to:
|
|
|
57
72
|
* **OmniAuth strategy registration** — the engine registers the `:openid_connect` strategy with Devise automatically based on your `ActiveAdmin::Oidc` configuration. You do **not** need to add `config.omniauth` or `config.omniauth_path_prefix` to `devise.rb`.
|
|
58
73
|
* **Callback controller** — the engine patches `ActiveAdmin::Devise.controllers` to route OmniAuth callbacks to the gem's controller. No manual `controllers: { omniauth_callbacks: ... }` needed in `routes.rb`.
|
|
59
74
|
* **Login view override** — the engine prepends an SSO-only login page (no email/password fields) to the sessions controller's view path. If your host app ships its own `app/views/active_admin/devise/sessions/new.html.erb`, the gem detects it and backs off — your view wins.
|
|
75
|
+
* **Session routes** — the engine mounts `GET /admin/login` (renders the SSO landing page) and `DELETE /admin/logout` under `devise_scope`, with the scope name derived from `config.admin_user_class`. Devise normally generates session routes as a side effect of `:database_authenticatable`; without that module the route helpers would not exist and ActiveAdmin's login redirect would 404.
|
|
60
76
|
* **Path prefix** — the engine sets `Devise.omniauth_path_prefix` and `OmniAuth.config.path_prefix` to `/admin/auth` so the middleware intercepts requests under ActiveAdmin's mount point. Compatible with Rails 7.2+ and Rails 8's lazy route loading.
|
|
61
77
|
* **Parameter filtering** — `code`, `id_token`, `access_token`, `refresh_token`, `state`, and `nonce` are added to `Rails.application.config.filter_parameters`.
|
|
62
78
|
|
|
@@ -231,7 +247,7 @@ AdminUser.last.oidc_raw_info
|
|
|
231
247
|
|
|
232
248
|
## Custom login view
|
|
233
249
|
|
|
234
|
-
The gem ships a minimal SSO-only login page (a single button, no email/password fields). If you need a different layout — for instance,
|
|
250
|
+
The gem ships a minimal SSO-only login page (a single button, no email/password fields). If you need a different layout — for instance, different branding, an explanatory paragraph, or multiple OmniAuth strategies — drop your own template at:
|
|
235
251
|
|
|
236
252
|
```
|
|
237
253
|
app/views/active_admin/devise/sessions/new.html.erb
|
|
@@ -267,6 +283,38 @@ The gem logs internal diagnostics (on_login exceptions, omniauth failures) via `
|
|
|
267
283
|
ActiveAdmin::Oidc.logger = MyStructuredLogger.new
|
|
268
284
|
```
|
|
269
285
|
|
|
286
|
+
## Testing
|
|
287
|
+
|
|
288
|
+
`require "activeadmin/oidc/test_helpers"` exposes `ActiveAdmin::Oidc::TestHelpers` with three methods for stubbing OmniAuth in specs:
|
|
289
|
+
|
|
290
|
+
```ruby
|
|
291
|
+
stub_oidc_sign_in(sub: "alice-sub", claims: { "email" => "alice@example.com", "roles" => ["admin"] })
|
|
292
|
+
stub_oidc_failure(:invalid_credentials)
|
|
293
|
+
reset_oidc_stubs # call in an after hook
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Wire them up in `rails_helper.rb`. The `oidc_mode: true` tag scopes the helpers and the cleanup hook to specs that actually need OIDC stubs:
|
|
297
|
+
|
|
298
|
+
```ruby
|
|
299
|
+
require "activeadmin/oidc/test_helpers"
|
|
300
|
+
|
|
301
|
+
RSpec.configure do |config|
|
|
302
|
+
config.include ActiveAdmin::Oidc::TestHelpers, oidc_mode: true
|
|
303
|
+
config.after(:each, :oidc_mode) { reset_oidc_stubs }
|
|
304
|
+
end
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Then in your specs:
|
|
308
|
+
|
|
309
|
+
```ruby
|
|
310
|
+
RSpec.describe "OIDC sign-in", :oidc_mode do
|
|
311
|
+
it "signs in" do
|
|
312
|
+
stub_oidc_sign_in(claims: { "email" => "a@b.example" })
|
|
313
|
+
# ...
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
```
|
|
317
|
+
|
|
270
318
|
## License
|
|
271
319
|
|
|
272
320
|
MIT — see [`LICENSE.txt`](LICENSE.txt).
|
|
@@ -73,6 +73,16 @@ module ActiveAdmin
|
|
|
73
73
|
def after_sign_in_path_for(resource)
|
|
74
74
|
stored_location_for(resource) || '/admin'
|
|
75
75
|
end
|
|
76
|
+
|
|
77
|
+
# Devise's default `after_omniauth_failure_path_for` calls
|
|
78
|
+
# `new_session_path(scope)`, a URL helper Devise only generates
|
|
79
|
+
# when :database_authenticatable mounts session routes. The
|
|
80
|
+
# engine mounts `new_<scope>_session_path` itself (see
|
|
81
|
+
# `mount_oidc_sessions_routes` initializer) regardless of which
|
|
82
|
+
# modules are loaded, so we always route through that helper.
|
|
83
|
+
def after_omniauth_failure_path_for(scope)
|
|
84
|
+
public_send(:"new_#{scope}_session_path")
|
|
85
|
+
end
|
|
76
86
|
end
|
|
77
87
|
end
|
|
78
88
|
end
|
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
1
|
+
<% if ActiveAdmin::Oidc.aa_v4? %>
|
|
2
|
+
<div class="p-6 sm:p-8 space-y-4 md:space-y-6 w-full sm:max-w-md bg-white sm:rounded-md shadow dark:border dark:bg-gray-800/50 dark:border-gray-800">
|
|
3
|
+
<h2 class="text-xl font-bold text-gray-900 md:text-2xl dark:text-white flex gap-2 items-center">
|
|
4
|
+
<%= site_title %> <%= set_page_title t('active_admin.devise.login.title') %>
|
|
5
|
+
</h2>
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
<%= button_to ActiveAdmin::Oidc.config.login_button_label,
|
|
8
|
+
"/admin/auth/oidc",
|
|
9
|
+
method: :post,
|
|
10
|
+
class: "activeadmin-oidc-login-button w-full",
|
|
11
|
+
form_class: 'formtastic',
|
|
12
|
+
data: { turbo: false } %>
|
|
13
|
+
</div>
|
|
14
|
+
<% else %>
|
|
15
|
+
<div id="login">
|
|
16
|
+
<h2><%= active_admin_application.site_title(self) %></h2>
|
|
17
|
+
|
|
18
|
+
<%= button_to ActiveAdmin::Oidc.config.login_button_label,
|
|
19
|
+
"/admin/auth/oidc",
|
|
20
|
+
method: :post,
|
|
21
|
+
class: "activeadmin-oidc-login-button",
|
|
22
|
+
data: { turbo: false } %>
|
|
23
|
+
</div>
|
|
24
|
+
<% end %>
|
|
@@ -11,12 +11,15 @@ module ActiveAdmin
|
|
|
11
11
|
DEFAULT_ADMIN_USER_CLASS = 'AdminUser'
|
|
12
12
|
DEFAULT_ACCESS_DENIED_MESSAGE =
|
|
13
13
|
'Your account has no permission to access this admin panel.'
|
|
14
|
+
DEFAULT_LOGIN_PATH = '/admin/login'
|
|
15
|
+
DEFAULT_LOGOUT_PATH = '/admin/logout'
|
|
14
16
|
|
|
15
17
|
attr_accessor :issuer, :client_id, :client_secret, :scope,
|
|
16
18
|
:redirect_uri,
|
|
17
19
|
:login_button_label, :timeout,
|
|
18
20
|
:identity_attribute, :identity_claim,
|
|
19
|
-
:access_denied_message, :on_login, :admin_user_class
|
|
21
|
+
:access_denied_message, :on_login, :admin_user_class,
|
|
22
|
+
:login_path, :logout_path
|
|
20
23
|
|
|
21
24
|
def initialize
|
|
22
25
|
reset!
|
|
@@ -34,6 +37,8 @@ module ActiveAdmin
|
|
|
34
37
|
@identity_claim = DEFAULT_IDENTITY_CLAIM
|
|
35
38
|
@access_denied_message = DEFAULT_ACCESS_DENIED_MESSAGE
|
|
36
39
|
@admin_user_class = DEFAULT_ADMIN_USER_CLASS
|
|
40
|
+
@login_path = DEFAULT_LOGIN_PATH
|
|
41
|
+
@logout_path = DEFAULT_LOGOUT_PATH
|
|
37
42
|
@on_login = nil
|
|
38
43
|
@pkce_override = nil
|
|
39
44
|
self
|
|
@@ -11,11 +11,30 @@ module ActiveAdmin
|
|
|
11
11
|
# Used to gate controller registration and view overrides so the
|
|
12
12
|
# gem is a no-op when OIDC is not enabled on the model.
|
|
13
13
|
def self.oidc_enabled?
|
|
14
|
-
|
|
15
|
-
klass = admin_class.is_a?(String) ? admin_class.safe_constantize : admin_class
|
|
14
|
+
klass = admin_user_class
|
|
16
15
|
klass.respond_to?(:devise_modules) && klass.devise_modules.include?(:omniauthable)
|
|
17
16
|
end
|
|
18
17
|
|
|
18
|
+
def self.admin_user_class
|
|
19
|
+
admin_class = ActiveAdmin::Oidc.config.admin_user_class
|
|
20
|
+
admin_class.is_a?(String) ? admin_class.safe_constantize : admin_class
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Returns the route set our session routes should be appended to.
|
|
24
|
+
# Follows `Devise.available_router_name` (set by the host via
|
|
25
|
+
# `Devise.router_name = :foo`) so that engine-mounted Devise
|
|
26
|
+
# setups see the helpers on the right engine's url_helpers.
|
|
27
|
+
def self.session_routes_target(app)
|
|
28
|
+
router_name = ::Devise.available_router_name
|
|
29
|
+
return app.routes if router_name.blank? || router_name.to_sym == :main_app
|
|
30
|
+
|
|
31
|
+
engine_class = ::Rails::Engine.subclasses.find do |klass|
|
|
32
|
+
klass.engine_name.to_sym == router_name.to_sym
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
engine_class ? engine_class.routes : app.routes
|
|
36
|
+
end
|
|
37
|
+
|
|
19
38
|
ControllersPatch = Module.new do
|
|
20
39
|
def controllers
|
|
21
40
|
result = super
|
|
@@ -101,6 +120,48 @@ module ActiveAdmin
|
|
|
101
120
|
initializer 'activeadmin_oidc.filter_parameters' do |app|
|
|
102
121
|
app.config.filter_parameters |= %i[code id_token access_token refresh_token state nonce]
|
|
103
122
|
end
|
|
123
|
+
|
|
124
|
+
# The gem is OIDC-first: mount our SSO landing page at /admin/login
|
|
125
|
+
# and a warden-based /admin/logout under the existing devise scope.
|
|
126
|
+
# Without these, hosts that omit :database_authenticatable have no
|
|
127
|
+
# session routes from Devise at all, so ActiveAdmin's redirect to
|
|
128
|
+
# `new_admin_user_session_path` 404s. Hosts that DO keep
|
|
129
|
+
# :database_authenticatable get our SSO landing on GET; Devise's
|
|
130
|
+
# POST /admin/login (password sign-in) is unaffected because it
|
|
131
|
+
# lives on the same path with a different verb.
|
|
132
|
+
#
|
|
133
|
+
# Mount target follows `Devise.available_router_name`: hosts that
|
|
134
|
+
# mount Devise inside an engine set `Devise.router_name = :admin_panel`,
|
|
135
|
+
# which pins Devise URL helpers to `AdminPanel::Engine.routes`. We
|
|
136
|
+
# mount in the same route set so
|
|
137
|
+
# `<Engine>.routes.url_helpers.new_admin_user_session_path` resolves.
|
|
138
|
+
# Defaults to `Rails.application.routes` when unset.
|
|
139
|
+
initializer 'activeadmin_oidc.mount_oidc_sessions_routes' do |app|
|
|
140
|
+
# after_initialize fires once at boot. `RouteSet#clear!` deliberately
|
|
141
|
+
# preserves the append/prepend queues across reloads, so re-running
|
|
142
|
+
# this hook (as `to_prepare` would in dev) accumulates duplicate
|
|
143
|
+
# append callbacks and crashes the second draw with
|
|
144
|
+
# "Invalid route name, already in use: 'new_admin_user_session'".
|
|
145
|
+
app.config.after_initialize do
|
|
146
|
+
next unless Engine.oidc_enabled?
|
|
147
|
+
|
|
148
|
+
cfg = ActiveAdmin::Oidc.config
|
|
149
|
+
login_path = cfg.login_path
|
|
150
|
+
logout_path = cfg.logout_path
|
|
151
|
+
scope_name = Engine.admin_user_class.model_name.singular.to_sym
|
|
152
|
+
|
|
153
|
+
Engine.session_routes_target(app).append do
|
|
154
|
+
devise_scope scope_name do
|
|
155
|
+
# Use the controller class directly via `.action(...)` so
|
|
156
|
+
# isolated engines don't try to resolve the controller as
|
|
157
|
+
# `<Engine>::ActiveAdmin::Devise::SessionsController` from
|
|
158
|
+
# the relative string form.
|
|
159
|
+
get login_path, to: ::ActiveAdmin::Devise::SessionsController.action(:new), as: :"new_#{scope_name}_session"
|
|
160
|
+
delete logout_path, to: ::ActiveAdmin::Devise::SessionsController.action(:destroy), as: :"destroy_#{scope_name}_session"
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
104
165
|
end
|
|
105
166
|
end
|
|
106
167
|
end
|
|
@@ -63,41 +63,5 @@ module ActiveAdmin
|
|
|
63
63
|
OmniAuth.config.request_validation_phase = @_oidc_saved_request_validation_phase if defined?(@_oidc_saved_request_validation_phase)
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
|
-
|
|
67
|
-
# RSpec support for oidc_mode tag filtering.
|
|
68
|
-
# Require this file in spec_helper or rails_helper to auto-configure:
|
|
69
|
-
#
|
|
70
|
-
# require "activeadmin/oidc/test_helpers"
|
|
71
|
-
#
|
|
72
|
-
# Specs tagged `oidc_mode: true` will be skipped unless the AdminUser
|
|
73
|
-
# model has :omniauthable loaded. Set CI_RUN_OIDC=true in your CI job
|
|
74
|
-
# to run only OIDC-tagged specs.
|
|
75
|
-
module RSpecSupport
|
|
76
|
-
def self.install!
|
|
77
|
-
return unless defined?(RSpec)
|
|
78
|
-
|
|
79
|
-
RSpec.configure do |config|
|
|
80
|
-
config.include TestHelpers, oidc_mode: true
|
|
81
|
-
config.after(:each, :oidc_mode) { reset_oidc_stubs }
|
|
82
|
-
|
|
83
|
-
config.before(:each, :oidc_mode) do
|
|
84
|
-
admin_class = ActiveAdmin::Oidc.config.admin_user_class
|
|
85
|
-
klass = admin_class.is_a?(String) ? admin_class.safe_constantize : admin_class
|
|
86
|
-
unless klass.respond_to?(:devise_modules) && klass.devise_modules.include?(:omniauthable)
|
|
87
|
-
skip 'requires OIDC mode (run with config/oidc.yml in place and CI_RUN_OIDC=true)'
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
if ENV['CI_RUN_OIDC'].present?
|
|
92
|
-
config.filter_run_including oidc_mode: true
|
|
93
|
-
else
|
|
94
|
-
config.filter_run_excluding oidc_mode: true
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
66
|
end
|
|
100
67
|
end
|
|
101
|
-
|
|
102
|
-
# Auto-install RSpec support when required during a test run.
|
|
103
|
-
ActiveAdmin::Oidc::RSpecSupport.install!
|
data/lib/activeadmin-oidc.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "logger"
|
|
4
4
|
require "active_support/core_ext/object/blank"
|
|
5
5
|
require "activeadmin/oidc/version"
|
|
6
|
+
require "active_admin/version"
|
|
6
7
|
|
|
7
8
|
# `omniauth-rails_csrf_protection` registers a Railtie that replaces
|
|
8
9
|
# OmniAuth 2.x's Rack-level authenticity check with Rails' own forgery
|
|
@@ -53,6 +54,15 @@ module ActiveAdmin
|
|
|
53
54
|
@logger = nil
|
|
54
55
|
end
|
|
55
56
|
|
|
57
|
+
# True when the installed ActiveAdmin is the 4.x line (including the
|
|
58
|
+
# 4.0.0 prereleases). AA 4 ships a Tailwind-based admin layout, so
|
|
59
|
+
# the login view override must emit Tailwind markup instead of the
|
|
60
|
+
# legacy `#login` structure AA 3.x expects. Mirrors the version probe
|
|
61
|
+
# ActiveAdmin plugins use (e.g. activeadmin_table_footer's styles.rb).
|
|
62
|
+
def aa_v4?
|
|
63
|
+
::Gem::Version.new(::ActiveAdmin::VERSION) >= ::Gem::Version.new("4.0.0.beta1")
|
|
64
|
+
end
|
|
65
|
+
|
|
56
66
|
private
|
|
57
67
|
|
|
58
68
|
def default_logger
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "rails/generators/base"
|
|
4
4
|
require "rails/generators/active_record"
|
|
5
|
+
require "active_admin/version"
|
|
5
6
|
|
|
6
7
|
module ActiveAdmin
|
|
7
8
|
module Oidc
|
|
@@ -74,8 +75,13 @@ module ActiveAdmin
|
|
|
74
75
|
end
|
|
75
76
|
|
|
76
77
|
def create_view_override
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
if aa_v4?
|
|
79
|
+
copy_file "sessions_new_v4.html.erb",
|
|
80
|
+
"app/views/active_admin/devise/sessions/new.html.erb"
|
|
81
|
+
else
|
|
82
|
+
copy_file "sessions_new.html.erb",
|
|
83
|
+
"app/views/active_admin/devise/sessions/new.html.erb"
|
|
84
|
+
end
|
|
79
85
|
end
|
|
80
86
|
|
|
81
87
|
# Non-blocking: the generator completed successfully, but the
|
|
@@ -142,6 +148,15 @@ module ActiveAdmin
|
|
|
142
148
|
adapter = (ActiveRecord::Base.connection_db_config.adapter rescue "sqlite3").to_s
|
|
143
149
|
adapter.start_with?("postgres") ? ":jsonb" : ":text"
|
|
144
150
|
end
|
|
151
|
+
|
|
152
|
+
# True when the installed ActiveAdmin is the 4.x line (including the
|
|
153
|
+
# 4.0.0 prereleases). AA 4 ships a Tailwind-based admin layout, so
|
|
154
|
+
# the login view override must emit Tailwind markup instead of the
|
|
155
|
+
# legacy `#login` structure AA 3.x expects. Mirrors the version probe
|
|
156
|
+
# ActiveAdmin plugins use (e.g. activeadmin_table_footer's styles.rb).
|
|
157
|
+
def aa_v4?
|
|
158
|
+
::Gem::Version.new(::ActiveAdmin::VERSION) >= ::Gem::Version.new("4.0.0.beta1")
|
|
159
|
+
end
|
|
145
160
|
end
|
|
146
161
|
end
|
|
147
162
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<div class="p-6 sm:p-8 space-y-4 md:space-y-6 w-full sm:max-w-md bg-white sm:rounded-md shadow dark:border dark:bg-gray-800/50 dark:border-gray-800">
|
|
2
|
+
<h2 class="text-xl font-bold text-gray-900 md:text-2xl dark:text-white flex gap-2 items-center">
|
|
3
|
+
<%%= site_title %> <%%= set_page_title t('active_admin.devise.login.title') %>
|
|
4
|
+
</h2>
|
|
5
|
+
|
|
6
|
+
<%%= button_to ActiveAdmin::Oidc.config.login_button_label,
|
|
7
|
+
"/admin/auth/oidc",
|
|
8
|
+
method: :post,
|
|
9
|
+
class: "activeadmin-oidc-login-button w-full",
|
|
10
|
+
form_class: 'formtastic',
|
|
11
|
+
data: { turbo: false } %>
|
|
12
|
+
</div>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activeadmin-oidc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Igor Fedoronchuk
|
|
@@ -18,7 +18,7 @@ dependencies:
|
|
|
18
18
|
version: '3.5'
|
|
19
19
|
- - "<"
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '
|
|
21
|
+
version: '5'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -28,21 +28,21 @@ dependencies:
|
|
|
28
28
|
version: '3.5'
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
|
-
version: '
|
|
31
|
+
version: '5'
|
|
32
32
|
- !ruby/object:Gem::Dependency
|
|
33
33
|
name: devise
|
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
|
35
35
|
requirements:
|
|
36
36
|
- - ">="
|
|
37
37
|
- !ruby/object:Gem::Version
|
|
38
|
-
version: '
|
|
38
|
+
version: '5.0'
|
|
39
39
|
type: :runtime
|
|
40
40
|
prerelease: false
|
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
42
42
|
requirements:
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '
|
|
45
|
+
version: '5.0'
|
|
46
46
|
- !ruby/object:Gem::Dependency
|
|
47
47
|
name: omniauth
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -77,14 +77,14 @@ dependencies:
|
|
|
77
77
|
requirements:
|
|
78
78
|
- - ">="
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: '0.
|
|
80
|
+
version: '0.6'
|
|
81
81
|
type: :runtime
|
|
82
82
|
prerelease: false
|
|
83
83
|
version_requirements: !ruby/object:Gem::Requirement
|
|
84
84
|
requirements:
|
|
85
85
|
- - ">="
|
|
86
86
|
- !ruby/object:Gem::Version
|
|
87
|
-
version: '0.
|
|
87
|
+
version: '0.6'
|
|
88
88
|
- !ruby/object:Gem::Dependency
|
|
89
89
|
name: rails
|
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,75 +114,61 @@ dependencies:
|
|
|
114
114
|
- !ruby/object:Gem::Version
|
|
115
115
|
version: '6.0'
|
|
116
116
|
- !ruby/object:Gem::Dependency
|
|
117
|
-
name:
|
|
117
|
+
name: capybara
|
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements:
|
|
120
120
|
- - ">="
|
|
121
121
|
- !ruby/object:Gem::Version
|
|
122
|
-
version: '3.
|
|
122
|
+
version: '3.40'
|
|
123
123
|
type: :development
|
|
124
124
|
prerelease: false
|
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements:
|
|
127
127
|
- - ">="
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: '3.
|
|
129
|
+
version: '3.40'
|
|
130
130
|
- !ruby/object:Gem::Dependency
|
|
131
|
-
name:
|
|
132
|
-
requirement: !ruby/object:Gem::Requirement
|
|
133
|
-
requirements:
|
|
134
|
-
- - ">="
|
|
135
|
-
- !ruby/object:Gem::Version
|
|
136
|
-
version: '2.7'
|
|
137
|
-
type: :development
|
|
138
|
-
prerelease: false
|
|
139
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
140
|
-
requirements:
|
|
141
|
-
- - ">="
|
|
142
|
-
- !ruby/object:Gem::Version
|
|
143
|
-
version: '2.7'
|
|
144
|
-
- !ruby/object:Gem::Dependency
|
|
145
|
-
name: sqlite3
|
|
131
|
+
name: webmock
|
|
146
132
|
requirement: !ruby/object:Gem::Requirement
|
|
147
133
|
requirements:
|
|
148
134
|
- - ">="
|
|
149
135
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: '
|
|
136
|
+
version: '3.19'
|
|
151
137
|
type: :development
|
|
152
138
|
prerelease: false
|
|
153
139
|
version_requirements: !ruby/object:Gem::Requirement
|
|
154
140
|
requirements:
|
|
155
141
|
- - ">="
|
|
156
142
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: '
|
|
143
|
+
version: '3.19'
|
|
158
144
|
- !ruby/object:Gem::Dependency
|
|
159
|
-
name:
|
|
145
|
+
name: jwt
|
|
160
146
|
requirement: !ruby/object:Gem::Requirement
|
|
161
147
|
requirements:
|
|
162
148
|
- - ">="
|
|
163
149
|
- !ruby/object:Gem::Version
|
|
164
|
-
version: '
|
|
150
|
+
version: '2.7'
|
|
165
151
|
type: :development
|
|
166
152
|
prerelease: false
|
|
167
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
168
154
|
requirements:
|
|
169
155
|
- - ">="
|
|
170
156
|
- !ruby/object:Gem::Version
|
|
171
|
-
version: '
|
|
157
|
+
version: '2.7'
|
|
172
158
|
- !ruby/object:Gem::Dependency
|
|
173
|
-
name:
|
|
159
|
+
name: sqlite3
|
|
174
160
|
requirement: !ruby/object:Gem::Requirement
|
|
175
161
|
requirements:
|
|
176
162
|
- - ">="
|
|
177
163
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '
|
|
164
|
+
version: '1.7'
|
|
179
165
|
type: :development
|
|
180
166
|
prerelease: false
|
|
181
167
|
version_requirements: !ruby/object:Gem::Requirement
|
|
182
168
|
requirements:
|
|
183
169
|
- - ">="
|
|
184
170
|
- !ruby/object:Gem::Version
|
|
185
|
-
version: '
|
|
171
|
+
version: '1.7'
|
|
186
172
|
- !ruby/object:Gem::Dependency
|
|
187
173
|
name: rake
|
|
188
174
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -262,6 +248,7 @@ files:
|
|
|
262
248
|
- lib/generators/active_admin/oidc/install/templates/initializer.rb.tt
|
|
263
249
|
- lib/generators/active_admin/oidc/install/templates/migration.rb.tt
|
|
264
250
|
- lib/generators/active_admin/oidc/install/templates/sessions_new.html.erb
|
|
251
|
+
- lib/generators/active_admin/oidc/install/templates/sessions_new_v4.html.erb
|
|
265
252
|
homepage: https://github.com/activeadmin-plugins/activeadmin-oidc
|
|
266
253
|
licenses:
|
|
267
254
|
- MIT
|