gds-sso 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -46,7 +46,11 @@ In development, you generally want to be able to run an application without need
46
46
 
47
47
  GDS::SSO.test_user || GDS::SSO::Config.user_klass.first
48
48
 
49
- To make it use a real strategy (e.g. if you're testing an app against the signon server), set an environment variable when you run your app:
49
+ To make it use a real strategy (e.g. if you're testing an app against the signon server), you will need to ensure that your signonotron2 database has got OAuth config that matches what the apps use in development mode. To do this, run this in signonotron2:
50
+
51
+ bundle exec ./script/make_oauth_work_in_dev
52
+
53
+ Once that's done, set an environment variable when you run your app. e.g.:
50
54
 
51
55
  GDS_SSO_STRATEGY=real bundle exec rails s
52
56
 
data/lib/gds-sso/user.rb CHANGED
@@ -10,6 +10,10 @@ module GDS
10
10
  def name
11
11
  'API User'
12
12
  end
13
+
14
+ def has_permission?(scope, permission)
15
+ true
16
+ end
13
17
  end
14
18
 
15
19
  module User
@@ -1,5 +1,5 @@
1
1
  module GDS
2
2
  module SSO
3
- VERSION = "0.7.6"
3
+ VERSION = "0.7.7"
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require 'warden'
2
+ require 'gds-sso/user'
2
3
 
3
4
  Warden::Manager.serialize_into_session do |user|
4
5
  user.respond_to?(:uid) ? user.uid : nil
@@ -51,7 +52,7 @@ Warden::Strategies.add(:gds_sso_api_access) do
51
52
  return fail!(:bad_request) unless auth.basic?
52
53
 
53
54
  if valid_api_user?(*auth.credentials)
54
- success!(auth.credentials[0])
55
+ success!(api_user)
55
56
  else
56
57
  custom!(unauthorized)
57
58
  end
@@ -104,6 +105,6 @@ Warden::Strategies.add(:mock_gds_sso_api_access) do
104
105
 
105
106
  def authenticate!
106
107
  Rails.logger.debug("Authenticating with mock_gds_sso_api_access strategy")
107
- success!(GDS::SSO.test_user || GDS::SSO::Config.user_klass.first)
108
+ success!(GDS::SSO::ApiUser.new)
108
109
  end
109
110
  end
@@ -1,6 +1,7 @@
1
1
  class ExampleController < ApplicationController
2
2
 
3
- before_filter :authenticate_user!, :only => [:restricted]
3
+ before_filter :authenticate_user!, :only => [:restricted, :this_requires_signin_permission]
4
+ before_filter :require_signin_permission!, only: [:this_requires_signin_permission]
4
5
 
5
6
  def index
6
7
  render :text => "jabberwocky"
@@ -9,4 +10,8 @@ class ExampleController < ApplicationController
9
10
  def restricted
10
11
  render :text => "restricted kablooie"
11
12
  end
13
+
14
+ def this_requires_signin_permission
15
+ render :text => "you have signin permission"
16
+ end
12
17
  end
@@ -11,7 +11,7 @@ class User < OpenStruct
11
11
  end
12
12
 
13
13
  def self.stub_user
14
- User.new({ :uid => '1', :name => "User" })
14
+ User.new({ :uid => '1', :name => "User", :permissions => { "GDS_SSO integration test" => ["signin"] } })
15
15
  end
16
16
 
17
17
  def update_attributes(*args)
@@ -5,5 +5,5 @@ GDS::SSO.config do |config|
5
5
  config.oauth_root_url = "http://localhost:4567"
6
6
  config.basic_auth_user = 'test_api_user'
7
7
  config.basic_auth_password = 'api_user_password'
8
- config.default_scope = 'test-app'
8
+ config.default_scope = 'GDS_SSO integration test'
9
9
  end
@@ -1,4 +1,5 @@
1
1
  Rails.application.routes.draw do
2
2
  root :to => 'example#index'
3
3
  match "/restricted" => 'example#restricted'
4
+ match "/this_requires_signin_permission" => "example#this_requires_signin_permission"
4
5
  end
@@ -2985,3 +2985,655 @@ Started GET "/restricted" for 127.0.0.1 at 2012-06-28 13:17:27 +0000
2985
2985
  Processing by ExampleController#restricted as JSON
2986
2986
  Authenticating with gds_sso_api_access strategy
2987
2987
  Completed 200 OK in 1ms (Views: 0.6ms)
2988
+
2989
+
2990
+ Started GET "/" for 127.0.0.1 at 2012-06-29 10:20:11 +0000
2991
+ Processing by ExampleController#index as HTML
2992
+ Rendered text template (0.0ms)
2993
+ Completed 200 OK in 47ms (Views: 46.7ms)
2994
+
2995
+
2996
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 10:20:11 +0000
2997
+ Processing by ExampleController#restricted as HTML
2998
+ Authenticating with gds_sso strategy
2999
+ Completed in 56ms
3000
+
3001
+
3002
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 10:20:11 +0000
3003
+
3004
+
3005
+ Started GET "/auth/gds/callback?code=692b81007b43d3369c6b9201dbde9c830f5a474f015041caa6db235457343b5f" for 127.0.0.1 at 2012-06-29 10:20:12 +0000
3006
+ Processing by AuthenticationsController#callback as HTML
3007
+ Parameters: {"code"=>"692b81007b43d3369c6b9201dbde9c830f5a474f015041caa6db235457343b5f"}
3008
+ Authenticating with gds_sso strategy
3009
+ Redirected to http://www.example-client.com/restricted
3010
+ Completed 302 Found in 1ms
3011
+
3012
+
3013
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 10:20:12 +0000
3014
+ Processing by ExampleController#restricted as HTML
3015
+ Completed 200 OK in 1ms (Views: 0.5ms)
3016
+
3017
+
3018
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 10:20:12 +0000
3019
+ Processing by ExampleController#restricted as HTML
3020
+ Authenticating with gds_sso strategy
3021
+ Completed in 0ms
3022
+
3023
+
3024
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 10:20:12 +0000
3025
+
3026
+
3027
+ Started GET "/auth/gds/callback?code=be594610c233d3dfdd36f0a1782715e938166f769ec56a04867fdb986b62f052" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3028
+ Processing by AuthenticationsController#callback as HTML
3029
+ Parameters: {"code"=>"be594610c233d3dfdd36f0a1782715e938166f769ec56a04867fdb986b62f052"}
3030
+ Authenticating with gds_sso strategy
3031
+ Redirected to http://www.example-client.com/restricted
3032
+ Completed 302 Found in 1ms
3033
+
3034
+
3035
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3036
+ Processing by ExampleController#restricted as HTML
3037
+ Completed 200 OK in 1ms (Views: 0.6ms)
3038
+
3039
+
3040
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3041
+ Processing by ExampleController#restricted as HTML
3042
+ Authenticating with gds_sso strategy
3043
+ Completed in 0ms
3044
+
3045
+
3046
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3047
+
3048
+
3049
+ Started GET "/auth/gds/callback?code=7d6d83427d589cd85695c34a3bec0748b092b0a67e633adffe35e34d3e4ce997" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3050
+ Processing by AuthenticationsController#callback as HTML
3051
+ Parameters: {"code"=>"7d6d83427d589cd85695c34a3bec0748b092b0a67e633adffe35e34d3e4ce997"}
3052
+ Authenticating with gds_sso strategy
3053
+ Redirected to http://www.example-client.com/restricted
3054
+ Completed 302 Found in 1ms
3055
+
3056
+
3057
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3058
+ Processing by ExampleController#restricted as HTML
3059
+ Completed 200 OK in 1ms (Views: 0.4ms)
3060
+
3061
+
3062
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3063
+ Processing by ExampleController#this_requires_signin_permission as HTML
3064
+ Authenticating with gds_sso strategy
3065
+ Completed in 1ms
3066
+
3067
+
3068
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3069
+
3070
+
3071
+ Started GET "/auth/gds/callback?code=86d5a54f812796ca9b009be4ffa0240b0c2608be0f10769495e5ff82730c484e" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3072
+ Processing by AuthenticationsController#callback as HTML
3073
+ Parameters: {"code"=>"86d5a54f812796ca9b009be4ffa0240b0c2608be0f10769495e5ff82730c484e"}
3074
+ Authenticating with gds_sso strategy
3075
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3076
+ Completed 302 Found in 1ms
3077
+
3078
+
3079
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3080
+ Processing by ExampleController#this_requires_signin_permission as HTML
3081
+ Completed 200 OK in 1ms (Views: 0.5ms)
3082
+
3083
+
3084
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3085
+ Processing by ExampleController#this_requires_signin_permission as HTML
3086
+ Authenticating with gds_sso strategy
3087
+ Completed in 0ms
3088
+
3089
+
3090
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 10:20:13 +0000
3091
+
3092
+
3093
+ Started GET "/auth/gds/callback?code=0f4ebd3c836d8e93247ef8c8b57956ea3001a8b71b0b8bdbfae8a2d6d479acae" for 127.0.0.1 at 2012-06-29 10:20:14 +0000
3094
+ Processing by AuthenticationsController#callback as HTML
3095
+ Parameters: {"code"=>"0f4ebd3c836d8e93247ef8c8b57956ea3001a8b71b0b8bdbfae8a2d6d479acae"}
3096
+ Authenticating with gds_sso strategy
3097
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3098
+ Completed 302 Found in 1ms
3099
+
3100
+
3101
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 10:20:14 +0000
3102
+ Processing by ExampleController#this_requires_signin_permission as HTML
3103
+ Completed 200 OK in 1ms (Views: 0.3ms)
3104
+
3105
+
3106
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 10:20:14 +0000
3107
+ Processing by ExampleController#restricted as JSON
3108
+ Authenticating with gds_sso_api_access strategy
3109
+ Completed in 14ms
3110
+
3111
+
3112
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 10:20:14 +0000
3113
+ Processing by ExampleController#restricted as JSON
3114
+ Authenticating with gds_sso_api_access strategy
3115
+ Completed 200 OK in 1ms (Views: 0.6ms)
3116
+
3117
+
3118
+ Started GET "/" for 127.0.0.1 at 2012-06-29 12:06:11 +0000
3119
+ Processing by ExampleController#index as HTML
3120
+ Rendered text template (0.0ms)
3121
+ Completed 200 OK in 49ms (Views: 48.7ms)
3122
+
3123
+
3124
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 12:06:12 +0000
3125
+ Processing by ExampleController#restricted as HTML
3126
+ Authenticating with gds_sso strategy
3127
+ Completed in 60ms
3128
+
3129
+
3130
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 12:06:12 +0000
3131
+
3132
+
3133
+ Started GET "/auth/gds/callback?code=9a4e02d683202930f0d325bca3817e6169e0a26790fee5cfa0fe179d4ec40804" for 127.0.0.1 at 2012-06-29 12:06:12 +0000
3134
+ Processing by AuthenticationsController#callback as HTML
3135
+ Parameters: {"code"=>"9a4e02d683202930f0d325bca3817e6169e0a26790fee5cfa0fe179d4ec40804"}
3136
+ Authenticating with gds_sso strategy
3137
+ Redirected to http://www.example-client.com/restricted
3138
+ Completed 302 Found in 1ms
3139
+
3140
+
3141
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3142
+ Processing by ExampleController#restricted as HTML
3143
+ Completed 200 OK in 1ms (Views: 0.5ms)
3144
+
3145
+
3146
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3147
+ Processing by ExampleController#restricted as HTML
3148
+ Authenticating with gds_sso strategy
3149
+ Completed in 0ms
3150
+
3151
+
3152
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3153
+
3154
+
3155
+ Started GET "/auth/gds/callback?code=e468f0b14b6b0291a27f74b7e964a9db48adfb9658e4c5a7c97ab47c671182ca" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3156
+ Processing by AuthenticationsController#callback as HTML
3157
+ Parameters: {"code"=>"e468f0b14b6b0291a27f74b7e964a9db48adfb9658e4c5a7c97ab47c671182ca"}
3158
+ Authenticating with gds_sso strategy
3159
+ Redirected to http://www.example-client.com/restricted
3160
+ Completed 302 Found in 1ms
3161
+
3162
+
3163
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3164
+ Processing by ExampleController#restricted as HTML
3165
+ Completed 200 OK in 1ms (Views: 0.6ms)
3166
+
3167
+
3168
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3169
+ Processing by ExampleController#restricted as HTML
3170
+ Authenticating with gds_sso strategy
3171
+ Completed in 0ms
3172
+
3173
+
3174
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3175
+
3176
+
3177
+ Started GET "/auth/gds/callback?code=e3504639ba591817607ef429dd77bdca408a74f48873e133e477e87bc53f9f65" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3178
+ Processing by AuthenticationsController#callback as HTML
3179
+ Parameters: {"code"=>"e3504639ba591817607ef429dd77bdca408a74f48873e133e477e87bc53f9f65"}
3180
+ Authenticating with gds_sso strategy
3181
+ Redirected to http://www.example-client.com/restricted
3182
+ Completed 302 Found in 1ms
3183
+
3184
+
3185
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3186
+ Processing by ExampleController#restricted as HTML
3187
+ Completed 200 OK in 1ms (Views: 0.3ms)
3188
+
3189
+
3190
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3191
+ Processing by ExampleController#this_requires_signin_permission as HTML
3192
+ Authenticating with gds_sso strategy
3193
+ Completed in 1ms
3194
+
3195
+
3196
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 12:06:13 +0000
3197
+
3198
+
3199
+ Started GET "/auth/gds/callback?code=9d161a55a33b94705684c02c8d3590de5d08832a156d64b26ff378ab0542a7e0" for 127.0.0.1 at 2012-06-29 12:06:14 +0000
3200
+ Processing by AuthenticationsController#callback as HTML
3201
+ Parameters: {"code"=>"9d161a55a33b94705684c02c8d3590de5d08832a156d64b26ff378ab0542a7e0"}
3202
+ Authenticating with gds_sso strategy
3203
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3204
+ Completed 302 Found in 1ms
3205
+
3206
+
3207
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 12:06:14 +0000
3208
+ Processing by ExampleController#this_requires_signin_permission as HTML
3209
+ Completed 200 OK in 1ms (Views: 0.5ms)
3210
+
3211
+
3212
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 12:06:14 +0000
3213
+ Processing by ExampleController#this_requires_signin_permission as HTML
3214
+ Authenticating with gds_sso strategy
3215
+ Completed in 0ms
3216
+
3217
+
3218
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 12:06:14 +0000
3219
+
3220
+
3221
+ Started GET "/auth/gds/callback?code=2824cb988876c493f9d30fc7b9b3dba935365567e72d0ec070f0d952d72b90b9" for 127.0.0.1 at 2012-06-29 12:06:14 +0000
3222
+ Processing by AuthenticationsController#callback as HTML
3223
+ Parameters: {"code"=>"2824cb988876c493f9d30fc7b9b3dba935365567e72d0ec070f0d952d72b90b9"}
3224
+ Authenticating with gds_sso strategy
3225
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3226
+ Completed 302 Found in 1ms
3227
+
3228
+
3229
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 12:06:14 +0000
3230
+ Processing by ExampleController#this_requires_signin_permission as HTML
3231
+ Completed 200 OK in 1ms (Views: 0.3ms)
3232
+
3233
+
3234
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 12:06:14 +0000
3235
+ Processing by ExampleController#restricted as JSON
3236
+ Authenticating with gds_sso_api_access strategy
3237
+ Completed in 14ms
3238
+
3239
+
3240
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 12:06:14 +0000
3241
+ Processing by ExampleController#restricted as JSON
3242
+ Authenticating with gds_sso_api_access strategy
3243
+ Completed 200 OK in 1ms (Views: 0.6ms)
3244
+
3245
+
3246
+ Started GET "/" for 127.0.0.1 at 2012-06-29 14:22:06 +0000
3247
+ Processing by ExampleController#index as HTML
3248
+ Rendered text template (0.0ms)
3249
+ Completed 200 OK in 45ms (Views: 44.8ms)
3250
+
3251
+
3252
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 14:22:06 +0000
3253
+ Processing by ExampleController#restricted as HTML
3254
+ Authenticating with gds_sso strategy
3255
+ Completed in 55ms
3256
+
3257
+
3258
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 14:22:06 +0000
3259
+
3260
+
3261
+ Started GET "/auth/gds/callback?code=db0c48b85499354cdb3a8a5aae58107337b0067473c7800d2bc100aac8b9335b" for 127.0.0.1 at 2012-06-29 14:22:07 +0000
3262
+ Processing by AuthenticationsController#callback as HTML
3263
+ Parameters: {"code"=>"db0c48b85499354cdb3a8a5aae58107337b0067473c7800d2bc100aac8b9335b"}
3264
+ Authenticating with gds_sso strategy
3265
+ Redirected to http://www.example-client.com/restricted
3266
+ Completed 302 Found in 1ms
3267
+
3268
+
3269
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 14:22:07 +0000
3270
+ Processing by ExampleController#restricted as HTML
3271
+ Completed 200 OK in 1ms (Views: 0.5ms)
3272
+
3273
+
3274
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 14:22:07 +0000
3275
+ Processing by ExampleController#restricted as HTML
3276
+ Authenticating with gds_sso strategy
3277
+ Completed in 0ms
3278
+
3279
+
3280
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 14:22:07 +0000
3281
+
3282
+
3283
+ Started GET "/auth/gds/callback?code=967ad0bf9ce05be99f6c115ef2c8dc153084ea44b8da68c151797918d9aab0c7" for 127.0.0.1 at 2012-06-29 14:22:07 +0000
3284
+ Processing by AuthenticationsController#callback as HTML
3285
+ Parameters: {"code"=>"967ad0bf9ce05be99f6c115ef2c8dc153084ea44b8da68c151797918d9aab0c7"}
3286
+ Authenticating with gds_sso strategy
3287
+ Redirected to http://www.example-client.com/restricted
3288
+ Completed 302 Found in 1ms
3289
+
3290
+
3291
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 14:22:07 +0000
3292
+ Processing by ExampleController#restricted as HTML
3293
+ Completed 200 OK in 1ms (Views: 0.6ms)
3294
+
3295
+
3296
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 14:22:07 +0000
3297
+ Processing by ExampleController#restricted as HTML
3298
+ Authenticating with gds_sso strategy
3299
+ Completed in 0ms
3300
+
3301
+
3302
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 14:22:07 +0000
3303
+
3304
+
3305
+ Started GET "/auth/gds/callback?code=40e279a854bc3aa5aa1eeb01b9ce740d2cd40206ebf076539353daf794acd53e" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3306
+ Processing by AuthenticationsController#callback as HTML
3307
+ Parameters: {"code"=>"40e279a854bc3aa5aa1eeb01b9ce740d2cd40206ebf076539353daf794acd53e"}
3308
+ Authenticating with gds_sso strategy
3309
+ Redirected to http://www.example-client.com/restricted
3310
+ Completed 302 Found in 1ms
3311
+
3312
+
3313
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3314
+ Processing by ExampleController#restricted as HTML
3315
+ Completed 200 OK in 1ms (Views: 0.3ms)
3316
+
3317
+
3318
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3319
+ Processing by ExampleController#this_requires_signin_permission as HTML
3320
+ Authenticating with gds_sso strategy
3321
+ Completed in 1ms
3322
+
3323
+
3324
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3325
+
3326
+
3327
+ Started GET "/auth/gds/callback?code=a4cf30c09a2cff7c853a312da852dae6259927e4f42a30d247bf5a0d7a850607" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3328
+ Processing by AuthenticationsController#callback as HTML
3329
+ Parameters: {"code"=>"a4cf30c09a2cff7c853a312da852dae6259927e4f42a30d247bf5a0d7a850607"}
3330
+ Authenticating with gds_sso strategy
3331
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3332
+ Completed 302 Found in 1ms
3333
+
3334
+
3335
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3336
+ Processing by ExampleController#this_requires_signin_permission as HTML
3337
+ Completed 200 OK in 1ms (Views: 0.5ms)
3338
+
3339
+
3340
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3341
+ Processing by ExampleController#this_requires_signin_permission as HTML
3342
+ Authenticating with gds_sso strategy
3343
+ Completed in 0ms
3344
+
3345
+
3346
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3347
+
3348
+
3349
+ Started GET "/auth/gds/callback?code=8956554b2c30f7c4ed35be7695bfbbd400710c6791769f17b84a4e11d3e6eb93" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3350
+ Processing by AuthenticationsController#callback as HTML
3351
+ Parameters: {"code"=>"8956554b2c30f7c4ed35be7695bfbbd400710c6791769f17b84a4e11d3e6eb93"}
3352
+ Authenticating with gds_sso strategy
3353
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3354
+ Completed 302 Found in 1ms
3355
+
3356
+
3357
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3358
+ Processing by ExampleController#this_requires_signin_permission as HTML
3359
+ Completed 200 OK in 1ms (Views: 0.3ms)
3360
+
3361
+
3362
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3363
+ Processing by ExampleController#restricted as JSON
3364
+ Authenticating with gds_sso_api_access strategy
3365
+ Completed in 12ms
3366
+
3367
+
3368
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 14:22:08 +0000
3369
+ Processing by ExampleController#restricted as JSON
3370
+ Authenticating with gds_sso_api_access strategy
3371
+ Completed 200 OK in 1ms (Views: 0.6ms)
3372
+
3373
+
3374
+ Started GET "/" for 127.0.0.1 at 2012-06-29 15:13:06 +0000
3375
+ Processing by ExampleController#index as HTML
3376
+ Rendered text template (0.0ms)
3377
+ Completed 200 OK in 45ms (Views: 44.9ms)
3378
+
3379
+
3380
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:13:06 +0000
3381
+ Processing by ExampleController#restricted as HTML
3382
+ Authenticating with gds_sso strategy
3383
+ Completed in 56ms
3384
+
3385
+
3386
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:13:06 +0000
3387
+
3388
+
3389
+ Started GET "/auth/gds/callback?code=84820cda6cc8a75d58afd6874092f5ffda886f132ce77c0c059eda11d832ad5f" for 127.0.0.1 at 2012-06-29 15:13:07 +0000
3390
+ Processing by AuthenticationsController#callback as HTML
3391
+ Parameters: {"code"=>"84820cda6cc8a75d58afd6874092f5ffda886f132ce77c0c059eda11d832ad5f"}
3392
+ Authenticating with gds_sso strategy
3393
+ Redirected to http://www.example-client.com/restricted
3394
+ Completed 302 Found in 1ms
3395
+
3396
+
3397
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:13:07 +0000
3398
+ Processing by ExampleController#restricted as HTML
3399
+ Completed 200 OK in 1ms (Views: 0.5ms)
3400
+
3401
+
3402
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:13:07 +0000
3403
+ Processing by ExampleController#restricted as HTML
3404
+ Authenticating with gds_sso strategy
3405
+ Completed in 0ms
3406
+
3407
+
3408
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:13:07 +0000
3409
+
3410
+
3411
+ Started GET "/auth/gds/callback?code=65470800937a73d00fc1c6a2f5cc3a01af3bc49db01937d29761ee193e3aa6c2" for 127.0.0.1 at 2012-06-29 15:13:07 +0000
3412
+ Processing by AuthenticationsController#callback as HTML
3413
+ Parameters: {"code"=>"65470800937a73d00fc1c6a2f5cc3a01af3bc49db01937d29761ee193e3aa6c2"}
3414
+ Authenticating with gds_sso strategy
3415
+ Redirected to http://www.example-client.com/restricted
3416
+ Completed 302 Found in 1ms
3417
+
3418
+
3419
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:13:07 +0000
3420
+ Processing by ExampleController#restricted as HTML
3421
+ Completed 200 OK in 1ms (Views: 0.5ms)
3422
+
3423
+
3424
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:13:07 +0000
3425
+ Processing by ExampleController#restricted as HTML
3426
+ Authenticating with gds_sso strategy
3427
+ Completed in 0ms
3428
+
3429
+
3430
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:13:07 +0000
3431
+
3432
+
3433
+ Started GET "/auth/gds/callback?code=8ff275c7dd38bd4038fe410c709572551e7de20bd6771d52bd4b2cbc903cbec9" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3434
+ Processing by AuthenticationsController#callback as HTML
3435
+ Parameters: {"code"=>"8ff275c7dd38bd4038fe410c709572551e7de20bd6771d52bd4b2cbc903cbec9"}
3436
+ Authenticating with gds_sso strategy
3437
+ Redirected to http://www.example-client.com/restricted
3438
+ Completed 302 Found in 1ms
3439
+
3440
+
3441
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3442
+ Processing by ExampleController#restricted as HTML
3443
+ Completed 200 OK in 1ms (Views: 0.4ms)
3444
+
3445
+
3446
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3447
+ Processing by ExampleController#this_requires_signin_permission as HTML
3448
+ Authenticating with gds_sso strategy
3449
+ Completed in 1ms
3450
+
3451
+
3452
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3453
+
3454
+
3455
+ Started GET "/auth/gds/callback?code=6f04f68a797bee82ccb0ab6ae8a34a6bc34b906c121f3787d269adda5ab7ab33" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3456
+ Processing by AuthenticationsController#callback as HTML
3457
+ Parameters: {"code"=>"6f04f68a797bee82ccb0ab6ae8a34a6bc34b906c121f3787d269adda5ab7ab33"}
3458
+ Authenticating with gds_sso strategy
3459
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3460
+ Completed 302 Found in 1ms
3461
+
3462
+
3463
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3464
+ Processing by ExampleController#this_requires_signin_permission as HTML
3465
+ Completed 200 OK in 1ms (Views: 0.6ms)
3466
+
3467
+
3468
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3469
+ Processing by ExampleController#this_requires_signin_permission as HTML
3470
+ Authenticating with gds_sso strategy
3471
+ Completed in 0ms
3472
+
3473
+
3474
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3475
+
3476
+
3477
+ Started GET "/auth/gds/callback?code=321e680d4c57253be4e5525ac8dcf32f82a9f00ca961e920b9f948f307dac3f0" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3478
+ Processing by AuthenticationsController#callback as HTML
3479
+ Parameters: {"code"=>"321e680d4c57253be4e5525ac8dcf32f82a9f00ca961e920b9f948f307dac3f0"}
3480
+ Authenticating with gds_sso strategy
3481
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3482
+ Completed 302 Found in 1ms
3483
+
3484
+
3485
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3486
+ Processing by ExampleController#this_requires_signin_permission as HTML
3487
+ Completed 200 OK in 1ms (Views: 0.3ms)
3488
+
3489
+
3490
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3491
+ Processing by ExampleController#restricted as JSON
3492
+ Authenticating with gds_sso_api_access strategy
3493
+ Completed in 12ms
3494
+
3495
+
3496
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3497
+ Processing by ExampleController#restricted as JSON
3498
+ Authenticating with gds_sso_api_access strategy
3499
+ Completed 200 OK in 1ms (Views: 0.5ms)
3500
+
3501
+
3502
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:13:08 +0000
3503
+ Processing by ExampleController#this_requires_signin_permission as JSON
3504
+ Authenticating with gds_sso_api_access strategy
3505
+ Completed 200 OK in 1ms (Views: 0.6ms)
3506
+
3507
+
3508
+ Started GET "/" for 127.0.0.1 at 2012-06-29 15:15:49 +0000
3509
+ Processing by ExampleController#index as HTML
3510
+ Rendered text template (0.0ms)
3511
+ Completed 200 OK in 47ms (Views: 46.9ms)
3512
+
3513
+
3514
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:15:50 +0000
3515
+ Processing by ExampleController#restricted as HTML
3516
+ Authenticating with gds_sso strategy
3517
+ Completed in 57ms
3518
+
3519
+
3520
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:15:50 +0000
3521
+
3522
+
3523
+ Started GET "/auth/gds/callback?code=a6ee4774a529fe816b062efe6e3bf5160f09853d184da6a1964f80f67fe8f9d5" for 127.0.0.1 at 2012-06-29 15:15:50 +0000
3524
+ Processing by AuthenticationsController#callback as HTML
3525
+ Parameters: {"code"=>"a6ee4774a529fe816b062efe6e3bf5160f09853d184da6a1964f80f67fe8f9d5"}
3526
+ Authenticating with gds_sso strategy
3527
+ Redirected to http://www.example-client.com/restricted
3528
+ Completed 302 Found in 1ms
3529
+
3530
+
3531
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3532
+ Processing by ExampleController#restricted as HTML
3533
+ Completed 200 OK in 1ms (Views: 0.5ms)
3534
+
3535
+
3536
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3537
+ Processing by ExampleController#restricted as HTML
3538
+ Authenticating with gds_sso strategy
3539
+ Completed in 0ms
3540
+
3541
+
3542
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3543
+
3544
+
3545
+ Started GET "/auth/gds/callback?code=93272b19bea8a5e912d547c2a9234c750e4273c182b1ae1f568a65413a9c9bde" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3546
+ Processing by AuthenticationsController#callback as HTML
3547
+ Parameters: {"code"=>"93272b19bea8a5e912d547c2a9234c750e4273c182b1ae1f568a65413a9c9bde"}
3548
+ Authenticating with gds_sso strategy
3549
+ Redirected to http://www.example-client.com/restricted
3550
+ Completed 302 Found in 1ms
3551
+
3552
+
3553
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3554
+ Processing by ExampleController#restricted as HTML
3555
+ Completed 200 OK in 1ms (Views: 0.5ms)
3556
+
3557
+
3558
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3559
+ Processing by ExampleController#restricted as HTML
3560
+ Authenticating with gds_sso strategy
3561
+ Completed in 0ms
3562
+
3563
+
3564
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3565
+
3566
+
3567
+ Started GET "/auth/gds/callback?code=503a2ea219362457b2a4cb29bf3524dea435becf72f603dfd3460d3c4666a3ee" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3568
+ Processing by AuthenticationsController#callback as HTML
3569
+ Parameters: {"code"=>"503a2ea219362457b2a4cb29bf3524dea435becf72f603dfd3460d3c4666a3ee"}
3570
+ Authenticating with gds_sso strategy
3571
+ Redirected to http://www.example-client.com/restricted
3572
+ Completed 302 Found in 1ms
3573
+
3574
+
3575
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3576
+ Processing by ExampleController#restricted as HTML
3577
+ Completed 200 OK in 1ms (Views: 0.3ms)
3578
+
3579
+
3580
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3581
+ Processing by ExampleController#this_requires_signin_permission as HTML
3582
+ Authenticating with gds_sso strategy
3583
+ Completed in 1ms
3584
+
3585
+
3586
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:15:51 +0000
3587
+
3588
+
3589
+ Started GET "/auth/gds/callback?code=45442ccb3e7d3f5ec07aae9d0bff433f79718e2b60b5b657ed4b77e42d67fb70" for 127.0.0.1 at 2012-06-29 15:15:52 +0000
3590
+ Processing by AuthenticationsController#callback as HTML
3591
+ Parameters: {"code"=>"45442ccb3e7d3f5ec07aae9d0bff433f79718e2b60b5b657ed4b77e42d67fb70"}
3592
+ Authenticating with gds_sso strategy
3593
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3594
+ Completed 302 Found in 1ms
3595
+
3596
+
3597
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:15:52 +0000
3598
+ Processing by ExampleController#this_requires_signin_permission as HTML
3599
+ Completed 200 OK in 1ms (Views: 0.6ms)
3600
+
3601
+
3602
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:15:52 +0000
3603
+ Processing by ExampleController#this_requires_signin_permission as HTML
3604
+ Authenticating with gds_sso strategy
3605
+ Completed in 0ms
3606
+
3607
+
3608
+ Started GET "/auth/gds" for 127.0.0.1 at 2012-06-29 15:15:52 +0000
3609
+
3610
+
3611
+ Started GET "/auth/gds/callback?code=9c3d73ca5c2c159bd9cd624ce3b030339e91d34897901bd9b3cb5948fc70de0c" for 127.0.0.1 at 2012-06-29 15:15:52 +0000
3612
+ Processing by AuthenticationsController#callback as HTML
3613
+ Parameters: {"code"=>"9c3d73ca5c2c159bd9cd624ce3b030339e91d34897901bd9b3cb5948fc70de0c"}
3614
+ Authenticating with gds_sso strategy
3615
+ Redirected to http://www.example-client.com/this_requires_signin_permission
3616
+ Completed 302 Found in 1ms
3617
+
3618
+
3619
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:15:52 +0000
3620
+ Processing by ExampleController#this_requires_signin_permission as HTML
3621
+ Completed 200 OK in 1ms (Views: 0.3ms)
3622
+
3623
+
3624
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:15:52 +0000
3625
+ Processing by ExampleController#restricted as JSON
3626
+ Authenticating with gds_sso_api_access strategy
3627
+ Completed in 13ms
3628
+
3629
+
3630
+ Started GET "/restricted" for 127.0.0.1 at 2012-06-29 15:15:52 +0000
3631
+ Processing by ExampleController#restricted as JSON
3632
+ Authenticating with gds_sso_api_access strategy
3633
+ Completed 200 OK in 1ms (Views: 0.6ms)
3634
+
3635
+
3636
+ Started GET "/this_requires_signin_permission" for 127.0.0.1 at 2012-06-29 15:15:52 +0000
3637
+ Processing by ExampleController#this_requires_signin_permission as JSON
3638
+ Authenticating with gds_sso_api_access strategy
3639
+ Completed 200 OK in 1ms (Views: 0.6ms)
@@ -58,6 +58,28 @@ describe "Integration of client using GDS-SSO with signonotron" do
58
58
 
59
59
  page.should have_content('restricted kablooie')
60
60
  end
61
+
62
+ specify "access to a page that requires signin permission granted " do
63
+ # First we login to authorise the app
64
+ visit "http://#{@client_host}/this_requires_signin_permission"
65
+ fill_in "Email", :with => "test@example-client.com"
66
+ fill_in "Passphrase", :with => "q1w2e3r4t5y6u7i8o9p0"
67
+ click_on "Sign in"
68
+
69
+ click_authorize
70
+
71
+ # At this point the app should be authorised, we reset the session to simulate a new browser visit.
72
+ reset_session!
73
+ page.driver.header 'accept', 'text/html'
74
+
75
+ visit "http://#{@client_host}/this_requires_signin_permission"
76
+ page.should have_content("Sign in")
77
+ fill_in "Email", :with => "test@example-client.com"
78
+ fill_in "Passphrase", :with => "q1w2e3r4t5y6u7i8o9p0"
79
+ click_on "Sign in"
80
+
81
+ page.should have_content('you have signin permission')
82
+ end
61
83
  end
62
84
 
63
85
  describe "API client accesses" do
@@ -75,6 +97,13 @@ describe "Integration of client using GDS-SSO with signonotron" do
75
97
 
76
98
  page.should have_content('restricted kablooie')
77
99
  end
100
+
101
+ specify "access to a page that requires signin permission granted (without basic auth users having permissions)" do
102
+ page.driver.browser.authorize 'test_api_user', 'api_user_password'
103
+ visit "http://#{@client_host}/this_requires_signin_permission"
104
+
105
+ page.should have_content('you have signin permission')
106
+ end
78
107
  end
79
108
 
80
109
  def click_authorize
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gds-sso
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.7.6
5
+ version: 0.7.7
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-06-28 00:00:00 Z
14
+ date: 2012-06-29 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -204,7 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
204
  requirements:
205
205
  - - ">="
206
206
  - !ruby/object:Gem::Version
207
- hash: 3204247925115360978
207
+ hash: 414716890116187310
208
208
  segments:
209
209
  - 0
210
210
  version: "0"
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  requirements:
214
214
  - - ">="
215
215
  - !ruby/object:Gem::Version
216
- hash: 3204247925115360978
216
+ hash: 414716890116187310
217
217
  segments:
218
218
  - 0
219
219
  version: "0"