omniauth-dice 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.rubocop.yml +1 -0
- data/README.md +1 -1
- data/lib/omniauth/dice/version.rb +1 -1
- data/lib/omniauth/strategies/dice.rb +7 -7
- data/spec/omniauth/strategies/dice_integrations_spec.rb +19 -21
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa07835678245eda74c877a01bed7d6ead9fa23f
|
4
|
+
data.tar.gz: b0ba3b5276a7b983f0c130c1c41c7d89ca9ee62d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6d78332fde76300334e0c6203a3b57d3e39cb895307eac70a35639d8b6db08e38c004c7bf919ca81621f59019d2ba37de4b131cc1a9d294b07e734e06e6e148
|
7
|
+
data.tar.gz: 6b48beb330e949e82c7b0f3bf9ba1ff3fd4a2d84381c4d7b97ef708f39ba2d1d798041ec612ad459280cde95985a90e80f300ee5106bfa2b8ee33823d0132352
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -90,6 +90,7 @@ module OmniAuth
|
|
90
90
|
|
91
91
|
def callback_phase
|
92
92
|
response = authenticate_user
|
93
|
+
return fail!(:invalid_credentials) if response.nil?
|
93
94
|
@raw_data = response.body
|
94
95
|
@data = parse_response_data
|
95
96
|
session['omniauth.auth'] ||= auth_hash
|
@@ -163,7 +164,7 @@ module OmniAuth
|
|
163
164
|
end
|
164
165
|
if !response || response.status.to_i >= 400
|
165
166
|
log :error, response.inspect
|
166
|
-
return
|
167
|
+
return nil
|
167
168
|
end
|
168
169
|
|
169
170
|
response
|
@@ -229,11 +230,11 @@ module OmniAuth
|
|
229
230
|
|
230
231
|
# Determine if a client is likely a non-person entity
|
231
232
|
def identify_npe(info)
|
232
|
-
info['likely_npe?']
|
233
|
+
info['likely_npe?'] = nil
|
233
234
|
return true if auth_cn_with_tld?(info['common_name']) == true
|
234
|
-
return true if auth_info_missing_email?(info)
|
235
|
-
return true if auth_has_email_without_names?(info)
|
236
|
-
return false if auth_has_email_with_any_name?(info)
|
235
|
+
return true if auth_info_missing_email?(info) == true
|
236
|
+
return true if auth_has_email_without_names?(info) == true
|
237
|
+
return false if auth_has_email_with_any_name?(info) == true
|
237
238
|
end
|
238
239
|
|
239
240
|
# Identify if there's a domain w/ TLD in the common_name
|
@@ -305,7 +306,7 @@ module OmniAuth
|
|
305
306
|
|
306
307
|
@conn ||= Faraday.new(url: options.cas_server, ssl: ssl_hash) do |conn|
|
307
308
|
conn.headers = headers
|
308
|
-
conn.response :logger
|
309
|
+
conn.response :logger # log requests to STDOUT
|
309
310
|
conn.response :xml, content_type: /\bxml$/
|
310
311
|
conn.response :json, content_type: /\bjson$/
|
311
312
|
conn.adapter :excon
|
@@ -332,7 +333,6 @@ module OmniAuth
|
|
332
333
|
|
333
334
|
# Detect data format, parse with appropriate library
|
334
335
|
def parse_response_data
|
335
|
-
log :debug, '.parse_response_data'
|
336
336
|
log :debug, "cas_server response.body:\r\n#{@raw_data}"
|
337
337
|
formatted_data = format_data
|
338
338
|
formatted_data = formatted_data.nil? ? @raw_data : formatted_data
|
@@ -73,11 +73,10 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
before(:all) do
|
76
|
-
defaults={
|
76
|
+
@defaults = {
|
77
77
|
cas_server: 'http://example.org',
|
78
78
|
authentication_path: '/dn'
|
79
79
|
}
|
80
|
-
set_app!(defaults)
|
81
80
|
end
|
82
81
|
|
83
82
|
describe "use_callback_url" do
|
@@ -87,12 +86,7 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
87
86
|
authentication_path: '/dn',
|
88
87
|
use_callback_url: true
|
89
88
|
}
|
90
|
-
|
91
|
-
use Rack::Session::Cookie, :secret => '1337geeks'
|
92
|
-
use RackSessionAccess::Middleware
|
93
|
-
use OmniAuth::Strategies::Dice, callback_url_opts
|
94
|
-
run lambda{|env| [404, {'env' => env}, ["HELLO!"]]}
|
95
|
-
end
|
89
|
+
set_app!(callback_url_opts)
|
96
90
|
header 'Ssl-Client-Cert', user_cert
|
97
91
|
get '/auth/dice'
|
98
92
|
expect(last_request.env['HTTP_SSL_CLIENT_CERT']).to eq(user_cert)
|
@@ -110,12 +104,7 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
110
104
|
authentication_path: '/dn',
|
111
105
|
custom_callback_url: 'http://example.org/sub-uri/auth/dice/callback'
|
112
106
|
}
|
113
|
-
|
114
|
-
use Rack::Session::Cookie, :secret => '1337geeks'
|
115
|
-
use RackSessionAccess::Middleware
|
116
|
-
use OmniAuth::Strategies::Dice, callback_url_opts
|
117
|
-
run lambda{|env| [404, {'env' => env}, ["HELLO!"]]}
|
118
|
-
end
|
107
|
+
set_app!(callback_url_opts)
|
119
108
|
header 'Ssl-Client-Cert', user_cert
|
120
109
|
get '/auth/dice'
|
121
110
|
expect(last_request.env['HTTP_SSL_CLIENT_CERT']).to eq(user_cert)
|
@@ -128,10 +117,14 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
128
117
|
|
129
118
|
describe '#request_phase' do
|
130
119
|
it 'should fail without a client DN' do
|
131
|
-
|
120
|
+
set_app!(@defaults)
|
121
|
+
get '/auth/dice'
|
122
|
+
expect(last_request.env['omniauth.error.type']).to eq(:"You need a valid DN to authenticate.")
|
123
|
+
expect(last_response.location).to eq('/auth/failure?message=You need a valid DN to authenticate.&strategy=dice')
|
132
124
|
end
|
133
125
|
|
134
126
|
it "should set the client & issuer's DN (from certificate)" do
|
127
|
+
set_app!(@defaults)
|
135
128
|
header 'Ssl-Client-Cert', user_cert
|
136
129
|
get '/auth/dice'
|
137
130
|
expect(last_request.env['HTTP_SSL_CLIENT_CERT']).to eq(user_cert)
|
@@ -142,6 +135,7 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
142
135
|
end
|
143
136
|
|
144
137
|
it "should set the client's DN (from header)" do
|
138
|
+
set_app!(@defaults)
|
145
139
|
header 'Ssl-Client-S-Dn', raw_dn
|
146
140
|
get '/auth/dice'
|
147
141
|
expect(last_request.env['HTTP_SSL_CLIENT_S_DN']).to eq(raw_dn)
|
@@ -152,6 +146,7 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
152
146
|
end
|
153
147
|
|
154
148
|
it "should set the issuer's DN (from header)" do
|
149
|
+
set_app!(@defaults)
|
155
150
|
header 'Ssl-Client-S-Dn', raw_dn
|
156
151
|
header 'Ssl-Client-I-Dn', raw_issuer_dn
|
157
152
|
get '/auth/dice'
|
@@ -164,7 +159,7 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
164
159
|
|
165
160
|
describe '#callback_phase' do
|
166
161
|
before(:each) do
|
167
|
-
|
162
|
+
callback_phase_opts = {
|
168
163
|
cas_server: 'https://example.org:3000',
|
169
164
|
authentication_path: '/dn',
|
170
165
|
dnc_options: { transformation: 'downcase' },
|
@@ -174,8 +169,8 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
174
169
|
client_key: 'spec/certs/key.np.pem'
|
175
170
|
},
|
176
171
|
primary_visa: 'CLOUDSDALE'
|
177
|
-
}
|
178
|
-
|
172
|
+
}
|
173
|
+
set_app!(callback_phase_opts)
|
179
174
|
stub_request(:get, "https://example.org:3000/dn/cn=ruby%20certificate%20rbcert,dc=ruby-lang,dc=org/info.json?issuerDn=cn=ruby%20ca,dc=ruby-lang,dc=org").
|
180
175
|
with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'Host'=>'example.org:3000', 'User-Agent'=>/^Faraday via Ruby.*$/, 'X-Xsrf-Useprotection'=>'false'}).
|
181
176
|
to_return(status: 200, body: valid_user_json, headers: {})
|
@@ -200,7 +195,7 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
200
195
|
end
|
201
196
|
|
202
197
|
it 'should return a 200 with an XML object of user information on success' do
|
203
|
-
|
198
|
+
xml_request_opts = {
|
204
199
|
cas_server: 'https://example.org:3000',
|
205
200
|
authentication_path: '/dn',
|
206
201
|
format_header: 'application/xml',
|
@@ -211,7 +206,8 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
211
206
|
client_cert: 'spec/certs/client.pem',
|
212
207
|
client_key: 'spec/certs/key.np.pem'
|
213
208
|
}
|
214
|
-
}
|
209
|
+
}
|
210
|
+
set_app!(xml_request_opts)
|
215
211
|
stub_request(:get, "https://example.org:3000/dn/cn=ruby%20certificate%20rbcert,dc=ruby-lang,dc=org/info.xml?issuerDn=cn=ruby%20ca,dc=ruby-lang,dc=org").
|
216
212
|
with(:headers => {'Accept'=>'application/xml', 'Content-Type'=>'application/xml', 'Host'=>'example.org:3000', 'User-Agent'=>/^Faraday via Ruby.*$/, 'X-Xsrf-Useprotection'=>'false'}).
|
217
213
|
to_return(status: 200, body: valid_user_xml, headers: {})
|
@@ -240,7 +236,9 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
|
|
240
236
|
|
241
237
|
header 'Ssl-Client-Cert', user_cert
|
242
238
|
get '/auth/dice'
|
243
|
-
|
239
|
+
follow_redirect! # Needed to hit /auth/dice/callback & trigger errors!
|
240
|
+
expect(last_request.env['omniauth.error.type']).to eq(:invalid_credentials)
|
241
|
+
expect(last_response.location).to eq('/auth/failure?message=invalid_credentials&strategy=dice')
|
244
242
|
end
|
245
243
|
end
|
246
244
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-dice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Haddox
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
42qdwEXvvkODZAD6KAIXPdmbMfBgPbcd+B/4eUA0PyKo+4dgL1NuqX4MPWToevIZ
|
31
31
|
O8EKLF2X7NmC6FY1bOsSj/J8r1SOkx0rxgF+geRvY1P+hfNjDfxTsjU=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-
|
33
|
+
date: 2015-10-02 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: awesome_print
|
@@ -410,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
410
410
|
version: '0'
|
411
411
|
requirements: []
|
412
412
|
rubyforge_project:
|
413
|
-
rubygems_version: 2.4.
|
413
|
+
rubygems_version: 2.4.5.1
|
414
414
|
signing_key:
|
415
415
|
specification_version: 4
|
416
416
|
summary: DN Interoperable Conversion Expert Strategy
|
metadata.gz.sig
CHANGED
Binary file
|