omniauth-dice 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 136390a70c4e465698843d744e9328e4a4b63131
4
- data.tar.gz: f9822f9f4742f6a7c6c918fbf3a89b4ff9512c7c
3
+ metadata.gz: 9f393f95195efb18da624ef331288b3f4876c997
4
+ data.tar.gz: 0b45003f60b7d5b42132bfaafeb692ccf7f36a5b
5
5
  SHA512:
6
- metadata.gz: 6d2dd8b1326fc262540a5491854bf5536947964872a111a75db27f3b297979b2880f20150bf8e888b1ed89d7cb21ac5809a0bbc25d003439b76799f4369d5ad7
7
- data.tar.gz: 6cc4801fe4420043826cfc27169b1e524460971cb826132e75a11ce6b734f036da268b9e80a25d6431b5fe49cf66596f7865c91a33011a5f99c3f0707a972d4c
6
+ metadata.gz: 332406fca56a0c52f8885a5741c3957d12c53820ffcaab8aaace6528f143f2884befe841c27c05e48ee9b456d87f72ef1f5515493857404942209392e531d557
7
+ data.tar.gz: 99604306f8bec41d99577182d0ebedfa93625b5d0ce27d602b4baeb46f654f498861b945b1711fe7ce74aadb30afdc4521c5f797c94471cd1dc6e7e06b47c362
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -32,6 +32,7 @@ Setup your OmniAuth::Dice builder like so:
32
32
  authentication_path: '/dn',
33
33
  format_header: 'application/xml', # default is 'application/json'
34
34
  format: 'xml', # default is 'json'
35
+ primary_visa: 'EQUESTRIA', # Optional
35
36
  dnc_options: { transformation: 'downcase' }, # see `dnc` gem for all options
36
37
  ssl_config: {
37
38
  ca_file: 'spec/certs/CA.pem',
@@ -43,25 +44,23 @@ Setup your OmniAuth::Dice builder like so:
43
44
 
44
45
  Full configuration options are as follows:
45
46
 
46
- ```
47
- cas_server [String] Required base URL for CAS server
48
- authentication_path [String] URL path for endpoint, e.g. '/users'
49
- return_field [String] Optional path to append after DN string
50
- ssl_config [Hash] Configuration hash for `Faraday` SSL options
51
- format_header [String] 'application/json', 'application/xml', etc
47
+ * `cas_server` [String] Required base URL for CAS server
48
+ * `authentication_path` [String] URL path for endpoint, e.g. '/users'
49
+ * `return_field` [String] Optional path to append after DN string
50
+ * `ssl_config` [Hash] Configuration hash for `Faraday` SSL options
51
+ * `format_header` [String] 'application/json', 'application/xml', etc
52
52
  Defaults to 'application/json'
53
- format [String] 'json', 'xml', etc.
53
+ * `format` [String] 'json', 'xml', etc.
54
54
  Defaults to 'json'
55
- client_cert_header [String] ENV string to access user's X509 cert
55
+ * `client_cert_header` [String] ENV string to access user's X509 cert
56
56
  Defaults to 'HTTP_SSL_CLIENT_CERT'
57
- subject_dn_header [String] ENV string to access user's subject_dn
57
+ * `subject_dn_header` [String] ENV string to access user's subject_dn
58
58
  Defaults to 'HTTP_SSLC_LIENT_S_DN'
59
- issuer_dn_header [String] ENV string to access user's issuer_dn
59
+ * `issuer_dn_header` [String] ENV string to access user's issuer_dn
60
60
  Defaults to 'HTTP_SSL_CLIENT_I_DN'
61
- name_format [Symbol] Format for auth_hash['info']['name']
62
- Defaults to attempting DN common name -> full name -> first & last name
61
+ * `name_format` [Symbol] Format for auth_hash['info']['name']
62
+ Defaults to attempting DN common name -> full name -> first & last name
63
63
  Valid options are: :cn, :full_name, :first_last_name to override
64
- ```
65
64
 
66
65
  ### SSL Client Certificate Notes
67
66
 
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Dice
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -36,8 +36,8 @@ module OmniAuth
36
36
  attr_accessor :dn, :raw_dn, :data
37
37
  args [:cas_server, :authentication_path]
38
38
 
39
- def initialize(*args, &block)
40
- validate_required_params(args)
39
+ def initialize(app, *args, &block)
40
+ required_params_defined?(args)
41
41
 
42
42
  super
43
43
  end
@@ -338,34 +338,32 @@ module OmniAuth
338
338
  [:cas_server, :authentication_path]
339
339
  end
340
340
 
341
- # Verify that arguments required to properly run are present or fail hard
342
- # NOTE: CANNOT call "log" method from initialize block hooks
343
- def validate_required_params(args)
344
- required_params.each do |param|
345
- param_present = nil
346
- args.each do |arg|
347
- param_present = true if param_in_arg?(param, arg) == true
348
- end
349
-
350
- if param_present.nil?
351
- error_msg = "omniauth-dice error: #{param} is required"
352
- fail RequiredCustomParamError, error_msg
341
+ # Determine if required arguments are present or fail hard
342
+ # NOTE: CANNOT call "log" method from within init block methods
343
+ def required_params_defined?(args)
344
+ required_hash = {}
345
+ required_params.each do |key|
346
+ required_hash[key] = false
347
+ end
348
+ args.each do |arg|
349
+ if arg.class == Hash
350
+ arg.each do |sub_arg, value|
351
+ required_hash[sub_arg] = true if required_hash[sub_arg] == false
352
+ end
353
+ else
354
+ required_hash[arg.to_sym] = true if required_hash[sub_arg] == false
353
355
  end
354
356
  end
357
+ required_hash.reject!{ |arg, val| arg if val == true }
358
+ fail_on_invalid_params(required_hash.keys) unless required_hash.empty?
355
359
  end
356
360
 
357
- # Determine if a specified param symbol exists in the passed argument
358
- # NOTE: CANNOT call "log" method from initialize block hooks
359
- def param_in_arg?(param, arg)
360
- if arg.class == Hash
361
- if arg.key?(param.to_sym)
362
- true
363
- else
364
- false
365
- end
366
- else
367
- false
361
+ def fail_on_invalid_params(missing_params)
362
+ error_msg = ""
363
+ missing_params.each do |param|
364
+ error_msg += "omniauth-dice error: #{param} is required\r\n"
368
365
  end
366
+ fail RequiredCustomParamError, error_msg
369
367
  end
370
368
 
371
369
  def set_session_dn(dn_string, type='subject')
@@ -38,11 +38,11 @@ Gem::Specification.new do |spec|
38
38
 
39
39
  spec.add_dependency 'cert_munger', '~> 0.1'
40
40
  spec.add_dependency 'dnc', '~> 0.1'
41
- spec.add_dependency 'excon'
42
- spec.add_dependency 'faraday'
43
- spec.add_dependency 'faraday_middleware'
41
+ spec.add_dependency 'excon', '~> 0.43'
42
+ spec.add_dependency 'faraday', '~> 0.9'
43
+ spec.add_dependency 'faraday_middleware', '~> 0.9'
44
44
  spec.add_dependency 'logging', '~> 1.8'
45
- spec.add_dependency 'multi_xml'
45
+ spec.add_dependency 'multi_xml', '~> 0.5'
46
46
  spec.add_dependency 'omniauth', '~> 1.0'
47
47
 
48
48
  spec.cert_chain = ['certs/stevenhaddox.pem']
@@ -62,6 +62,8 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
62
62
  self.app = Rack::Builder.app do
63
63
  use Rack::Session::Cookie, :secret => '1337geeks'
64
64
  use RackSessionAccess::Middleware
65
+ ap '-'*80
66
+ ap dice_options
65
67
  use OmniAuth::Strategies::Dice, dice_options
66
68
  run lambda{|env| [404, {'env' => env}, ["HELLO!"]]}
67
69
  end
@@ -25,11 +25,11 @@ describe OmniAuth::Strategies::Dice do
25
25
  let(:subject_without_authentication_path) { OmniAuth::Strategies::Dice.new(app, cas_server: 'https://dice.dev') }
26
26
 
27
27
  it 'should require a cas server url' do
28
- expect{ subject }.to raise_error(RequiredCustomParamError, "omniauth-dice error: cas_server is required")
28
+ expect{ subject }.to raise_error(RequiredCustomParamError)
29
29
  end
30
30
 
31
31
  it 'should require an authentication path' do
32
- expect{ subject_without_authentication_path }.to raise_error(RequiredCustomParamError, "omniauth-dice error: authentication_path is required")
32
+ expect{ subject_without_authentication_path }.to raise_error(RequiredCustomParamError)
33
33
  end
34
34
  end
35
35
 
data.tar.gz.sig CHANGED
Binary file
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.1.1
4
+ version: 0.1.2
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-01-29 00:00:00.000000000 Z
33
+ date: 2015-01-31 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: awesome_print
@@ -274,44 +274,44 @@ dependencies:
274
274
  name: excon
275
275
  requirement: !ruby/object:Gem::Requirement
276
276
  requirements:
277
- - - ">="
277
+ - - "~>"
278
278
  - !ruby/object:Gem::Version
279
- version: '0'
279
+ version: '0.43'
280
280
  type: :runtime
281
281
  prerelease: false
282
282
  version_requirements: !ruby/object:Gem::Requirement
283
283
  requirements:
284
- - - ">="
284
+ - - "~>"
285
285
  - !ruby/object:Gem::Version
286
- version: '0'
286
+ version: '0.43'
287
287
  - !ruby/object:Gem::Dependency
288
288
  name: faraday
289
289
  requirement: !ruby/object:Gem::Requirement
290
290
  requirements:
291
- - - ">="
291
+ - - "~>"
292
292
  - !ruby/object:Gem::Version
293
- version: '0'
293
+ version: '0.9'
294
294
  type: :runtime
295
295
  prerelease: false
296
296
  version_requirements: !ruby/object:Gem::Requirement
297
297
  requirements:
298
- - - ">="
298
+ - - "~>"
299
299
  - !ruby/object:Gem::Version
300
- version: '0'
300
+ version: '0.9'
301
301
  - !ruby/object:Gem::Dependency
302
302
  name: faraday_middleware
303
303
  requirement: !ruby/object:Gem::Requirement
304
304
  requirements:
305
- - - ">="
305
+ - - "~>"
306
306
  - !ruby/object:Gem::Version
307
- version: '0'
307
+ version: '0.9'
308
308
  type: :runtime
309
309
  prerelease: false
310
310
  version_requirements: !ruby/object:Gem::Requirement
311
311
  requirements:
312
- - - ">="
312
+ - - "~>"
313
313
  - !ruby/object:Gem::Version
314
- version: '0'
314
+ version: '0.9'
315
315
  - !ruby/object:Gem::Dependency
316
316
  name: logging
317
317
  requirement: !ruby/object:Gem::Requirement
@@ -330,16 +330,16 @@ dependencies:
330
330
  name: multi_xml
331
331
  requirement: !ruby/object:Gem::Requirement
332
332
  requirements:
333
- - - ">="
333
+ - - "~>"
334
334
  - !ruby/object:Gem::Version
335
- version: '0'
335
+ version: '0.5'
336
336
  type: :runtime
337
337
  prerelease: false
338
338
  version_requirements: !ruby/object:Gem::Requirement
339
339
  requirements:
340
- - - ">="
340
+ - - "~>"
341
341
  - !ruby/object:Gem::Version
342
- version: '0'
342
+ version: '0.5'
343
343
  - !ruby/object:Gem::Dependency
344
344
  name: omniauth
345
345
  requirement: !ruby/object:Gem::Requirement
@@ -407,7 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
407
407
  version: '0'
408
408
  requirements: []
409
409
  rubyforge_project:
410
- rubygems_version: 2.4.4
410
+ rubygems_version: 2.2.2
411
411
  signing_key:
412
412
  specification_version: 4
413
413
  summary: DN Interoperable Conversion Expert Strategy
metadata.gz.sig CHANGED
Binary file