gds-sso 16.1.0 → 17.1.0

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: 68d52bff4bfbb14f4bbf15b0cb1a50aa3e0a7dc2c5bb878fac313f7d5d2d5176
4
- data.tar.gz: 00a89b7a401bb7fa4f5378522eac3248757dcab45b6c078d5e55e71f08638c8d
3
+ metadata.gz: d7f870087f36397c1031d6d643965cc1e23be8bdecf6406ac8b3e348013aea1b
4
+ data.tar.gz: bc3c98cbf8445456860239438bd879a467687a679458d9de6271e8e8ab6f76ad
5
5
  SHA512:
6
- metadata.gz: 1b806fd8e9dc753b82e1064798693241f9e9f573d4ab76def2f24af754a1399f517891fadb0cd709a2491da41a9377958378daaf5d00b82e5bd80aa031c9ffc3
7
- data.tar.gz: 5512a069b49a307da70325f56751b382394269eaf2ca2ed21d2802684f9e860e5f2b2b92ddf0cb008984622dd8225b78a74d838c2c4b35e63a64cf2792cfe765
6
+ metadata.gz: d50863d1fc36a26d174d39956c1c519d1a8da76bfbf0476702d51c9e1da390abe16a9596cc18a8f762e673376d7d87bf8a0a58af879e9149a5f29f7c54170523
7
+ data.tar.gz: 007121f42d7fc57174af25b0181f02bafa3b0503fc81255991cd38688ec8e9523f5bc9024b6c500b20847eb398454918f48113a5f1bce61c66366433060e648f
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]
@@ -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 = "16.1.0".freeze
3
+ VERSION = "17.1.0".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
@@ -1,7 +1,7 @@
1
1
  DELETE FROM `oauth_access_tokens`;
2
2
 
3
3
  INSERT INTO oauth_access_tokens (resource_owner_id, application_id, token, refresh_token, expires_in, created_at)
4
- VALUES (1, 1, 'caaeb53be5c7277fb0ef158181bfd1537b57f9e3b83eb795be3cd0af6e118b28', '1bc343797483954d7306d67e96687feccdfdaa8b23ed662ae23e2b03e6661d16', 30758400000, '2012-06-27 13:57:47');
4
+ VALUES (1, 1, 'caaeb53be5c7277fb0ef158181bfd1537b57f9e3b83eb795be3cd0af6e118b28', '1bc343797483954d7306d67e96687feccdfdaa8b23ed662ae23e2b03e6661d16', POW(2, 31)-1, '2012-06-27 13:57:47');
5
5
 
6
6
  INSERT INTO oauth_access_tokens (resource_owner_id, application_id, token, refresh_token, expires_in, created_at)
7
- VALUES (1, 2, '98c72f4da02fdc43398e029d05567542944d2a9b0df3c20b0accd8bd6c5dc728', 'e2da0489a58219fd4f542139909737627874ceacd2af23f5c268ccecb36e85af', 30758400000, '2014-07-14 09:06:14');
7
+ VALUES (1, 2, '98c72f4da02fdc43398e029d05567542944d2a9b0df3c20b0accd8bd6c5dc728', 'e2da0489a58219fd4f542139909737627874ceacd2af23f5c268ccecb36e85af', POW(2, 31)-1, '2014-07-14 09:06:14');
metadata CHANGED
@@ -1,77 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-sso
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.1.0
4
+ version: 17.1.0
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-04-07 00:00:00.000000000 Z
11
+ date: 2022-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: multi_json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: oauth2
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '1.0'
19
+ version: '2.0'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '1.0'
26
+ version: '2.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: omniauth
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '1.2'
48
- - - "<"
31
+ - - "~>"
49
32
  - !ruby/object:Gem::Version
50
- version: '3.0'
33
+ version: '2.1'
51
34
  type: :runtime
52
35
  prerelease: false
53
36
  version_requirements: !ruby/object:Gem::Requirement
54
37
  requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: '1.2'
58
- - - "<"
38
+ - - "~>"
59
39
  - !ruby/object:Gem::Version
60
- version: '3.0'
40
+ version: '2.1'
61
41
  - !ruby/object:Gem::Dependency
62
- name: omniauth-gds
42
+ name: omniauth-oauth2
63
43
  requirement: !ruby/object:Gem::Requirement
64
44
  requirements:
65
45
  - - "~>"
66
46
  - !ruby/object:Gem::Version
67
- version: '3.2'
47
+ version: '1.8'
68
48
  type: :runtime
69
49
  prerelease: false
70
50
  version_requirements: !ruby/object:Gem::Requirement
71
51
  requirements:
72
52
  - - "~>"
73
53
  - !ruby/object:Gem::Version
74
- version: '3.2'
54
+ version: '1.8'
75
55
  - !ruby/object:Gem::Dependency
76
56
  name: plek
77
57
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +72,14 @@ dependencies:
92
72
  requirements:
93
73
  - - ">="
94
74
  - !ruby/object:Gem::Version
95
- version: '5'
75
+ version: '6'
96
76
  type: :runtime
97
77
  prerelease: false
98
78
  version_requirements: !ruby/object:Gem::Requirement
99
79
  requirements:
100
80
  - - ">="
101
81
  - !ruby/object:Gem::Version
102
- version: '5'
82
+ version: '6'
103
83
  - !ruby/object:Gem::Dependency
104
84
  name: warden
105
85
  requirement: !ruby/object:Gem::Requirement
@@ -132,114 +112,120 @@ dependencies:
132
112
  name: capybara
133
113
  requirement: !ruby/object:Gem::Requirement
134
114
  requirements:
135
- - - ">="
115
+ - - "~>"
136
116
  - !ruby/object:Gem::Version
137
- version: '2'
117
+ version: '3'
138
118
  type: :development
139
119
  prerelease: false
140
120
  version_requirements: !ruby/object:Gem::Requirement
141
121
  requirements:
142
- - - ">="
122
+ - - "~>"
143
123
  - !ruby/object:Gem::Version
144
- version: '2'
124
+ version: '3'
145
125
  - !ruby/object:Gem::Dependency
146
126
  name: capybara-mechanize
147
127
  requirement: !ruby/object:Gem::Requirement
148
128
  requirements:
149
- - - ">="
129
+ - - "~>"
150
130
  - !ruby/object:Gem::Version
151
131
  version: '1'
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 1.12.1
152
135
  type: :development
153
136
  prerelease: false
154
137
  version_requirements: !ruby/object:Gem::Requirement
155
138
  requirements:
156
- - - ">="
139
+ - - "~>"
157
140
  - !ruby/object:Gem::Version
158
141
  version: '1'
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 1.12.1
159
145
  - !ruby/object:Gem::Dependency
160
146
  name: combustion
161
147
  requirement: !ruby/object:Gem::Requirement
162
148
  requirements:
163
- - - ">="
149
+ - - "~>"
164
150
  - !ruby/object:Gem::Version
165
- version: '0.9'
151
+ version: '1.3'
166
152
  type: :development
167
153
  prerelease: false
168
154
  version_requirements: !ruby/object:Gem::Requirement
169
155
  requirements:
170
- - - ">="
156
+ - - "~>"
171
157
  - !ruby/object:Gem::Version
172
- version: '0.9'
158
+ version: '1.3'
173
159
  - !ruby/object:Gem::Dependency
174
160
  name: rake
175
161
  requirement: !ruby/object:Gem::Requirement
176
162
  requirements:
177
163
  - - ">="
178
164
  - !ruby/object:Gem::Version
179
- version: '0.9'
165
+ version: '0'
180
166
  type: :development
181
167
  prerelease: false
182
168
  version_requirements: !ruby/object:Gem::Requirement
183
169
  requirements:
184
170
  - - ">="
185
171
  - !ruby/object:Gem::Version
186
- version: '0.9'
172
+ version: '0'
187
173
  - !ruby/object:Gem::Dependency
188
174
  name: rspec-rails
189
175
  requirement: !ruby/object:Gem::Requirement
190
176
  requirements:
191
- - - ">="
177
+ - - "~>"
192
178
  - !ruby/object:Gem::Version
193
- version: '3'
179
+ version: '6'
194
180
  type: :development
195
181
  prerelease: false
196
182
  version_requirements: !ruby/object:Gem::Requirement
197
183
  requirements:
198
- - - ">="
184
+ - - "~>"
199
185
  - !ruby/object:Gem::Version
200
- version: '3'
186
+ version: '6'
201
187
  - !ruby/object:Gem::Dependency
202
188
  name: rubocop-govuk
203
189
  requirement: !ruby/object:Gem::Requirement
204
190
  requirements:
205
- - - ">="
191
+ - - '='
206
192
  - !ruby/object:Gem::Version
207
- version: '0'
193
+ version: 4.8.0
208
194
  type: :development
209
195
  prerelease: false
210
196
  version_requirements: !ruby/object:Gem::Requirement
211
197
  requirements:
212
- - - ">="
198
+ - - '='
213
199
  - !ruby/object:Gem::Version
214
- version: '0'
200
+ version: 4.8.0
215
201
  - !ruby/object:Gem::Dependency
216
202
  name: sqlite3
217
203
  requirement: !ruby/object:Gem::Requirement
218
204
  requirements:
219
205
  - - "~>"
220
206
  - !ruby/object:Gem::Version
221
- version: '1.4'
207
+ version: '1.5'
222
208
  type: :development
223
209
  prerelease: false
224
210
  version_requirements: !ruby/object:Gem::Requirement
225
211
  requirements:
226
212
  - - "~>"
227
213
  - !ruby/object:Gem::Version
228
- version: '1.4'
214
+ version: '1.5'
229
215
  - !ruby/object:Gem::Dependency
230
216
  name: timecop
231
217
  requirement: !ruby/object:Gem::Requirement
232
218
  requirements:
233
- - - ">="
219
+ - - "~>"
234
220
  - !ruby/object:Gem::Version
235
- version: '0.3'
221
+ version: '0.9'
236
222
  type: :development
237
223
  prerelease: false
238
224
  version_requirements: !ruby/object:Gem::Requirement
239
225
  requirements:
240
- - - ">="
226
+ - - "~>"
241
227
  - !ruby/object:Gem::Version
242
- version: '0.3'
228
+ version: '0.9'
243
229
  description: Client for GDS' OAuth 2-based SSO
244
230
  email:
245
231
  - govuk-dev@digital.cabinet-office.gov.uk
@@ -269,6 +255,7 @@ files:
269
255
  - lib/gds-sso/user.rb
270
256
  - lib/gds-sso/version.rb
271
257
  - lib/gds-sso/warden_config.rb
258
+ - lib/omniauth/strategies/gds.rb
272
259
  - spec/controller/api_user_controller_spec.rb
273
260
  - spec/controller/controller_methods_spec.rb
274
261
  - spec/fixtures/integration/authorize_api_users.sql
@@ -281,9 +268,7 @@ files:
281
268
  - spec/internal/config/initializers/gds-sso.rb
282
269
  - spec/internal/config/routes.rb
283
270
  - spec/internal/config/storage.yml
284
- - spec/internal/db/combustion_test.sqlite
285
271
  - spec/internal/db/schema.rb
286
- - spec/internal/log/test.log
287
272
  - spec/internal/public/favicon.ico
288
273
  - spec/requests/end_to_end_spec.rb
289
274
  - spec/spec_helper.rb
@@ -312,46 +297,44 @@ required_ruby_version: !ruby/object:Gem::Requirement
312
297
  requirements:
313
298
  - - ">="
314
299
  - !ruby/object:Gem::Version
315
- version: '2.6'
300
+ version: '2.7'
316
301
  required_rubygems_version: !ruby/object:Gem::Requirement
317
302
  requirements:
318
303
  - - ">="
319
304
  - !ruby/object:Gem::Version
320
305
  version: '0'
321
306
  requirements: []
322
- rubygems_version: 3.1.6
307
+ rubygems_version: 3.3.24
323
308
  signing_key:
324
309
  specification_version: 4
325
310
  summary: Client for GDS' OAuth 2-based SSO
326
311
  test_files:
312
+ - spec/spec_helper.rb
313
+ - spec/fixtures/integration/signon.sql
314
+ - spec/fixtures/integration/authorize_api_users.sql
327
315
  - spec/requests/end_to_end_spec.rb
316
+ - spec/support/controller_spy.rb
317
+ - spec/support/timecop.rb
318
+ - spec/support/serializable_user.rb
319
+ - spec/support/test_user.rb
320
+ - spec/support/signon_integration_helpers.rb
321
+ - spec/support/backport_controller_test_params.rb
322
+ - spec/controller/api_user_controller_spec.rb
323
+ - spec/controller/controller_methods_spec.rb
324
+ - spec/internal/config/routes.rb
325
+ - spec/internal/config/database.yml
326
+ - spec/internal/config/initializers/gds-sso.rb
327
+ - spec/internal/config/storage.yml
328
328
  - spec/internal/app/models/user.rb
329
329
  - spec/internal/app/controllers/example_controller.rb
330
330
  - spec/internal/app/controllers/application_controller.rb
331
331
  - spec/internal/app/assets/config/manifest.js
332
- - spec/internal/db/combustion_test.sqlite
333
332
  - spec/internal/db/schema.rb
334
333
  - spec/internal/public/favicon.ico
335
- - spec/internal/log/test.log
336
- - spec/internal/config/routes.rb
337
- - spec/internal/config/storage.yml
338
- - spec/internal/config/initializers/gds-sso.rb
339
- - spec/internal/config/database.yml
340
- - spec/fixtures/integration/authorize_api_users.sql
341
- - spec/fixtures/integration/signon.sql
342
- - spec/spec_helper.rb
343
- - spec/controller/api_user_controller_spec.rb
344
- - spec/controller/controller_methods_spec.rb
334
+ - spec/unit/mock_bearer_token_spec.rb
345
335
  - spec/unit/bearer_token_spec.rb
346
336
  - spec/unit/api_access_spec.rb
347
- - spec/unit/config_spec.rb
337
+ - spec/unit/user_spec.rb
348
338
  - spec/unit/session_serialisation_spec.rb
339
+ - spec/unit/config_spec.rb
349
340
  - spec/unit/railtie_spec.rb
350
- - spec/unit/user_spec.rb
351
- - spec/unit/mock_bearer_token_spec.rb
352
- - spec/support/test_user.rb
353
- - spec/support/controller_spy.rb
354
- - spec/support/timecop.rb
355
- - spec/support/serializable_user.rb
356
- - spec/support/backport_controller_test_params.rb
357
- - spec/support/signon_integration_helpers.rb