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 +4 -4
- data/Rakefile +4 -20
- data/app/controllers/api/user_controller.rb +1 -1
- data/lib/gds-sso/bearer_token.rb +2 -2
- data/lib/gds-sso/version.rb +1 -1
- data/lib/gds-sso.rb +1 -1
- data/lib/omniauth/strategies/gds.rb +26 -0
- metadata +71 -98
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299db37f74135bea6ee6479680dc31be21a3aab23a661ce27548f566829dd1d2
|
4
|
+
data.tar.gz: c440c23020cc6fd40294ccdb69031e6ea163ff29f3d33c8755fe7c725d4c24d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
20
|
-
|
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
|
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
|
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(
|
data/lib/gds-sso/bearer_token.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
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 =
|
38
|
+
input = JSON.parse(response_body).fetch("user")
|
39
39
|
|
40
40
|
{
|
41
41
|
"uid" => input["uid"],
|
data/lib/gds-sso/version.rb
CHANGED
data/lib/gds-sso.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2022-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: oauth2
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
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: '
|
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: '
|
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: '
|
40
|
+
version: '2.1'
|
67
41
|
- !ruby/object:Gem::Dependency
|
68
|
-
name: omniauth-
|
42
|
+
name: omniauth-oauth2
|
69
43
|
requirement: !ruby/object:Gem::Requirement
|
70
44
|
requirements:
|
71
45
|
- - "~>"
|
72
46
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
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: '
|
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
|
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
|
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: '
|
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: '
|
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: '
|
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: '
|
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:
|
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:
|
150
|
+
version: 1.12.1
|
179
151
|
- !ruby/object:Gem::Dependency
|
180
|
-
name:
|
152
|
+
name: combustion
|
181
153
|
requirement: !ruby/object:Gem::Requirement
|
182
154
|
requirements:
|
183
155
|
- - "~>"
|
184
156
|
- !ruby/object:Gem::Version
|
185
|
-
version:
|
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:
|
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
|
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
|
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: '
|
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: '
|
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:
|
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:
|
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.
|
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.
|
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.
|
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.
|
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.
|
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/
|
349
|
-
- spec/
|
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/
|
360
|
-
- spec/unit/
|
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/
|
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/
|
367
|
-
- spec/
|
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
|