gds-sso 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gds-sso/version.rb +2 -2
- data/lib/gds-sso/warden_config.rb +1 -10
- metadata +93 -81
- data/lib/gds-sso/generators/gds_sso_setup.rb +0 -22
data/lib/gds-sso/version.rb
CHANGED
@@ -46,11 +46,6 @@ Warden::Strategies.add(:gds_sso_api_access) do
|
|
46
46
|
def authenticate!
|
47
47
|
Rails.logger.debug("Authenticating with gds_sso_api_access strategy")
|
48
48
|
|
49
|
-
if ! basic_auth_configured?
|
50
|
-
Rails.logger.debug("Basic auth not configured, not requiring authentication")
|
51
|
-
success!(api_user)
|
52
|
-
end
|
53
|
-
|
54
49
|
auth = Rack::Auth::Basic::Request.new(env)
|
55
50
|
|
56
51
|
return custom!(unauthorized) unless auth.provided?
|
@@ -63,10 +58,6 @@ Warden::Strategies.add(:gds_sso_api_access) do
|
|
63
58
|
end
|
64
59
|
end
|
65
60
|
|
66
|
-
def basic_auth_configured?
|
67
|
-
! ::GDS::SSO::Config.basic_auth_user.nil?
|
68
|
-
end
|
69
|
-
|
70
61
|
def valid_api_user?(username, password)
|
71
62
|
username.to_s.strip != '' &&
|
72
63
|
password.to_s.strip != '' &&
|
@@ -93,7 +84,7 @@ Warden::Strategies.add(:mock_gds_sso) do
|
|
93
84
|
end
|
94
85
|
|
95
86
|
def authenticate!
|
96
|
-
Rails.logger.
|
87
|
+
Rails.logger.warn("Authenticating with mock_gds_sso strategy")
|
97
88
|
test_user = GDS::SSO.test_user || GDS::SSO::Config.user_klass.first
|
98
89
|
if test_user
|
99
90
|
success!(test_user)
|
metadata
CHANGED
@@ -1,142 +1,145 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-sso
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.2
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.4.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Matt Patterson
|
9
9
|
- James Stewart
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
|
14
|
+
date: 2012-01-25 00:00:00 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
16
17
|
name: rails
|
17
|
-
requirement: &
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
19
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
22
23
|
version: 3.0.0
|
23
24
|
type: :runtime
|
24
25
|
prerelease: false
|
25
|
-
version_requirements: *
|
26
|
-
- !ruby/object:Gem::Dependency
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
27
28
|
name: warden
|
28
|
-
requirement: &
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
30
|
none: false
|
30
|
-
requirements:
|
31
|
-
- - =
|
32
|
-
- !ruby/object:Gem::Version
|
31
|
+
requirements:
|
32
|
+
- - "="
|
33
|
+
- !ruby/object:Gem::Version
|
33
34
|
version: 1.0.6
|
34
35
|
type: :runtime
|
35
36
|
prerelease: false
|
36
|
-
version_requirements: *
|
37
|
-
- !ruby/object:Gem::Dependency
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
38
39
|
name: oauth2
|
39
|
-
requirement: &
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
|
-
requirements:
|
42
|
-
- - =
|
43
|
-
- !ruby/object:Gem::Version
|
42
|
+
requirements:
|
43
|
+
- - "="
|
44
|
+
- !ruby/object:Gem::Version
|
44
45
|
version: 0.4.1
|
45
46
|
type: :runtime
|
46
47
|
prerelease: false
|
47
|
-
version_requirements: *
|
48
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
49
50
|
name: oa-oauth
|
50
|
-
requirement: &
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
51
52
|
none: false
|
52
|
-
requirements:
|
53
|
-
- - =
|
54
|
-
- !ruby/object:Gem::Version
|
53
|
+
requirements:
|
54
|
+
- - "="
|
55
|
+
- !ruby/object:Gem::Version
|
55
56
|
version: 0.2.6
|
56
57
|
type: :runtime
|
57
58
|
prerelease: false
|
58
|
-
version_requirements: *
|
59
|
-
- !ruby/object:Gem::Dependency
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
60
61
|
name: oa-core
|
61
|
-
requirement: &
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
62
63
|
none: false
|
63
|
-
requirements:
|
64
|
-
- - =
|
65
|
-
- !ruby/object:Gem::Version
|
64
|
+
requirements:
|
65
|
+
- - "="
|
66
|
+
- !ruby/object:Gem::Version
|
66
67
|
version: 0.2.6
|
67
68
|
type: :runtime
|
68
69
|
prerelease: false
|
69
|
-
version_requirements: *
|
70
|
-
- !ruby/object:Gem::Dependency
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
71
72
|
name: rack-accept
|
72
|
-
requirement: &
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
73
74
|
none: false
|
74
|
-
requirements:
|
75
|
+
requirements:
|
75
76
|
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
+
- !ruby/object:Gem::Version
|
77
78
|
version: 0.4.4
|
78
79
|
type: :runtime
|
79
80
|
prerelease: false
|
80
|
-
version_requirements: *
|
81
|
-
- !ruby/object:Gem::Dependency
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
82
83
|
name: plek
|
83
|
-
requirement: &
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
84
85
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version:
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
89
90
|
type: :runtime
|
90
91
|
prerelease: false
|
91
|
-
version_requirements: *
|
92
|
-
- !ruby/object:Gem::Dependency
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
93
94
|
name: rake
|
94
|
-
requirement: &
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
95
96
|
none: false
|
96
|
-
requirements:
|
97
|
+
requirements:
|
97
98
|
- - ~>
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
+
- !ruby/object:Gem::Version
|
99
100
|
version: 0.9.2
|
100
101
|
type: :development
|
101
102
|
prerelease: false
|
102
|
-
version_requirements: *
|
103
|
-
- !ruby/object:Gem::Dependency
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
104
105
|
name: mocha
|
105
|
-
requirement: &
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
106
107
|
none: false
|
107
|
-
requirements:
|
108
|
+
requirements:
|
108
109
|
- - ~>
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
+
- !ruby/object:Gem::Version
|
110
111
|
version: 0.9.0
|
111
112
|
type: :development
|
112
113
|
prerelease: false
|
113
|
-
version_requirements: *
|
114
|
-
- !ruby/object:Gem::Dependency
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
115
116
|
name: capybara
|
116
|
-
requirement: &
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
117
118
|
none: false
|
118
|
-
requirements:
|
119
|
-
- -
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
version:
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: "0"
|
122
123
|
type: :development
|
123
124
|
prerelease: false
|
124
|
-
version_requirements: *
|
125
|
+
version_requirements: *id010
|
125
126
|
description: Client for GDS' OAuth 2-based SSO
|
126
|
-
email:
|
127
|
+
email:
|
127
128
|
- matt@constituentparts.com
|
128
129
|
- james.stewart@digital.cabinet-office.gov.uk
|
129
130
|
executables: []
|
131
|
+
|
130
132
|
extensions: []
|
133
|
+
|
131
134
|
extra_rdoc_files: []
|
132
|
-
|
135
|
+
|
136
|
+
files:
|
133
137
|
- app/controllers/authentications_controller.rb
|
134
138
|
- config/routes.rb
|
135
139
|
- lib/gds-sso/api_access.rb
|
136
140
|
- lib/gds-sso/config.rb
|
137
141
|
- lib/gds-sso/controller_methods.rb
|
138
142
|
- lib/gds-sso/failure_app.rb
|
139
|
-
- lib/gds-sso/generators/gds_sso_setup.rb
|
140
143
|
- lib/gds-sso/omniauth_strategy.rb
|
141
144
|
- lib/gds-sso/routes.rb
|
142
145
|
- lib/gds-sso/user.rb
|
@@ -153,29 +156,38 @@ files:
|
|
153
156
|
- test/test_user.rb
|
154
157
|
homepage: https://github.com/alphagov/gds-sso
|
155
158
|
licenses: []
|
159
|
+
|
156
160
|
post_install_message:
|
157
161
|
rdoc_options: []
|
158
|
-
|
162
|
+
|
163
|
+
require_paths:
|
159
164
|
- lib
|
160
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
166
|
none: false
|
162
|
-
requirements:
|
163
|
-
- -
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
|
166
|
-
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
hash: -535713269746465567
|
171
|
+
segments:
|
172
|
+
- 0
|
173
|
+
version: "0"
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
175
|
none: false
|
168
|
-
requirements:
|
169
|
-
- -
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
hash: -535713269746465567
|
180
|
+
segments:
|
181
|
+
- 0
|
182
|
+
version: "0"
|
172
183
|
requirements: []
|
184
|
+
|
173
185
|
rubyforge_project: gds-sso
|
174
|
-
rubygems_version: 1.8.
|
186
|
+
rubygems_version: 1.8.13
|
175
187
|
signing_key:
|
176
188
|
specification_version: 3
|
177
189
|
summary: Client for GDS' OAuth 2-based SSO
|
178
|
-
test_files:
|
190
|
+
test_files:
|
179
191
|
- test/test_gds_sso_strategy.rb
|
180
192
|
- test/test_helper.rb
|
181
193
|
- test/test_http_strategy.rb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class GdsSsoSetupGenerator < Rails::Generators::Base
|
2
|
-
|
3
|
-
def create_initializer_file
|
4
|
-
create_file "config/initializers/gds_sso.rb", <<-FILE
|
5
|
-
GDS::SSO.config do |config|
|
6
|
-
config.user_model = "User"
|
7
|
-
config.oauth_id = 'set_me'
|
8
|
-
config.oauth_secret = 'set_me'
|
9
|
-
config.oauth_root_url = Plek.current.find("authentication")
|
10
|
-
end
|
11
|
-
|
12
|
-
FILE
|
13
|
-
end
|
14
|
-
|
15
|
-
def create_model
|
16
|
-
create_file "app/models/user.rb", <<-FILE
|
17
|
-
class User
|
18
|
-
include GDS::SSO::User
|
19
|
-
end
|
20
|
-
FILE
|
21
|
-
end
|
22
|
-
end
|