ucb_rails_user 8.0.6 → 9.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 954d1de56fb383d282f1ffeb6a76c06a56895234c2a30c9fbeca2802cbda6229
4
- data.tar.gz: 1af015ccdd24f2e0f00bb585fe4f5c15fdc793b25551aac579a9645b3b4b2c95
3
+ metadata.gz: 75e8941c6eeaa787837b82537e117f7d22b3e0079123184f9d5f14efa6da7591
4
+ data.tar.gz: a1596b62abdff937aec92813bb61374350b6c9cd9a08c01317c0f6749929fda8
5
5
  SHA512:
6
- metadata.gz: 967d3f38b1bd5d803bf8d7a8840d24854e535c710787bdd444804f47983577ce086ced42f6a309f6700ccd979f436c0a176a168499d05356497818f0ad39b2ee
7
- data.tar.gz: 5368ee699eb1d7c4bd1dae8fec54d2219185811cfa3bc0dd9dde12b32d65f22b9cecb3d5f22ecc2002a615199774cc3b8e4f1a186fde3f85dd98678f20dad5b5
6
+ metadata.gz: f661aad5319ba644f93195afdc2737ca7db8e5c11d9d56330ea4440e3dedc52a9fb0f71d67dafd2fde1a433c294e6452afc378aa5cac6bbb309d201baa3f8045
7
+ data.tar.gz: 752153a3da59b7254ab0bb1956f07539e1883f051c04ece5d1667c43dac46592bb528a1980235b45d80fafcb95f1f73bded8fa96c41de1830d8a89a148311d48
data/README.md CHANGED
@@ -147,7 +147,7 @@ resources :users, controller: "ucb_rails_user/users", path: "backend/users", as:
147
147
 
148
148
  ## Session Managers
149
149
 
150
- Authentication during login is handled by UCB's central auth system and this gem uses the [omniauth-cas](https://github.com/dlindahl/omniauth-cas) to manage the handshake. Once that is completed, we're handed the LDAP uid of the authenticated user, and, by default, this gem will attempt to pull the user's employee data and create or update a `User` record for them in the local database.
150
+ Authentication during login is handled by UCB's central auth system and this gem uses [omniauth-cas](https://github.com/dlindahl/omniauth-cas) (OmniAuth 2.x) to manage the handshake. Login starts at `login_path` (`GET /login`), which renders a page with a CSRF-protected button that POSTs to `/auth/cas`. Always link to `login_path`, never to `/auth/cas` directly: OmniAuth 2 rejects GET requests there. Once that is completed, we're handed the LDAP uid of the authenticated user, and, by default, this gem will attempt to pull the user's employee data and create or update a `User` record for them in the local database.
151
151
 
152
152
  This behavior can be customized by writing your own user session manager. There are two steps to do this:
153
153
 
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Ironically, Bootstrap 3.x breaks styles in typeahead.js - these styles provide the needed repair
3
+ * source: https://gist.github.com/AntMooreWebDev/2f7e423a11bc74359323995df4494167
4
+ */
5
+
6
+ .twitter-typeahead .tt-query,
7
+ .twitter-typeahead .tt-hint {
8
+ margin-bottom: 0;
9
+ }
10
+
11
+ .twitter-typeahead {
12
+ display: block !important;
13
+ }
14
+
15
+ .tt-menu {
16
+ /* make this wide enough to accomodate the org unit code and name */
17
+ width: 400px;
18
+ min-width: 160px;
19
+ margin-top: 2px;
20
+ padding: 5px;
21
+ background-color: #ffffff;
22
+ border: 1px solid #cccccc;
23
+ border: 1px solid rgba(0, 0, 0, 0.15);
24
+ border-radius: 4px;
25
+ -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
26
+ box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
27
+ background-clip: padding-box;
28
+ }
29
+
30
+ .tt-suggestion {
31
+ display: block;
32
+ padding: 3px 20px;
33
+ width: 100%;
34
+ }
35
+
36
+ .tt-suggestion.tt-selectable {
37
+ margin: 5px 0px 5px 0px;
38
+ }
39
+
40
+ .tt-suggestion.tt-cursor {
41
+ color: #fff;
42
+ background-color: #428bca;
43
+ }
44
+
45
+ .tt-suggestion.tt-cursor a {
46
+ color: #fff;
47
+ }
48
+
49
+ .tt-suggestion p {
50
+ margin: 0;
51
+ }
@@ -5,12 +5,12 @@ module UcbRailsUser::SessionsControllerConcerns
5
5
  skip_before_action :ensure_authenticated_user, :log_request, raise: false
6
6
  end
7
7
 
8
- # Redirects to authentication provider
8
+ # Renders login form for authentication provider
9
9
  #
10
10
  # @return [nil]
11
11
  def new
12
- provider = UcbRailsUser[:omniauth_provider] || :cas
13
- redirect_to "/auth/#{provider}"
12
+ @provider = UcbRailsUser[:omniauth_provider] || :cas
13
+ render 'ucb_rails_user/sessions/new'
14
14
  end
15
15
 
16
16
  # Login user after authentication by provider
@@ -32,7 +32,7 @@
32
32
  <ul>
33
33
  <% current_user.recent_impersonations.each do |imp| %>
34
34
  <li>
35
- <%= link_to full_name_with_uid(imp.target), admin_impersonations_path(ucb_rails_user_impersonation: { target_id: imp.target.id }), data: { turbo: true, turbo_method: :post, turbo_frame: "_top" } %>
35
+ <%= link_to full_name_with_uid(imp.target), admin_impersonations_path(ucb_rails_user_impersonation: { target_id: imp.target.id }), data: { turbo_method: :post, turbo_frame: "_top" } %>
36
36
  </li>
37
37
  <% end %>
38
38
  </ul>
@@ -0,0 +1,21 @@
1
+ <div style="display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #f5f5f5;">
2
+ <div style="background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); text-align: center; max-width: 400px; width: 100%;">
3
+ <h1 style="margin-bottom: 1.5rem; color: #333;">Sign In Required</h1>
4
+
5
+ <p style="margin-bottom: 2rem; color: #666;">Please sign in to continue</p>
6
+
7
+ <%= button_to "/auth/#{@provider}",
8
+ method: :post,
9
+ data: { turbo: false },
10
+ style: "background-color: #003262; color: white; padding: 12px 24px; font-size: 16px; border: none; border-radius: 4px; cursor: pointer; width: 100%; font-weight: 500;" do %>
11
+ Sign in with CalNet
12
+ <% end %>
13
+
14
+ <% if Rails.env.development? %>
15
+ <p style="margin-top: 2rem; font-size: 12px; color: #999;">
16
+ Environment: Development<br>
17
+ Provider: <%= @provider %>
18
+ </p>
19
+ <% end %>
20
+ </div>
21
+ </div>
data/config/routes.rb CHANGED
@@ -5,8 +5,8 @@ Rails.application.routes.draw do
5
5
  match "/logout", to: UcbRailsUser::SessionsController.action(:destroy),
6
6
  as: "logout", via: [:all]
7
7
  match "/auth/:omniauth_provider/callback", to: UcbRailsUser::SessionsController.action(:create),
8
- via: [:get]
9
- match "/auth/failure", to: UcbRailsUser::SessionsController.action(:failure), via: [:get]
8
+ via: [:get, :post]
9
+ match "/auth/failure", to: UcbRailsUser::SessionsController.action(:failure), via: [:get, :post]
10
10
  match "/not_authorized", to: UcbRailsUser::SessionsController.action(:not_authorized),
11
11
  as: "not_authorized", via: [:get]
12
12
 
@@ -15,6 +15,14 @@ module UcbRailsUser
15
15
 
16
16
  def configure_omniauth
17
17
  host_name = host
18
+
19
+ # OmniAuth 2: the request phase must be a POST carrying a valid CSRF token
20
+ # (CVE-2015-9284). Never add :get, and never disable request_validation_phase:
21
+ # omniauth-rails_csrf_protection wires it to Rails' forgery protection.
22
+ OmniAuth.config.allowed_request_methods = [:post]
23
+ OmniAuth.config.silence_get_warning = true
24
+ OmniAuth.config.logger = Rails.logger
25
+
18
26
  Rails.application.config.middleware.use OmniAuth::Builder do
19
27
 
20
28
  unless Rails.env.production?
@@ -1,6 +1,4 @@
1
- require 'propshaft'
2
1
  require 'pagy'
3
- require 'importmap-rails'
4
2
  require 'turbo-rails'
5
3
 
6
4
  module UcbRailsUser
@@ -11,7 +9,10 @@ module UcbRailsUser
11
9
  g.fixture_replacement :factory_bot
12
10
  g.factory_bot dir: "spec/factories"
13
11
  end
12
+ # importmap-rails is optional: hosts on Sprockets/esbuild don't need it
14
13
  initializer "ucb_rails_user.importmap", before: "importmap" do |app|
14
+ next unless app.config.respond_to?(:importmap)
15
+
15
16
  # NOTE: this will add pins from this engine to the main app
16
17
  # https://github.com/rails/importmap-rails#composing-import-maps
17
18
  app.config.importmap.paths << root.join("config/importmap.rb")
@@ -4,7 +4,7 @@ module UcbRailsUser
4
4
  def login_user(user)
5
5
  OmniAuth.config.test_mode = true
6
6
  auth_mock(user.ldap_uid)
7
- get "/login"
7
+ post "/auth/cas"
8
8
  follow_redirect!
9
9
  follow_redirect!
10
10
  end
@@ -13,6 +13,7 @@ module UcbRailsUser
13
13
  OmniAuth.config.test_mode = true
14
14
  auth_mock(user.ldap_uid)
15
15
  visit login_path()
16
+ click_on "Sign in with CalNet"
16
17
  end
17
18
 
18
19
  def auth_mock(uid)
@@ -1,3 +1,3 @@
1
1
  module UcbRailsUser
2
- VERSION = '8.0.6'
2
+ VERSION = '9.1.0'
3
3
  end
@@ -2,6 +2,7 @@ require "ucb_rails_user/engine"
2
2
 
3
3
  require "omniauth"
4
4
  require "omniauth-cas"
5
+ require "omniauth/rails_csrf_protection"
5
6
  require "ucb_ldap"
6
7
  require "active_attr"
7
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ucb_rails_user
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.6
4
+ version: 9.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Downey
@@ -10,10 +10,9 @@ authors:
10
10
  - Darin Wilson
11
11
  - Brandon Zylstra
12
12
  - Chris Chernesky
13
- autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
- date: 2026-01-23 00:00:00.000000000 Z
15
+ date: 1980-01-02 00:00:00.000000000 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: rails
@@ -21,7 +20,7 @@ dependencies:
21
20
  requirements:
22
21
  - - ">="
23
22
  - !ruby/object:Gem::Version
24
- version: '8.0'
23
+ version: '8.1'
25
24
  - - "<"
26
25
  - !ruby/object:Gem::Version
27
26
  version: '9.0'
@@ -31,30 +30,10 @@ dependencies:
31
30
  requirements:
32
31
  - - ">="
33
32
  - !ruby/object:Gem::Version
34
- version: '8.0'
33
+ version: '8.1'
35
34
  - - "<"
36
35
  - !ruby/object:Gem::Version
37
36
  version: '9.0'
38
- - !ruby/object:Gem::Dependency
39
- name: propshaft
40
- requirement: !ruby/object:Gem::Requirement
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: 1.1.0
45
- - - "<"
46
- - !ruby/object:Gem::Version
47
- version: '2.0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 1.1.0
55
- - - "<"
56
- - !ruby/object:Gem::Version
57
- version: '2.0'
58
37
  - !ruby/object:Gem::Dependency
59
38
  name: turbo-rails
60
39
  requirement: !ruby/object:Gem::Requirement
@@ -75,26 +54,6 @@ dependencies:
75
54
  - - "<"
76
55
  - !ruby/object:Gem::Version
77
56
  version: '3.0'
78
- - !ruby/object:Gem::Dependency
79
- name: importmap-rails
80
- requirement: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: 2.0.3
85
- - - "<"
86
- - !ruby/object:Gem::Version
87
- version: '3.0'
88
- type: :runtime
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- version: 2.0.3
95
- - - "<"
96
- - !ruby/object:Gem::Version
97
- version: '3.0'
98
57
  - !ruby/object:Gem::Dependency
99
58
  name: active_attr
100
59
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +102,7 @@ dependencies:
143
102
  requirements:
144
103
  - - ">="
145
104
  - !ruby/object:Gem::Version
146
- version: '1.8'
105
+ version: '2.1'
147
106
  - - "<"
148
107
  - !ruby/object:Gem::Version
149
108
  version: '3.0'
@@ -153,7 +112,7 @@ dependencies:
153
112
  requirements:
154
113
  - - ">="
155
114
  - !ruby/object:Gem::Version
156
- version: '1.8'
115
+ version: '2.1'
157
116
  - - "<"
158
117
  - !ruby/object:Gem::Version
159
118
  version: '3.0'
@@ -163,54 +122,114 @@ dependencies:
163
122
  requirements:
164
123
  - - "~>"
165
124
  - !ruby/object:Gem::Version
166
- version: '1.1'
125
+ version: '3.0'
167
126
  type: :runtime
168
127
  prerelease: false
169
128
  version_requirements: !ruby/object:Gem::Requirement
170
129
  requirements:
171
130
  - - "~>"
172
131
  - !ruby/object:Gem::Version
173
- version: '1.1'
132
+ version: '3.0'
174
133
  - !ruby/object:Gem::Dependency
175
- name: ucb_ldap
134
+ name: omniauth-rails_csrf_protection
176
135
  requirement: !ruby/object:Gem::Requirement
177
136
  requirements:
178
- - - "~>"
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '1.0'
140
+ - - "<"
179
141
  - !ruby/object:Gem::Version
180
142
  version: '3.0'
181
143
  type: :runtime
182
144
  prerelease: false
183
145
  version_requirements: !ruby/object:Gem::Requirement
184
146
  requirements:
185
- - - "~>"
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '1.0'
150
+ - - "<"
186
151
  - !ruby/object:Gem::Version
187
152
  version: '3.0'
188
153
  - !ruby/object:Gem::Dependency
189
- name: faraday
154
+ name: ucb_ldap
190
155
  requirement: !ruby/object:Gem::Requirement
191
156
  requirements:
192
157
  - - "~>"
193
158
  - !ruby/object:Gem::Version
194
- version: 2.12.1
159
+ version: '3.2'
195
160
  type: :runtime
196
161
  prerelease: false
197
162
  version_requirements: !ruby/object:Gem::Requirement
198
163
  requirements:
199
164
  - - "~>"
200
165
  - !ruby/object:Gem::Version
201
- version: 2.12.1
166
+ version: '3.2'
167
+ - !ruby/object:Gem::Dependency
168
+ name: faraday
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '2.12'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '2.12'
181
+ - !ruby/object:Gem::Dependency
182
+ name: propshaft
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: 1.1.0
188
+ - - "<"
189
+ - !ruby/object:Gem::Version
190
+ version: '2.0'
191
+ type: :development
192
+ prerelease: false
193
+ version_requirements: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: 1.1.0
198
+ - - "<"
199
+ - !ruby/object:Gem::Version
200
+ version: '2.0'
201
+ - !ruby/object:Gem::Dependency
202
+ name: importmap-rails
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ version: 2.0.3
208
+ - - "<"
209
+ - !ruby/object:Gem::Version
210
+ version: '3.0'
211
+ type: :development
212
+ prerelease: false
213
+ version_requirements: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ version: 2.0.3
218
+ - - "<"
219
+ - !ruby/object:Gem::Version
220
+ version: '3.0'
202
221
  - !ruby/object:Gem::Dependency
203
222
  name: puma
204
223
  requirement: !ruby/object:Gem::Requirement
205
224
  requirements:
206
- - - "~>"
225
+ - - ">="
207
226
  - !ruby/object:Gem::Version
208
227
  version: '6.4'
209
228
  type: :development
210
229
  prerelease: false
211
230
  version_requirements: !ruby/object:Gem::Requirement
212
231
  requirements:
213
- - - "~>"
232
+ - - ">="
214
233
  - !ruby/object:Gem::Version
215
234
  version: '6.4'
216
235
  - !ruby/object:Gem::Dependency
@@ -346,7 +365,7 @@ files:
346
365
  - app/assets/stylesheets/ucb_rails_user/index.sass
347
366
  - app/assets/stylesheets/ucb_rails_user/main.css
348
367
  - app/assets/stylesheets/ucb_rails_user/styles.css
349
- - app/assets/stylesheets/ucb_rails_user/typeahead_tweaks.sass
368
+ - app/assets/stylesheets/ucb_rails_user/typeahead_tweaks.css
350
369
  - app/assets/stylesheets/ucb_rails_user/user.css
351
370
  - app/controllers/concerns/ucb_rails_user/auth_concerns.rb
352
371
  - app/controllers/concerns/ucb_rails_user/home_controller_concerns.rb
@@ -384,6 +403,7 @@ files:
384
403
  - app/views/ucb_rails_user/lps/_modal.html.erb
385
404
  - app/views/ucb_rails_user/lps/_results.html.erb
386
405
  - app/views/ucb_rails_user/lps/search.js.erb
406
+ - app/views/ucb_rails_user/sessions/new.html.erb
387
407
  - app/views/ucb_rails_user/users/_form.html.erb
388
408
  - app/views/ucb_rails_user/users/_search_results.html.erb
389
409
  - app/views/ucb_rails_user/users/_user.html.erb
@@ -414,7 +434,6 @@ homepage: https://github.com/ucb-ist-eas/ucb_rails_user
414
434
  licenses:
415
435
  - MIT
416
436
  metadata: {}
417
- post_install_message:
418
437
  rdoc_options: []
419
438
  require_paths:
420
439
  - lib
@@ -422,15 +441,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
422
441
  requirements:
423
442
  - - ">="
424
443
  - !ruby/object:Gem::Version
425
- version: '0'
444
+ version: 3.4.3
426
445
  required_rubygems_version: !ruby/object:Gem::Requirement
427
446
  requirements:
428
447
  - - ">="
429
448
  - !ruby/object:Gem::Version
430
449
  version: '0'
431
450
  requirements: []
432
- rubygems_version: 3.5.22
433
- signing_key:
451
+ rubygems_version: 4.0.20
434
452
  specification_version: 4
435
453
  summary: Rails engine for UCB user accounts
436
454
  test_files: []
@@ -1,43 +0,0 @@
1
- // Ironically, Bootstrap 3.x breaks styles in typeahead.js - these styles provide the needed repair
2
- // source: https://gist.github.com/AntMooreWebDev/2f7e423a11bc74359323995df4494167
3
-
4
- .twitter-typeahead .tt-query,
5
- .twitter-typeahead .tt-hint
6
- margin-bottom: 0
7
-
8
- .twitter-typeahead
9
- display: block !important
10
-
11
- .tt-menu
12
- // make this wide enough to accomodate the org unit code and name
13
- width: 400px
14
- min-width: 160px
15
- margin-top: 2px
16
- padding: 5px
17
- background-color: #ffffff
18
- border: 1px solid #cccccc
19
- border: 1px solid rgba(0, 0, 0, 0.15)
20
- border-radius: 4px
21
- -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175)
22
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175)
23
- background-clip: padding-box
24
-
25
- .tt-suggestion
26
- display: block
27
- padding: 3px 20px
28
- width: 100%
29
-
30
- .tt-suggestion.tt-selectable
31
- margin: 5px 0px 5px 0px
32
-
33
- .tt-suggestion.tt-cursor
34
- color: #fff
35
- background-color: #428bca
36
-
37
- .tt-suggestion.tt-cursor a
38
- color: #fff
39
-
40
- .tt-suggestion p
41
- margin: 0
42
-
43
-