smaak 0.1.16 → 0.1.17

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: 5b17b6238e6f860b8293578eceaa0d2da63a5252
4
- data.tar.gz: b916802eb239649714875b84af5db205b7cccedc
3
+ metadata.gz: f45f06921b628e88bdca56b549ece83df6ec865c
4
+ data.tar.gz: 2e1c446e1f3f3eed67162ca298e8ad88dc75d000
5
5
  SHA512:
6
- metadata.gz: 926a5f1c180262e6026a0281e1a3d4e25dc54025877b4fd95dbebf2d2ee7760158e1b50a9053bd9b48e6ab5f9347681e5b051a2b1a3c9dd68b75fe2f48efbfba
7
- data.tar.gz: 093925f1559c600eaa38806d2f067f052a27fb20b70d8808c0ad9188e1e327a9ecd2e1ff53b3118f06bd900a6a2c6389016088e2e318378dd50affe830413812
6
+ metadata.gz: 99d952eb0657697c4247f6d5fc1c4fb0e37ce320d31fa8ad483e008becd1958a05225cd7bbd64ed004d2e19d1df16faccd5ea80b835497e920dbdeb19f50cb0a
7
+ data.tar.gz: 95b53689765041860e3dcb3b5a652fb98409facf274596ce88c06fc74f897813140e134391209983268f11ea843542d907fa1ed66da0add5b8ecb6332b0d447d
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  backup
6
6
  doc
7
7
  prototype
8
+ .byebug_history
data/README.md CHANGED
@@ -44,6 +44,11 @@ When setting up a Smaak::Server, tell the server of your SmaakService and verify
44
44
  end
45
45
  end
46
46
 
47
+ Note: verification of intended recipient can be disabled, e.g. in cases of dynamic
48
+ trust stores as follows. USE WITH CAUTION:
49
+
50
+ server.verify_recipient = false
51
+
47
52
  ### Example Client
48
53
 
49
54
  A Smaak::Client operates on an instance of an HTTP request. The Smaak module can be told about different request technology implementations by providing an adaptor to a request technology (Smaak::add_request_adaptor). The gem ships with a Net::HTTP adaptor. Call Smaak::create_adaptor with your request to get an instance of an adaptor.
data/lib/smaak/server.rb CHANGED
@@ -6,10 +6,12 @@ module Smaak
6
6
  class Server < Associate
7
7
  attr_accessor :nonce_store
8
8
  attr_reader :private_key
9
+ attr_accessor :verify_recipient
9
10
 
10
11
  def initialize
11
12
  super
12
13
  @nonce_store = Persistent::Cache.new("nonce_store", @token_life, Persistent::Cache::STORAGE_RAM)
14
+ @verify_recipient = true
13
15
  end
14
16
 
15
17
  def set_public_key(key)
@@ -45,7 +47,7 @@ module Smaak
45
47
  return false
46
48
  end
47
49
  puts "[smaak error]: public key not set. Did you call set_public_key() ?" if @key.nil?
48
- if not auth_message.intended_for_recipient?(@key.export)
50
+ if (@verify_recipient) and (not auth_message.intended_for_recipient?(@key.export))
49
51
  puts "[smaak error]: message not intended for this recipient"
50
52
  return false
51
53
  end
data/lib/smaak/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Smaak
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.17"
3
3
  end
@@ -145,6 +145,15 @@ describe Smaak::Server do
145
145
  expect(@iut.verify_auth_message(auth_message)).to eql(false)
146
146
  end
147
147
 
148
+ it "should return true if the auth_message is not intended for the recipient, but recipient verification is disabled" do
149
+ env = @env
150
+ env["HTTP_X_SMAAK_RECIPIENT"] = Base64.strict_encode64("another-recipient")
151
+ auth_message = mock_auth_message(env)
152
+ @iut.verify_recipient = false
153
+ expect(@iut.verify_auth_message(auth_message)).to eql(true)
154
+ @iut.verify_recipient = true
155
+ end
156
+
148
157
  it "should return false if the auth_message's pre-shared key does not match the association's, indexed by the auth message's identifier field" do
149
158
  env = @env
150
159
  env["HTTP_X_SMAAK_PSK"] = "doesnotmatch"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smaak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst van Graan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: persistent-cache-ram