gds-sso 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -59,13 +59,12 @@ describe "Integration of client using GDS-SSO with signonotron" do
59
59
  page.should have_content('restricted kablooie')
60
60
  end
61
61
 
62
- specify "access to a page that requires signin permission granted " do
62
+ specify "access to a page that requires signin permission granted" do
63
63
  # First we login to authorise the app
64
64
  visit "http://#{@client_host}/this_requires_signin_permission"
65
65
  fill_in "Email", :with => "test@example-client.com"
66
66
  fill_in "Passphrase", :with => "q1w2e3r4t5y6u7i8o9p0"
67
67
  click_on "Sign in"
68
-
69
68
  click_authorize
70
69
 
71
70
  # At this point the app should be authorised, we reset the session to simulate a new browser visit.
@@ -80,6 +79,41 @@ describe "Integration of client using GDS-SSO with signonotron" do
80
79
 
81
80
  page.should have_content('you have signin permission')
82
81
  end
82
+
83
+ describe "remotely signed out" do
84
+ specify "should prevent all access to the application until successful signin" do
85
+ # First we login and authorise the app
86
+ visit "http://#{@client_host}/restricted"
87
+ fill_in "Email", :with => "test@example-client.com"
88
+ fill_in "Passphrase", :with => "q1w2e3r4t5y6u7i8o9p0"
89
+ click_on "Sign in"
90
+ click_authorize
91
+
92
+ page.driver.header 'accept', 'text/html'
93
+ page.should have_content('restricted kablooie')
94
+
95
+ # Simulate a POST to /auth/gds/api/users/:uid/reauth by SOOT
96
+ # This is already tested in api_user_controller_spec.rb
97
+ user = User.find_by_uid("integration-uid")
98
+ user.set_remotely_signed_out!
99
+
100
+ page.driver.header 'accept', 'text/html'
101
+
102
+ # check we can't visit
103
+ visit "http://#{@client_host}/restricted"
104
+ page.should have_content('You have been remotely signed out')
105
+
106
+ # signin
107
+ visit "http://#{@client_host}/auth/gds/sign_out" # want to be redirected to SOOT, and then back again
108
+ fill_in "Email", :with => "test@example-client.com"
109
+ fill_in "Passphrase", :with => "q1w2e3r4t5y6u7i8o9p0"
110
+ click_on "Sign in"
111
+
112
+ # check we can visit
113
+ visit "http://#{@client_host}/restricted"
114
+ page.should have_content('restricted kablooie')
115
+ end
116
+ end
83
117
  end
84
118
 
85
119
  describe "API client accesses" do
data/spec/spec_helper.rb CHANGED
@@ -9,7 +9,7 @@ Bundler.require :default, :development
9
9
 
10
10
  require 'capybara/rspec'
11
11
 
12
- Combustion.initialize! :action_controller
12
+ Combustion.initialize!
13
13
 
14
14
  require 'rspec/rails'
15
15
  require 'capybara/rails'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gds-sso
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.0
5
+ version: 1.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matt Patterson
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2012-07-23 00:00:00 Z
14
+ date: 2012-07-24 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -145,6 +145,17 @@ dependencies:
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: *id012
148
+ - !ruby/object:Gem::Dependency
149
+ name: sqlite3
150
+ requirement: &id013 !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - "="
154
+ - !ruby/object:Gem::Version
155
+ version: 1.3.6
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: *id013
148
159
  description: Client for GDS' OAuth 2-based SSO
149
160
  email:
150
161
  - matt@constituentparts.com
@@ -156,44 +167,45 @@ extensions: []
156
167
  extra_rdoc_files: []
157
168
 
158
169
  files:
159
- - app/controllers/authentications_controller.rb
160
- - app/controllers/api/user_controller.rb
161
- - app/views/authentications/failure.html.erb
162
170
  - app/views/layouts/unauthorised.html.erb
163
- - app/views/authorisations/cant_signin.html.erb
171
+ - app/views/authentications/failure.html.erb
164
172
  - app/views/authorisations/unauthorised.html.erb
173
+ - app/views/authorisations/cant_signin.html.erb
174
+ - app/controllers/api/user_controller.rb
175
+ - app/controllers/authentications_controller.rb
165
176
  - config/routes.rb
166
177
  - lib/gds-sso.rb
178
+ - lib/gds-sso/controller_methods.rb
179
+ - lib/gds-sso/failure_app.rb
180
+ - lib/gds-sso/config.rb
167
181
  - lib/gds-sso/user.rb
168
- - lib/gds-sso/version.rb
169
182
  - lib/gds-sso/warden_config.rb
170
- - lib/gds-sso/config.rb
171
- - lib/gds-sso/controller_methods.rb
172
183
  - lib/gds-sso/api_access.rb
173
- - lib/gds-sso/failure_app.rb
184
+ - lib/gds-sso/version.rb
174
185
  - README.md
175
186
  - Gemfile
176
187
  - Rakefile
177
188
  - test/api_access_test.rb
178
- - test/user_test.rb
179
189
  - test/test_helper.rb
180
- - spec/tasks/signonotron_tasks.rake
181
- - spec/controller/api_user_controller_spec.rb
190
+ - test/user_test.rb
182
191
  - spec/requests/end_to_end_spec.rb
183
192
  - spec/requests/authentication_soot2.rb
184
- - spec/spec_helper.rb
185
- - spec/support/signonotron2_integration_helpers.rb
186
- - spec/fixtures/integration/signonotron2.sql
187
- - spec/fixtures/integration/signonotron2_database.yml
188
193
  - spec/internal/log/test.log
189
- - spec/internal/db/schema.rb
190
194
  - spec/internal/public/favicon.ico
191
- - spec/internal/config/database.yml
192
- - spec/internal/config/initializers/gds-sso.rb
193
- - spec/internal/config/routes.rb
194
- - spec/internal/app/controllers/application_controller.rb
195
195
  - spec/internal/app/controllers/example_controller.rb
196
+ - spec/internal/app/controllers/application_controller.rb
196
197
  - spec/internal/app/models/user.rb
198
+ - spec/internal/config/routes.rb
199
+ - spec/internal/config/initializers/gds-sso.rb
200
+ - spec/internal/config/database.yml
201
+ - spec/internal/db/schema.rb
202
+ - spec/internal/db/combustion_test.sqlite
203
+ - spec/support/signonotron2_integration_helpers.rb
204
+ - spec/fixtures/integration/signonotron2.sql
205
+ - spec/fixtures/integration/signonotron2_database.yml
206
+ - spec/tasks/signonotron_tasks.rake
207
+ - spec/spec_helper.rb
208
+ - spec/controller/api_user_controller_spec.rb
197
209
  homepage: https://github.com/alphagov/gds-sso
198
210
  licenses: []
199
211
 
@@ -207,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
219
  requirements:
208
220
  - - ">="
209
221
  - !ruby/object:Gem::Version
210
- hash: -3724830657426033067
222
+ hash: 345014879888302540
211
223
  segments:
212
224
  - 0
213
225
  version: "0"
@@ -216,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
228
  requirements:
217
229
  - - ">="
218
230
  - !ruby/object:Gem::Version
219
- hash: -3724830657426033067
231
+ hash: 345014879888302540
220
232
  segments:
221
233
  - 0
222
234
  version: "0"
@@ -229,22 +241,23 @@ specification_version: 3
229
241
  summary: Client for GDS' OAuth 2-based SSO
230
242
  test_files:
231
243
  - test/api_access_test.rb
232
- - test/user_test.rb
233
244
  - test/test_helper.rb
234
- - spec/tasks/signonotron_tasks.rake
235
- - spec/controller/api_user_controller_spec.rb
245
+ - test/user_test.rb
236
246
  - spec/requests/end_to_end_spec.rb
237
247
  - spec/requests/authentication_soot2.rb
238
- - spec/spec_helper.rb
239
- - spec/support/signonotron2_integration_helpers.rb
240
- - spec/fixtures/integration/signonotron2.sql
241
- - spec/fixtures/integration/signonotron2_database.yml
242
248
  - spec/internal/log/test.log
243
- - spec/internal/db/schema.rb
244
249
  - spec/internal/public/favicon.ico
245
- - spec/internal/config/database.yml
246
- - spec/internal/config/initializers/gds-sso.rb
247
- - spec/internal/config/routes.rb
248
- - spec/internal/app/controllers/application_controller.rb
249
250
  - spec/internal/app/controllers/example_controller.rb
251
+ - spec/internal/app/controllers/application_controller.rb
250
252
  - spec/internal/app/models/user.rb
253
+ - spec/internal/config/routes.rb
254
+ - spec/internal/config/initializers/gds-sso.rb
255
+ - spec/internal/config/database.yml
256
+ - spec/internal/db/schema.rb
257
+ - spec/internal/db/combustion_test.sqlite
258
+ - spec/support/signonotron2_integration_helpers.rb
259
+ - spec/fixtures/integration/signonotron2.sql
260
+ - spec/fixtures/integration/signonotron2_database.yml
261
+ - spec/tasks/signonotron_tasks.rake
262
+ - spec/spec_helper.rb
263
+ - spec/controller/api_user_controller_spec.rb