gds-sso 17.0.0 → 17.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06dbf1fdc3985c8d779b3154021cf5a2ad78a51fcb83fa806a107c3d56b3144e
4
- data.tar.gz: 67f750207a76325b141cdcc62c741831ecc30e798c040a6bb1cd12eb7e5873ac
3
+ metadata.gz: 299db37f74135bea6ee6479680dc31be21a3aab23a661ce27548f566829dd1d2
4
+ data.tar.gz: c440c23020cc6fd40294ccdb69031e6ea163ff29f3d33c8755fe7c725d4c24d3
5
5
  SHA512:
6
- metadata.gz: e7e766717d3718271c84f10695288afb2aed6f1561a3684d1af95d94e1367f4b694345be3c164969d234260adb7ac9a1ee2b8f6d1afed137440d08cb5034e68e
7
- data.tar.gz: 2a1b36ca0bb68cf8c3034c105ca506dc6e351b76ba1b1ac104e565de7dc6ff71d0baad87f9afe15a657f88569360edf0d78904fe5aa80b030c62b0c433845404
6
+ metadata.gz: 1e6fead794241c45cdc8a0e23fd1734b11c8e1edad85d3eef4d56867d0bacbed944b1d083745c24573c5886df35f3f4d07d39c3a14966c0840a06736c0ebb548
7
+ data.tar.gz: 16850d916b1b8e0cfb2a974f171e3eb5c7625ef88b1a4abe4ec59bc5edcf90579b231890297f276974b5dd233ae45dd7c4184ca5324617558ab44f3529210bde
data/Rakefile CHANGED
@@ -1,24 +1,8 @@
1
- require "bundler/setup"
2
1
  require "bundler/gem_tasks"
3
-
4
- Bundler::GemHelper.install_tasks
5
-
6
2
  require "rspec/core/rake_task"
7
- desc "Run all specs"
8
- RSpec::Core::RakeTask.new(:spec) do |task|
9
- task.pattern = "spec/**/*_spec.rb"
10
- end
11
-
12
- namespace :spec do
13
- desc "Run integration specs"
14
- RSpec::Core::RakeTask.new(:integration) do |task|
15
- task.pattern = "spec/integration/**/*_spec.rb"
16
- end
17
- end
3
+ require "rubocop/rake_task"
18
4
 
19
- desc "Lint Ruby"
20
- task :lint do
21
- sh "bundle exec rubocop --format clang"
22
- end
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ RuboCop::RakeTask.new
23
7
 
24
- task default: %i[spec lint]
8
+ task default: %i[rubocop spec]
@@ -23,7 +23,7 @@ class Api::UserController < ActionController::Base
23
23
 
24
24
  private
25
25
 
26
- # This should mirror the object created by the omniauth-gds strategy/gem
26
+ # This should mirror the object created by OmniAuth::Strategies::Gds
27
27
  # By doing this, we can reuse the code for creating/updating the user
28
28
  def build_gds_oauth_hash(user_json)
29
29
  OmniAuth::AuthHash.new(
@@ -1,4 +1,4 @@
1
- require "multi_json"
1
+ require "json"
2
2
  require "oauth2"
3
3
  require "gds-sso/version"
4
4
 
@@ -35,7 +35,7 @@ module GDS
35
35
  # structure. Here we're addressing signon directly so
36
36
  # we need to transform the response ourselves.
37
37
  def self.omniauth_style_response(response_body)
38
- input = MultiJson.decode(response_body)["user"]
38
+ input = JSON.parse(response_body).fetch("user")
39
39
 
40
40
  {
41
41
  "uid" => input["uid"],
@@ -1,5 +1,5 @@
1
1
  module GDS
2
2
  module SSO
3
- VERSION = "17.0.0".freeze
3
+ VERSION = "17.1.1".freeze
4
4
  end
5
5
  end
data/lib/gds-sso.rb CHANGED
@@ -4,7 +4,7 @@ require "gds-sso/config"
4
4
  require "gds-sso/version"
5
5
  require "gds-sso/warden_config"
6
6
  require "omniauth"
7
- require "omniauth-gds"
7
+ require "omniauth/strategies/gds"
8
8
 
9
9
  require "gds-sso/railtie" if defined?(Rails)
10
10
 
@@ -0,0 +1,26 @@
1
+ require "omniauth-oauth2"
2
+ require "json"
3
+
4
+ class OmniAuth::Strategies::Gds < OmniAuth::Strategies::OAuth2
5
+ uid { user["uid"] }
6
+
7
+ info do
8
+ {
9
+ name: user["name"],
10
+ email: user["email"],
11
+ }
12
+ end
13
+
14
+ extra do
15
+ {
16
+ user: user,
17
+ permissions: user["permissions"],
18
+ organisation_slug: user["organisation_slug"],
19
+ organisation_content_id: user["organisation_content_id"],
20
+ }
21
+ end
22
+
23
+ def user
24
+ @user ||= JSON.parse(access_token.get("/user.json?client_id=#{CGI.escape(options.client_id)}").body).fetch("user")
25
+ end
26
+ end
metadata CHANGED
@@ -1,111 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-sso
3
3
  version: !ruby/object:Gem::Version
4
- version: 17.0.0
4
+ version: 17.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-25 00:00:00.000000000 Z
11
+ date: 2022-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: multi_json
14
+ name: oauth2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
27
- - !ruby/object:Gem::Dependency
28
- name: oauth2
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '1'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '3'
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '1'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '3'
26
+ version: '2.0'
47
27
  - !ruby/object:Gem::Dependency
48
28
  name: omniauth
49
29
  requirement: !ruby/object:Gem::Requirement
50
30
  requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '1.2'
54
- - - "<"
31
+ - - "~>"
55
32
  - !ruby/object:Gem::Version
56
- version: '3.0'
33
+ version: '2.1'
57
34
  type: :runtime
58
35
  prerelease: false
59
36
  version_requirements: !ruby/object:Gem::Requirement
60
37
  requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: '1.2'
64
- - - "<"
38
+ - - "~>"
65
39
  - !ruby/object:Gem::Version
66
- version: '3.0'
40
+ version: '2.1'
67
41
  - !ruby/object:Gem::Dependency
68
- name: omniauth-gds
42
+ name: omniauth-oauth2
69
43
  requirement: !ruby/object:Gem::Requirement
70
44
  requirements:
71
45
  - - "~>"
72
46
  - !ruby/object:Gem::Version
73
- version: '3.2'
47
+ version: '1.8'
74
48
  type: :runtime
75
49
  prerelease: false
76
50
  version_requirements: !ruby/object:Gem::Requirement
77
51
  requirements:
78
52
  - - "~>"
79
53
  - !ruby/object:Gem::Version
80
- version: '3.2'
54
+ version: '1.8'
81
55
  - !ruby/object:Gem::Dependency
82
56
  name: plek
83
57
  requirement: !ruby/object:Gem::Requirement
84
58
  requirements:
85
- - - "~>"
59
+ - - ">="
86
60
  - !ruby/object:Gem::Version
87
- version: '4.0'
61
+ version: '4'
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '6'
88
65
  type: :runtime
89
66
  prerelease: false
90
67
  version_requirements: !ruby/object:Gem::Requirement
91
68
  requirements:
92
- - - "~>"
69
+ - - ">="
93
70
  - !ruby/object:Gem::Version
94
- version: '4.0'
71
+ version: '4'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '6'
95
75
  - !ruby/object:Gem::Dependency
96
76
  name: rails
97
77
  requirement: !ruby/object:Gem::Requirement
98
78
  requirements:
99
79
  - - ">="
100
80
  - !ruby/object:Gem::Version
101
- version: '5'
81
+ version: '6'
102
82
  type: :runtime
103
83
  prerelease: false
104
84
  version_requirements: !ruby/object:Gem::Requirement
105
85
  requirements:
106
86
  - - ">="
107
87
  - !ruby/object:Gem::Version
108
- version: '5'
88
+ version: '6'
109
89
  - !ruby/object:Gem::Dependency
110
90
  name: warden
111
91
  requirement: !ruby/object:Gem::Requirement
@@ -138,128 +118,120 @@ dependencies:
138
118
  name: capybara
139
119
  requirement: !ruby/object:Gem::Requirement
140
120
  requirements:
141
- - - ">="
121
+ - - "~>"
142
122
  - !ruby/object:Gem::Version
143
- version: '2'
123
+ version: '3'
144
124
  type: :development
145
125
  prerelease: false
146
126
  version_requirements: !ruby/object:Gem::Requirement
147
127
  requirements:
148
- - - ">="
128
+ - - "~>"
149
129
  - !ruby/object:Gem::Version
150
- version: '2'
130
+ version: '3'
151
131
  - !ruby/object:Gem::Dependency
152
132
  name: capybara-mechanize
153
133
  requirement: !ruby/object:Gem::Requirement
154
134
  requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- version: '1'
158
- type: :development
159
- prerelease: false
160
- version_requirements: !ruby/object:Gem::Requirement
161
- requirements:
162
- - - ">="
135
+ - - "~>"
163
136
  - !ruby/object:Gem::Version
164
137
  version: '1'
165
- - !ruby/object:Gem::Dependency
166
- name: combustion
167
- requirement: !ruby/object:Gem::Requirement
168
- requirements:
169
138
  - - ">="
170
139
  - !ruby/object:Gem::Version
171
- version: '0.9'
140
+ version: 1.12.1
172
141
  type: :development
173
142
  prerelease: false
174
143
  version_requirements: !ruby/object:Gem::Requirement
175
144
  requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: '1'
176
148
  - - ">="
177
149
  - !ruby/object:Gem::Version
178
- version: '0.9'
150
+ version: 1.12.1
179
151
  - !ruby/object:Gem::Dependency
180
- name: net-smtp
152
+ name: combustion
181
153
  requirement: !ruby/object:Gem::Requirement
182
154
  requirements:
183
155
  - - "~>"
184
156
  - !ruby/object:Gem::Version
185
- version: 0.3.1
157
+ version: '1.3'
186
158
  type: :development
187
159
  prerelease: false
188
160
  version_requirements: !ruby/object:Gem::Requirement
189
161
  requirements:
190
162
  - - "~>"
191
163
  - !ruby/object:Gem::Version
192
- version: 0.3.1
164
+ version: '1.3'
193
165
  - !ruby/object:Gem::Dependency
194
166
  name: rake
195
167
  requirement: !ruby/object:Gem::Requirement
196
168
  requirements:
197
169
  - - ">="
198
170
  - !ruby/object:Gem::Version
199
- version: '0.9'
171
+ version: '0'
200
172
  type: :development
201
173
  prerelease: false
202
174
  version_requirements: !ruby/object:Gem::Requirement
203
175
  requirements:
204
176
  - - ">="
205
177
  - !ruby/object:Gem::Version
206
- version: '0.9'
178
+ version: '0'
207
179
  - !ruby/object:Gem::Dependency
208
180
  name: rspec-rails
209
181
  requirement: !ruby/object:Gem::Requirement
210
182
  requirements:
211
- - - ">="
183
+ - - "~>"
212
184
  - !ruby/object:Gem::Version
213
- version: '3'
185
+ version: '6'
214
186
  type: :development
215
187
  prerelease: false
216
188
  version_requirements: !ruby/object:Gem::Requirement
217
189
  requirements:
218
- - - ">="
190
+ - - "~>"
219
191
  - !ruby/object:Gem::Version
220
- version: '3'
192
+ version: '6'
221
193
  - !ruby/object:Gem::Dependency
222
194
  name: rubocop-govuk
223
195
  requirement: !ruby/object:Gem::Requirement
224
196
  requirements:
225
- - - ">="
197
+ - - '='
226
198
  - !ruby/object:Gem::Version
227
- version: '0'
199
+ version: 4.8.0
228
200
  type: :development
229
201
  prerelease: false
230
202
  version_requirements: !ruby/object:Gem::Requirement
231
203
  requirements:
232
- - - ">="
204
+ - - '='
233
205
  - !ruby/object:Gem::Version
234
- version: '0'
206
+ version: 4.8.0
235
207
  - !ruby/object:Gem::Dependency
236
208
  name: sqlite3
237
209
  requirement: !ruby/object:Gem::Requirement
238
210
  requirements:
239
211
  - - "~>"
240
212
  - !ruby/object:Gem::Version
241
- version: '1.4'
213
+ version: '1.5'
242
214
  type: :development
243
215
  prerelease: false
244
216
  version_requirements: !ruby/object:Gem::Requirement
245
217
  requirements:
246
218
  - - "~>"
247
219
  - !ruby/object:Gem::Version
248
- version: '1.4'
220
+ version: '1.5'
249
221
  - !ruby/object:Gem::Dependency
250
222
  name: timecop
251
223
  requirement: !ruby/object:Gem::Requirement
252
224
  requirements:
253
- - - ">="
225
+ - - "~>"
254
226
  - !ruby/object:Gem::Version
255
- version: '0.3'
227
+ version: '0.9'
256
228
  type: :development
257
229
  prerelease: false
258
230
  version_requirements: !ruby/object:Gem::Requirement
259
231
  requirements:
260
- - - ">="
232
+ - - "~>"
261
233
  - !ruby/object:Gem::Version
262
- version: '0.3'
234
+ version: '0.9'
263
235
  description: Client for GDS' OAuth 2-based SSO
264
236
  email:
265
237
  - govuk-dev@digital.cabinet-office.gov.uk
@@ -289,6 +261,7 @@ files:
289
261
  - lib/gds-sso/user.rb
290
262
  - lib/gds-sso/version.rb
291
263
  - lib/gds-sso/warden_config.rb
264
+ - lib/omniauth/strategies/gds.rb
292
265
  - spec/controller/api_user_controller_spec.rb
293
266
  - spec/controller/controller_methods_spec.rb
294
267
  - spec/fixtures/integration/authorize_api_users.sql
@@ -337,37 +310,37 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
310
  - !ruby/object:Gem::Version
338
311
  version: '0'
339
312
  requirements: []
340
- rubygems_version: 3.3.18
313
+ rubygems_version: 3.3.26
341
314
  signing_key:
342
315
  specification_version: 4
343
316
  summary: Client for GDS' OAuth 2-based SSO
344
317
  test_files:
318
+ - spec/spec_helper.rb
345
319
  - spec/fixtures/integration/signon.sql
346
320
  - spec/fixtures/integration/authorize_api_users.sql
347
321
  - spec/requests/end_to_end_spec.rb
348
- - spec/spec_helper.rb
349
- - spec/internal/public/favicon.ico
322
+ - spec/support/controller_spy.rb
323
+ - spec/support/timecop.rb
324
+ - spec/support/serializable_user.rb
325
+ - spec/support/test_user.rb
326
+ - spec/support/signon_integration_helpers.rb
327
+ - spec/support/backport_controller_test_params.rb
328
+ - spec/controller/api_user_controller_spec.rb
329
+ - spec/controller/controller_methods_spec.rb
330
+ - spec/internal/config/routes.rb
350
331
  - spec/internal/config/database.yml
351
332
  - spec/internal/config/initializers/gds-sso.rb
352
- - spec/internal/config/routes.rb
353
333
  - spec/internal/config/storage.yml
354
334
  - spec/internal/app/models/user.rb
355
- - spec/internal/app/controllers/application_controller.rb
356
335
  - spec/internal/app/controllers/example_controller.rb
336
+ - spec/internal/app/controllers/application_controller.rb
357
337
  - spec/internal/app/assets/config/manifest.js
358
338
  - spec/internal/db/schema.rb
359
- - spec/unit/api_access_spec.rb
360
- - spec/unit/config_spec.rb
339
+ - spec/internal/public/favicon.ico
340
+ - spec/unit/mock_bearer_token_spec.rb
361
341
  - spec/unit/bearer_token_spec.rb
362
- - spec/unit/railtie_spec.rb
342
+ - spec/unit/api_access_spec.rb
363
343
  - spec/unit/user_spec.rb
364
- - spec/unit/mock_bearer_token_spec.rb
365
344
  - spec/unit/session_serialisation_spec.rb
366
- - spec/support/test_user.rb
367
- - spec/support/timecop.rb
368
- - spec/support/signon_integration_helpers.rb
369
- - spec/support/backport_controller_test_params.rb
370
- - spec/support/controller_spy.rb
371
- - spec/support/serializable_user.rb
372
- - spec/controller/controller_methods_spec.rb
373
- - spec/controller/api_user_controller_spec.rb
345
+ - spec/unit/config_spec.rb
346
+ - spec/unit/railtie_spec.rb