gds-sso 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gds-sso/version.rb +1 -1
- data/lib/gds-sso/warden_config.rb +12 -5
- data/spec/internal/db/combustion_test.sqlite +0 -0
- data/spec/internal/log/test.log +4516 -162
- metadata +32 -32
data/lib/gds-sso/version.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
require 'warden'
|
2
2
|
require 'gds-sso/user'
|
3
3
|
|
4
|
+
def logger
|
5
|
+
if Rails.logger # if we are actually running in a rails app
|
6
|
+
Rails.logger
|
7
|
+
else
|
8
|
+
env['rack.logger']
|
9
|
+
end
|
10
|
+
end
|
4
11
|
|
5
12
|
Warden::Manager.after_authentication do |user, auth, opts|
|
6
13
|
# We've successfully signed in.
|
@@ -32,7 +39,7 @@ Warden::Strategies.add(:gds_sso) do
|
|
32
39
|
end
|
33
40
|
|
34
41
|
def authenticate!
|
35
|
-
|
42
|
+
logger.debug("Authenticating with gds_sso strategy")
|
36
43
|
|
37
44
|
if request.env['omniauth.auth'].nil?
|
38
45
|
fail!("No credentials, bub")
|
@@ -58,7 +65,7 @@ Warden::Strategies.add(:gds_bearer_token) do
|
|
58
65
|
end
|
59
66
|
|
60
67
|
def authenticate!
|
61
|
-
|
68
|
+
logger.debug("Authenticating with gds_bearer_token strategy")
|
62
69
|
|
63
70
|
begin
|
64
71
|
access_token = OAuth2::AccessToken.new(oauth_client, token_from_authorization_header)
|
@@ -137,7 +144,7 @@ Warden::Strategies.add(:gds_sso_api_access) do
|
|
137
144
|
end
|
138
145
|
|
139
146
|
def authenticate!
|
140
|
-
|
147
|
+
logger.debug("Authenticating with gds_sso_api_access strategy")
|
141
148
|
|
142
149
|
auth = Rack::Auth::Basic::Request.new(env)
|
143
150
|
|
@@ -177,7 +184,7 @@ Warden::Strategies.add(:mock_gds_sso) do
|
|
177
184
|
end
|
178
185
|
|
179
186
|
def authenticate!
|
180
|
-
|
187
|
+
logger.warn("Authenticating with mock_gds_sso strategy")
|
181
188
|
|
182
189
|
test_user = GDS::SSO.test_user
|
183
190
|
test_user ||= ENV['GDS_SSO_MOCK_INVALID'].present? ? nil : GDS::SSO::Config.user_klass.first
|
@@ -204,7 +211,7 @@ Warden::Strategies.add(:mock_gds_sso_api_access) do
|
|
204
211
|
end
|
205
212
|
|
206
213
|
def authenticate!
|
207
|
-
|
214
|
+
logger.debug("Authenticating with mock_gds_sso_api_access strategy")
|
208
215
|
success!(GDS::SSO::ApiUser.new)
|
209
216
|
end
|
210
217
|
end
|
Binary file
|