certmeister 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41a8e46ac96ea1df82ccd6bc6d1e7ac813c45b39
4
- data.tar.gz: 7d3deab06f303c7725b316db513e1951d7ce2429
3
+ metadata.gz: 4a27d8981207e04f484c463efee5eb192b1ac040
4
+ data.tar.gz: d3d089cf572cd18dd08997483539fe56b1257f88
5
5
  SHA512:
6
- metadata.gz: 476a2abd15ebd45ac60facf0c6b3837ae08b3bc11d9785e230ecd94b58acad5aa3abf3a5b5db246be204a9400e1bf2aacc19173ff42f4d3cc721f1edb1f34ef4
7
- data.tar.gz: e7385adbdb0288a486897979c64b459b1efb672bbc334502300ac35764bff158a7759060f748e68b5750d013f01b40e8281deb277786d13e06b0c6e16d9c7a7d
6
+ metadata.gz: 0699466fc8b0eee2e5f68a001138c8a4fa30b64c9fc16830e6e5b5bd64b3d08796e6f348e7c3d2430366890505991173d8857a7e00b252c2923dbf023b0af5c2
7
+ data.tar.gz: 76df1686defaeb078155b070dd5b4325bf29a5d565c49bd4d4dacfc5f4754b7607952da5e516651e75edd740fded0e02def5ac2ce3c20032fb725e988629d8c6
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- certmeister (0.4.0)
5
- certmeister-rack (0.4.0)
6
- certmeister (= 0.4.0)
4
+ certmeister (0.4.1)
5
+ certmeister-rack (0.4.1)
6
+ certmeister (= 0.4.1)
7
7
  rack (~> 1.5)
8
- certmeister-redis (0.4.0)
9
- certmeister (= 0.4.0)
8
+ certmeister-redis (0.4.1)
9
+ certmeister (= 0.4.1)
10
10
  redis-sentinel (~> 1.4)
11
11
 
12
12
  GEM
data/README.md CHANGED
@@ -58,6 +58,8 @@ changes):
58
58
  ```
59
59
  # edit lib/certmeister/version.rb
60
60
  bundle
61
- git commit -m "Bump to version x.y.z" Gemfile.lock lib/certmeister/version.rb
61
+ git commit \
62
+ -m "Bump version to v$(bundle exec ruby -Ilib -rcertmeister -e 'puts Certmeister::VERSION')" \
63
+ Gemfile.lock lib/certmeister/version.rb
62
64
  bundle exec release
63
65
  ```
@@ -12,11 +12,10 @@ module Certmeister
12
12
  end
13
13
 
14
14
  def authenticate(request)
15
- failure = Certmeister::Policy::Response.new(false, "no conditions satisifed")
16
- @policies.inject(failure) do |continue, policy|
15
+ @policies.inject(nil) do |continue, policy|
17
16
  response = policy.authenticate(request)
18
17
  break response if response.authenticated?
19
- continue
18
+ continue or response
20
19
  end
21
20
  end
22
21
 
@@ -1,5 +1,5 @@
1
1
  module Certmeister
2
2
 
3
- VERSION = '0.4.0' unless defined?(VERSION)
3
+ VERSION = '0.4.1' unless defined?(VERSION)
4
4
 
5
5
  end
@@ -32,9 +32,17 @@ describe Certmeister::Policy::ChainAll do
32
32
  policies.each do |policy|
33
33
  response = policy.authenticate({anything: 'something'})
34
34
  expect(response).to_not be_authenticated
35
- expect(response.error).to eql "blackholed"
36
35
  end
37
36
  end
38
37
 
38
+ it "uses the error message of the first encountered refusal in the chain" do
39
+ policy = Certmeister::Policy::ChainAll.new([
40
+ Certmeister::Policy::Domain.new(['unmatched.com']),
41
+ Certmeister::Policy::Blackhole.new,
42
+ ])
43
+ response = policy.authenticate({cn: 'wrongdomain.com'})
44
+ expect(response.error).to eql 'cn in unknown domain'
45
+ end
46
+
39
47
  end
40
48
 
@@ -25,13 +25,19 @@ describe Certmeister::Policy::ChainAny do
25
25
  end
26
26
 
27
27
  it "refuses a request that none of its chained policies refuses" do
28
- policy = Certmeister::Policy::ChainAll.new([ Certmeister::Policy::Blackhole.new, Certmeister::Policy::Blackhole.new])
28
+ policy = Certmeister::Policy::ChainAny.new([ Certmeister::Policy::Blackhole.new, Certmeister::Policy::Blackhole.new])
29
29
  response = policy.authenticate({anything: 'something'})
30
30
  expect(response).to_not be_authenticated
31
- expect(response.error).to eql "blackholed"
32
31
  end
33
32
 
34
- it "uses the error message of the last encountered refusal in the chain"
33
+ it "uses the error message of the first encountered refusal in the chain" do
34
+ policy = Certmeister::Policy::ChainAny.new([
35
+ Certmeister::Policy::Domain.new(['unmatched.com']),
36
+ Certmeister::Policy::Blackhole.new,
37
+ ])
38
+ response = policy.authenticate({cn: 'wrongdomain.com'})
39
+ expect(response.error).to eql 'cn in unknown domain'
40
+ end
35
41
 
36
42
  end
37
43
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: certmeister
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheldon Hearn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-05 00:00:00.000000000 Z
11
+ date: 2014-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler