gds-sso 13.3.0 → 13.4.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 +1 -1
- data/lib/gds-sso/bearer_token.rb +1 -1
- data/lib/gds-sso/config.rb +7 -1
- data/lib/gds-sso/version.rb +1 -1
- data/spec/fixtures/integration/{signonotron2.sql → signon.sql} +0 -0
- data/spec/internal/db/combustion_test.sqlite +0 -0
- data/spec/internal/log/test.log +874 -874
- data/spec/requests/end_to_end_spec.rb +8 -8
- data/spec/support/{signonotron2_integration_helpers.rb → signon_integration_helpers.rb} +14 -14
- metadata +24 -26
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'timecop'
|
3
3
|
|
4
|
-
describe "Integration of client using GDS-SSO with
|
5
|
-
include
|
4
|
+
describe "Integration of client using GDS-SSO with signon" do
|
5
|
+
include SignonIntegrationHelpers
|
6
6
|
|
7
7
|
before :all do
|
8
|
-
|
8
|
+
wait_for_signon_to_start
|
9
9
|
end
|
10
10
|
|
11
11
|
before :each do
|
@@ -15,7 +15,7 @@ describe "Integration of client using GDS-SSO with signonotron" do
|
|
15
15
|
Capybara.current_driver = :mechanize
|
16
16
|
Capybara::Mechanize.local_hosts << @client_host
|
17
17
|
|
18
|
-
|
18
|
+
load_signon_setup_fixture
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "Web client accesses" do
|
@@ -114,7 +114,7 @@ describe "Integration of client using GDS-SSO with signonotron" do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
describe "session expiry" do
|
117
|
-
it "should force you to re-authenticate with
|
117
|
+
it "should force you to re-authenticate with signon N hours after login" do
|
118
118
|
visit "http://#{@client_host}/restricted"
|
119
119
|
expect(page).to have_content("Sign in")
|
120
120
|
fill_in "Email", :with => "test@example-client.com"
|
@@ -132,7 +132,7 @@ describe "Integration of client using GDS-SSO with signonotron" do
|
|
132
132
|
expect(page).to have_content("Sign in")
|
133
133
|
end
|
134
134
|
|
135
|
-
it "should accept
|
135
|
+
it "should accept signon's remembered authentication N hours after login" do
|
136
136
|
visit "http://#{@client_host}/restricted"
|
137
137
|
expect(page).to have_content("Sign in")
|
138
138
|
fill_in "Email", :with => "test@example-client.com"
|
@@ -149,7 +149,7 @@ describe "Integration of client using GDS-SSO with signonotron" do
|
|
149
149
|
end
|
150
150
|
|
151
151
|
|
152
|
-
it "should not require re-authentication with
|
152
|
+
it "should not require re-authentication with signon fewer than N hours after login" do
|
153
153
|
visit "http://#{@client_host}/restricted"
|
154
154
|
expect(page).to have_content("Sign in")
|
155
155
|
fill_in "Email", :with => "test@example-client.com"
|
@@ -170,7 +170,7 @@ describe "Integration of client using GDS-SSO with signonotron" do
|
|
170
170
|
describe "OAuth based API client accesses" do
|
171
171
|
before :each do
|
172
172
|
page.driver.header 'accept', 'application/json'
|
173
|
-
|
173
|
+
authorize_signon_api_user
|
174
174
|
|
175
175
|
token = "caaeb53be5c7277fb0ef158181bfd1537b57f9e3b83eb795be3cd0af6e118b28"
|
176
176
|
page.driver.header 'authorization', "Bearer #{token}"
|
@@ -1,22 +1,22 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
|
3
|
-
module
|
4
|
-
def
|
3
|
+
module SignonIntegrationHelpers
|
4
|
+
def wait_for_signon_to_start
|
5
5
|
retries = 0
|
6
6
|
url = GDS::SSO::Config.oauth_root_url
|
7
|
-
puts "Waiting for
|
8
|
-
while !
|
7
|
+
puts "Waiting for signon to start at #{url}"
|
8
|
+
while ! signon_started?(url)
|
9
9
|
print '.'
|
10
10
|
if retries > 20
|
11
|
-
raise "
|
11
|
+
raise "Signon is not running at #{url}. Please start with `./start_signon.sh`. Under jenkins this should happen automatically."
|
12
12
|
end
|
13
13
|
retries += 1
|
14
14
|
sleep 1
|
15
15
|
end
|
16
|
-
puts "
|
16
|
+
puts "Signon is now running at #{url}"
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def signon_started?(url)
|
20
20
|
uri = URI.parse(url)
|
21
21
|
conn = Net::HTTP.start(uri.host, uri.port)
|
22
22
|
true
|
@@ -26,21 +26,21 @@ module Signonotron2IntegrationHelpers
|
|
26
26
|
conn.try(:finish)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
|
29
|
+
def load_signon_setup_fixture
|
30
|
+
load_signon_fixture("signon.sql")
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
|
33
|
+
def authorize_signon_api_user
|
34
|
+
load_signon_fixture("authorize_api_users.sql")
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def load_signon_fixture(filename)
|
38
38
|
require 'erb'
|
39
39
|
parsed = ERB.new(File.read(signon_path + "/config/database.yml")).result
|
40
40
|
db = YAML.load(parsed)['test']
|
41
41
|
|
42
42
|
cmd = "mysql #{db['database']} -u#{db['username']} -p#{db['password']} < #{fixture_file(filename)}"
|
43
|
-
system cmd or raise "Error loading
|
43
|
+
system cmd or raise "Error loading signon fixture"
|
44
44
|
end
|
45
45
|
|
46
46
|
private
|
@@ -49,6 +49,6 @@ private
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def signon_path
|
52
|
-
Rails.root.join('..','..','tmp','
|
52
|
+
Rails.root.join('..','..','tmp','signon').to_s
|
53
53
|
end
|
54
54
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-sso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.
|
4
|
+
version: 13.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- James Stewart
|
7
|
+
- GOV.UK Dev
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
@@ -223,8 +222,7 @@ dependencies:
|
|
223
222
|
version: 0.3.5
|
224
223
|
description: Client for GDS' OAuth 2-based SSO
|
225
224
|
email:
|
226
|
-
-
|
227
|
-
- james.stewart@digital.cabinet-office.gov.uk
|
225
|
+
- govuk-dev@digital.cabinet-office.gov.uk
|
228
226
|
executables: []
|
229
227
|
extensions: []
|
230
228
|
extra_rdoc_files: []
|
@@ -253,7 +251,7 @@ files:
|
|
253
251
|
- spec/controller/api_user_controller_spec.rb
|
254
252
|
- spec/controller/controller_methods_spec.rb
|
255
253
|
- spec/fixtures/integration/authorize_api_users.sql
|
256
|
-
- spec/fixtures/integration/
|
254
|
+
- spec/fixtures/integration/signon.sql
|
257
255
|
- spec/internal/app/controllers/application_controller.rb
|
258
256
|
- spec/internal/app/controllers/example_controller.rb
|
259
257
|
- spec/internal/app/models/user.rb
|
@@ -267,7 +265,7 @@ files:
|
|
267
265
|
- spec/requests/end_to_end_spec.rb
|
268
266
|
- spec/spec_helper.rb
|
269
267
|
- spec/support/backport_controller_test_params.rb
|
270
|
-
- spec/support/
|
268
|
+
- spec/support/signon_integration_helpers.rb
|
271
269
|
- spec/support/timecop.rb
|
272
270
|
- spec/unit/api_access_spec.rb
|
273
271
|
- spec/unit/bearer_token_spec.rb
|
@@ -298,26 +296,26 @@ signing_key:
|
|
298
296
|
specification_version: 4
|
299
297
|
summary: Client for GDS' OAuth 2-based SSO
|
300
298
|
test_files:
|
301
|
-
- spec/support/backport_controller_test_params.rb
|
302
|
-
- spec/support/signonotron2_integration_helpers.rb
|
303
|
-
- spec/support/timecop.rb
|
304
|
-
- spec/unit/user_spec.rb
|
305
|
-
- spec/unit/api_access_spec.rb
|
306
|
-
- spec/unit/session_serialisation_spec.rb
|
307
|
-
- spec/unit/bearer_token_spec.rb
|
308
|
-
- spec/requests/end_to_end_spec.rb
|
309
|
-
- spec/spec_helper.rb
|
310
|
-
- spec/fixtures/integration/signonotron2.sql
|
311
|
-
- spec/fixtures/integration/authorize_api_users.sql
|
312
|
-
- spec/controller/controller_methods_spec.rb
|
313
|
-
- spec/controller/api_user_controller_spec.rb
|
314
|
-
- spec/internal/log/test.log
|
315
|
-
- spec/internal/public/favicon.ico
|
316
299
|
- spec/internal/config/database.yml
|
317
300
|
- spec/internal/config/initializers/gds-sso.rb
|
318
301
|
- spec/internal/config/routes.rb
|
319
|
-
- spec/internal/
|
320
|
-
- spec/internal/app/controllers/example_controller.rb
|
302
|
+
- spec/internal/public/favicon.ico
|
321
303
|
- spec/internal/app/controllers/application_controller.rb
|
322
|
-
- spec/internal/
|
304
|
+
- spec/internal/app/controllers/example_controller.rb
|
305
|
+
- spec/internal/app/models/user.rb
|
306
|
+
- spec/internal/log/test.log
|
323
307
|
- spec/internal/db/combustion_test.sqlite
|
308
|
+
- spec/internal/db/schema.rb
|
309
|
+
- spec/controller/api_user_controller_spec.rb
|
310
|
+
- spec/controller/controller_methods_spec.rb
|
311
|
+
- spec/support/timecop.rb
|
312
|
+
- spec/support/backport_controller_test_params.rb
|
313
|
+
- spec/support/signon_integration_helpers.rb
|
314
|
+
- spec/fixtures/integration/signon.sql
|
315
|
+
- spec/fixtures/integration/authorize_api_users.sql
|
316
|
+
- spec/unit/api_access_spec.rb
|
317
|
+
- spec/unit/session_serialisation_spec.rb
|
318
|
+
- spec/unit/user_spec.rb
|
319
|
+
- spec/unit/bearer_token_spec.rb
|
320
|
+
- spec/spec_helper.rb
|
321
|
+
- spec/requests/end_to_end_spec.rb
|