gds-sso 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
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
@@ -1,5 +1,5 @@
1
1
  module GDS
2
2
  module SSO
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -41,6 +41,11 @@ Warden::Strategies.add(:gds_sso_api_access) do
41
41
 
42
42
  def authenticate!
43
43
  Rails.logger.debug("Authenticating with gds_sso_api_access strategy")
44
+
45
+ if ! basic_auth_configured?
46
+ Rails.logger.debug("Basic auth not configured, not requiring authentication")
47
+ success!('api')
48
+ end
44
49
 
45
50
  auth = Rack::Auth::Basic::Request.new(env)
46
51
 
@@ -54,6 +59,10 @@ Warden::Strategies.add(:gds_sso_api_access) do
54
59
  end
55
60
  end
56
61
 
62
+ def basic_auth_configured?
63
+ ! ::GDS::SSO::Config.basic_auth_user.nil?
64
+ end
65
+
57
66
  def valid_api_user?(username, password)
58
67
  username.to_s.strip != '' &&
59
68
  password.to_s.strip != '' &&
metadata CHANGED
@@ -1,121 +1,118 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gds-sso
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
4
5
  prerelease:
5
- version: 0.3.0
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
- date: 2012-01-10 00:00:00 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+ date: 2012-01-17 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: rails
18
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &70228864568980 !ruby/object:Gem::Requirement
19
18
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
23
22
  version: 3.0.0
24
23
  type: :runtime
25
24
  prerelease: false
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
25
+ version_requirements: *70228864568980
26
+ - !ruby/object:Gem::Dependency
28
27
  name: warden
29
- requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirement: &70228864566860 !ruby/object:Gem::Requirement
30
29
  none: false
31
- requirements:
32
- - - "="
33
- - !ruby/object:Gem::Version
30
+ requirements:
31
+ - - =
32
+ - !ruby/object:Gem::Version
34
33
  version: 1.0.6
35
34
  type: :runtime
36
35
  prerelease: false
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *70228864566860
37
+ - !ruby/object:Gem::Dependency
39
38
  name: oauth2
40
- requirement: &id003 !ruby/object:Gem::Requirement
39
+ requirement: &70228864564820 !ruby/object:Gem::Requirement
41
40
  none: false
42
- requirements:
43
- - - "="
44
- - !ruby/object:Gem::Version
41
+ requirements:
42
+ - - =
43
+ - !ruby/object:Gem::Version
45
44
  version: 0.4.1
46
45
  type: :runtime
47
46
  prerelease: false
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
47
+ version_requirements: *70228864564820
48
+ - !ruby/object:Gem::Dependency
50
49
  name: oa-oauth
51
- requirement: &id004 !ruby/object:Gem::Requirement
50
+ requirement: &70228864563740 !ruby/object:Gem::Requirement
52
51
  none: false
53
- requirements:
54
- - - "="
55
- - !ruby/object:Gem::Version
52
+ requirements:
53
+ - - =
54
+ - !ruby/object:Gem::Version
56
55
  version: 0.2.6
57
56
  type: :runtime
58
57
  prerelease: false
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
58
+ version_requirements: *70228864563740
59
+ - !ruby/object:Gem::Dependency
61
60
  name: oa-core
62
- requirement: &id005 !ruby/object:Gem::Requirement
61
+ requirement: &70228864558980 !ruby/object:Gem::Requirement
63
62
  none: false
64
- requirements:
65
- - - "="
66
- - !ruby/object:Gem::Version
63
+ requirements:
64
+ - - =
65
+ - !ruby/object:Gem::Version
67
66
  version: 0.2.6
68
67
  type: :runtime
69
68
  prerelease: false
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
69
+ version_requirements: *70228864558980
70
+ - !ruby/object:Gem::Dependency
72
71
  name: rack-accept
73
- requirement: &id006 !ruby/object:Gem::Requirement
72
+ requirement: &70228864558480 !ruby/object:Gem::Requirement
74
73
  none: false
75
- requirements:
74
+ requirements:
76
75
  - - ~>
77
- - !ruby/object:Gem::Version
76
+ - !ruby/object:Gem::Version
78
77
  version: 0.4.4
79
78
  type: :runtime
80
79
  prerelease: false
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
80
+ version_requirements: *70228864558480
81
+ - !ruby/object:Gem::Dependency
83
82
  name: rake
84
- requirement: &id007 !ruby/object:Gem::Requirement
83
+ requirement: &70228864558000 !ruby/object:Gem::Requirement
85
84
  none: false
86
- requirements:
85
+ requirements:
87
86
  - - ~>
88
- - !ruby/object:Gem::Version
87
+ - !ruby/object:Gem::Version
89
88
  version: 0.9.2
90
89
  type: :development
91
90
  prerelease: false
92
- version_requirements: *id007
93
- - !ruby/object:Gem::Dependency
91
+ version_requirements: *70228864558000
92
+ - !ruby/object:Gem::Dependency
94
93
  name: mocha
95
- requirement: &id008 !ruby/object:Gem::Requirement
94
+ requirement: &70228864557420 !ruby/object:Gem::Requirement
96
95
  none: false
97
- requirements:
96
+ requirements:
98
97
  - - ~>
99
- - !ruby/object:Gem::Version
98
+ - !ruby/object:Gem::Version
100
99
  version: 0.9.0
101
100
  type: :development
102
101
  prerelease: false
103
- version_requirements: *id008
102
+ version_requirements: *70228864557420
104
103
  description: Client for GDS' OAuth 2-based SSO
105
- email:
104
+ email:
106
105
  - matt@constituentparts.com
107
106
  - james.stewart@digital.cabinet-office.gov.uk
108
107
  executables: []
109
-
110
108
  extensions: []
111
-
112
109
  extra_rdoc_files: []
113
-
114
- files:
110
+ files:
115
111
  - lib/gds-sso/api_access.rb
116
112
  - lib/gds-sso/config.rb
117
113
  - lib/gds-sso/controller_methods.rb
118
114
  - lib/gds-sso/failure_app.rb
115
+ - lib/gds-sso/generators/gds_sso_setup.rb
119
116
  - lib/gds-sso/omniauth_strategy.rb
120
117
  - lib/gds-sso/routes.rb
121
118
  - lib/gds-sso/user.rb
@@ -130,38 +127,29 @@ files:
130
127
  - test/test_user.rb
131
128
  homepage: https://github.com/alphagov/gds-sso
132
129
  licenses: []
133
-
134
130
  post_install_message:
135
131
  rdoc_options: []
136
-
137
- require_paths:
132
+ require_paths:
138
133
  - lib
139
- required_ruby_version: !ruby/object:Gem::Requirement
134
+ required_ruby_version: !ruby/object:Gem::Requirement
140
135
  none: false
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- hash: -376516686123011262
145
- segments:
146
- - 0
147
- version: "0"
148
- required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
141
  none: false
150
- requirements:
151
- - - ">="
152
- - !ruby/object:Gem::Version
153
- hash: -376516686123011262
154
- segments:
155
- - 0
156
- version: "0"
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
157
146
  requirements: []
158
-
159
147
  rubyforge_project: gds-sso
160
- rubygems_version: 1.8.13
148
+ rubygems_version: 1.8.10
161
149
  signing_key:
162
150
  specification_version: 3
163
151
  summary: Client for GDS' OAuth 2-based SSO
164
- test_files:
152
+ test_files:
165
153
  - test/test_helper.rb
166
154
  - test/test_omniauth_strategy.rb
167
155
  - test/test_user.rb