eventq_base 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eventq_base.rb +1 -0
- data/lib/eventq_base/exceptions.rb +1 -0
- data/lib/eventq_base/exceptions/invalid_signature_exception.rb +9 -0
- data/lib/eventq_base/serialization_providers.rb +3 -3
- data/lib/eventq_base/signature_providers.rb +21 -0
- data/lib/eventq_base/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55bfca8c289dc31fe34c656dd219688618f8bc9b
|
4
|
+
data.tar.gz: 5f5ba0d0cc0ba58d448156b4644f0cfbb31424c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc507cd5ccfaa243784e918fa205b00a1f2f97bc3c6a82d4ee6d4ee16f3bf114f7ed72ede9a01bb314a37011181a0aa7bcfe3b97ef934c97bff06e98bf58f723
|
7
|
+
data.tar.gz: 5a1985feb73bddebe473e31cd31f905364a3378806cc603a29d472eb535133ffd6203bbb54e582e473dec7363713e9bd158d89f44f3ae1e3588b5aaf4241c4dc
|
data/lib/eventq_base.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'exceptions/invalid_signature_exception'
|
@@ -10,8 +10,8 @@ module EventQ
|
|
10
10
|
class Manager
|
11
11
|
def initialize
|
12
12
|
@providers = {}
|
13
|
-
@providers[OJ_PROVIDER] = EventQ::SerializationProviders::OjSerializationProvider
|
14
|
-
@providers[JSON_PROVIDER] = EventQ::SerializationProviders::JsonSerializationProvider
|
13
|
+
@providers[OJ_PROVIDER] = EventQ::SerializationProviders::OjSerializationProvider
|
14
|
+
@providers[JSON_PROVIDER] = EventQ::SerializationProviders::JsonSerializationProvider
|
15
15
|
end
|
16
16
|
|
17
17
|
def get_provider(provider_type)
|
@@ -19,7 +19,7 @@ module EventQ
|
|
19
19
|
if provider == nil
|
20
20
|
raise "Invalid provider type specified: #{provider_type}"
|
21
21
|
end
|
22
|
-
return provider
|
22
|
+
return provider.new
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -11,6 +11,7 @@ module EventQ
|
|
11
11
|
@providers[SHA256] = EventQ::SignatureProviders::Sha256SignatureProvider
|
12
12
|
end
|
13
13
|
|
14
|
+
#This method is called to get a signature provider
|
14
15
|
def get_provider(provider_type)
|
15
16
|
provider = @providers[provider_type]
|
16
17
|
if provider == nil
|
@@ -18,6 +19,26 @@ module EventQ
|
|
18
19
|
end
|
19
20
|
return provider.new
|
20
21
|
end
|
22
|
+
|
23
|
+
#This method is called to validate a queue message's signature
|
24
|
+
def validate_signature(message:, queue:)
|
25
|
+
valid = true
|
26
|
+
|
27
|
+
if queue.require_signature == true && message.signature == nil
|
28
|
+
valid = false
|
29
|
+
elsif message.signature != nil
|
30
|
+
provider = get_provider(EventQ::Configuration.signature_provider)
|
31
|
+
valid = provider.valid?(message: message, secret: EventQ::Configuration.signature_secret)
|
32
|
+
end
|
33
|
+
|
34
|
+
if !valid
|
35
|
+
raise EventQ::Exceptions::InvalidSignatureException.new
|
36
|
+
end
|
37
|
+
|
38
|
+
true
|
39
|
+
|
40
|
+
end
|
41
|
+
|
21
42
|
end
|
22
43
|
end
|
23
44
|
end
|
data/lib/eventq_base/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventq_base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaughanbrittonsage
|
@@ -166,6 +166,8 @@ files:
|
|
166
166
|
- lib/eventq_base/event_raised_queue.rb
|
167
167
|
- lib/eventq_base/eventq_client_contract.rb
|
168
168
|
- lib/eventq_base/eventq_logger.rb
|
169
|
+
- lib/eventq_base/exceptions.rb
|
170
|
+
- lib/eventq_base/exceptions/invalid_signature_exception.rb
|
169
171
|
- lib/eventq_base/exchange.rb
|
170
172
|
- lib/eventq_base/message_args.rb
|
171
173
|
- lib/eventq_base/nonce_manager.rb
|