soar_smaak 0.1.6 → 0.1.8

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: 59b7e9723eb457bcb28486cd9b08e8c80790f418
4
- data.tar.gz: 193d5336e148566940c489d2b84eb65b917612ab
3
+ metadata.gz: a0d2005902a0f993117f7d732223dffdd78e2606
4
+ data.tar.gz: d2a8b34f9ee6f9fc36354e0e48f7bfa38199ed52
5
5
  SHA512:
6
- metadata.gz: 7b6d24f559008c229f7d7752fb671fc9005ee06d01a231942d743b011219ee0f06d429bcd85ac5cf0a4dc9d2f478ad3c7d618e315a0f74a0d6cfee27c9cc2c7e
7
- data.tar.gz: ba442def8ff76f552dec113add102394ce3eb56947686053f9d60b8e492612644441f06672d66ed198672a102e8e15af5377c69b91a31aa916ba08e4689c0510
6
+ metadata.gz: 774d5d5ec9f6840c3e366eaefa1196314ceb437f6d7350cc9c3380252aab04bb17f9af27b7651b5f9f058f2b722ace045c4bbf91bcfabc41f674b2bb2a6822d2
7
+ data.tar.gz: ea138fc88436347864e7a93d03e556f28569f7ffff972e4fc911427f884fb8a8f98e131cd7644987f0eed0754f9803b1f8f57aa8d80a64d8e0af3f11d53e9a0a
data/README.md CHANGED
@@ -43,7 +43,7 @@ A dictionary of paths and an indication whether the route is signed. If no route
43
43
 
44
44
  ### auditing: optional
45
45
 
46
- An auditing provider that adheres to the API specified here: https://rubygems.org/gems/soar_auditor_api. If an auditing provider is not present, $stderr will be used.
46
+ An auditing provider that adheres to the API specified here: https://rubygems.org/gems/soar_auditor_api. If an auditing provider is not present, STDOUT will be used.
47
47
 
48
48
  ## Installation
49
49
 
@@ -8,6 +8,10 @@ module SoarSmaak
8
8
  @@auditing = auditing
9
9
  end
10
10
 
11
+ def self.auditing
12
+ @@auditing
13
+ end
14
+
11
15
  def self.smaak_configured?(configuration)
12
16
  (not configuration['public_key'].nil?) and
13
17
  (not configuration['private_key'].nil?) and
@@ -18,6 +22,14 @@ module SoarSmaak
18
22
  configuration['smaak'] and (configuration['smaak'].downcase.strip == 'dynamic')
19
23
  end
20
24
 
25
+ def debug(message)
26
+ if SoarSmaak::SecureService::auditing.nil?
27
+ SoarSmaak::SecureService::auditing.debug(message)
28
+ else
29
+ puts message
30
+ end
31
+ end
32
+
21
33
  def configure_services(configuration)
22
34
  if (not SoarSmaak::SecureService::smaak_configured?(configuration) and
23
35
  SoarSmaak::SecureService::smaak_dynamic?(configuration))
@@ -25,19 +37,19 @@ module SoarSmaak
25
37
  elsif (SoarSmaak::SecureService::smaak_configured?(configuration))
26
38
  configure_smaak(configuration)
27
39
  else
28
- @@auditing.debug "SMAAK is neither dynamic nor configured. SMAAK support disabled"
40
+ debug "SMAAK is neither dynamic nor configured. SMAAK support disabled"
29
41
  end
30
42
  end
31
43
 
32
44
  def seed_dynamic_smaak
33
- @@auditing.debug "SMAAK credentials not provided."
45
+ debug "SMAAK credentials not provided."
34
46
  load_smaak_trust_store
35
47
  randomize_smaak
36
48
  end
37
49
 
38
50
  def randomize_smaak
39
51
  @dynamic = @trust_store.associations.keys[rand(@trust_store.associations.keys.size) + 1]
40
- @@auditing.debug "Seeding random key-pair and identifier"
52
+ debug "Seeding random key-pair and identifier"
41
53
  @smaak_server.set_public_key(@trust_store.associations[@dynamic]['public_key'])
42
54
  @smaak_server.set_private_key(@trust_store.associations[@dynamic]['private_key'])
43
55
  @smaak_server.verify_recipient = false
@@ -56,7 +68,7 @@ module SoarSmaak
56
68
  configuration['associations'].each do |identifier, config|
57
69
  @smaak_server.add_association(identifier, config['public_key'], config['psk'], config['encrypt'])
58
70
  end
59
- @@auditing.debug "SMAAK credentials provided. SMAAK configured"
71
+ debug "SMAAK credentials provided. SMAAK configured"
60
72
  end
61
73
  end
62
74
  end
@@ -1,3 +1,3 @@
1
1
  module SoarSmaak
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soar_smaak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst Van Graan