aggcat 0.3.8 → 0.3.9

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: e1855321fa2cb310baad1b82af8704458d932c57
4
- data.tar.gz: 2f98bb4dec46f556f005b2e9c6ca64077133205c
3
+ metadata.gz: 2615e823110f1822fea36515c011d9fb95a370ce
4
+ data.tar.gz: 30bbd9d2cce7b6f38be0f6f3bd93f653b602edaa
5
5
  SHA512:
6
- metadata.gz: ff9c7e1077887acad2efc8a41217b533478cac6ead3fff5cce7f43cfc57dbac7ca8e6ce1efdb6b8511bc581122a38933ecb1a341177bcfdb75357796420282bd
7
- data.tar.gz: 2f96bd72bdc64afb5b991c55307a5e998d784fa2baa53be6b81fc10685735302913ff365a0cd29a0b7508cf9b40bf975f961f98d5cdf16e546f1d8aeab873a72
6
+ metadata.gz: 003ce91e8770c2c1e09994c0801056d9d2026ff6948f1b63b3c3efeac924fa7f3372da3e08b64df853e0cab33fd9f46f6b5f1daaee31333d5974b0326790a04d
7
+ data.tar.gz: e519360ee466f84b7624628d6bfdbbcc5199814278177988d294fa465487e8588bac362c797e820a36b05a44b1567cad4fa8115f2ec0ecbecad3c2713ed9e134
data/README.md CHANGED
@@ -40,6 +40,8 @@ Aggcat.configure do |config|
40
40
  # certificate_value takes precedence over certificate_path
41
41
  # certificate_value should contain newline characters as appropriate
42
42
  # config.certificate_value = "-----BEGIN RSA PRIVATE KEY-----\nasdf123FOO$BAR\n...\n-----END RSA PRIVATE KEY-----"
43
+ # certificate's can contain passwords, put your password here.
44
+ # config.certificate_password = "1234"
43
45
  end
44
46
 
45
47
  # alternatively, specify configuration options when instantiating an Aggcat::Client
@@ -73,7 +73,7 @@ module Aggcat
73
73
  assertion = %[<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" ID="_#{reference_id}" IssueInstant="#{iso8601(now)}" Version="2.0"><saml2:Issuer>#{@issuer_id}</saml2:Issuer><saml2:Subject><saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">#{user_id}</saml2:NameID><saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"></saml2:SubjectConfirmation></saml2:Subject><saml2:Conditions NotBefore="#{iso8601(now-5*60)}" NotOnOrAfter="#{iso8601(now+10*60)}"><saml2:AudienceRestriction><saml2:Audience>#{@issuer_id}</saml2:Audience></saml2:AudienceRestriction></saml2:Conditions><saml2:AuthnStatement AuthnInstant="#{iso8601(now)}" SessionIndex="_#{reference_id}"><saml2:AuthnContext><saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml2:AuthnContextClassRef></saml2:AuthnContext></saml2:AuthnStatement></saml2:Assertion>]
74
74
  digest = Base64.encode64(OpenSSL::Digest::SHA1.digest(assertion)).strip
75
75
  signed_info = %[<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod><ds:Reference URI="#_#{reference_id}"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod><ds:DigestValue>#{digest}</ds:DigestValue></ds:Reference></ds:SignedInfo>]
76
- key = OpenSSL::PKey::RSA.new(certificate)
76
+ key = OpenSSL::PKey::RSA.new(certificate, @certificate_password)
77
77
  signature_value = Base64.encode64(key.sign(OpenSSL::Digest::SHA1.new(nil), signed_info)).gsub(/\n/, '')
78
78
  signature = %[<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><ds:Reference URI="#_#{reference_id}"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>#{digest}</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>#{signature_value}</ds:SignatureValue></ds:Signature>]
79
79
  assertion_with_signature = assertion.sub(/saml2:Issuer\>\<saml2:Subject/, "saml2:Issuer>#{signature}<saml2:Subject")
@@ -1,7 +1,7 @@
1
1
  module Aggcat
2
2
  module Configurable
3
3
 
4
- KEYS = [:issuer_id, :consumer_key, :consumer_secret, :certificate_value, :certificate_path, :customer_id, :open_timeout, :read_timeout, :verbose]
4
+ KEYS = [:issuer_id, :consumer_key, :consumer_secret, :certificate_value, :certificate_password, :certificate_path, :customer_id, :open_timeout, :read_timeout, :verbose]
5
5
 
6
6
  attr_writer *KEYS
7
7
 
@@ -15,6 +15,5 @@ module Aggcat
15
15
  def options
16
16
  Aggcat::Configurable::KEYS.inject({}) { |hash, key| hash[key] = instance_variable_get(:"@#{key}"); hash }
17
17
  end
18
-
19
18
  end
20
19
  end
@@ -1,3 +1,3 @@
1
1
  module Aggcat
2
- VERSION = '0.3.8'
2
+ VERSION = '0.3.9'
3
3
  end
@@ -45,6 +45,22 @@ class AggcatTest < Test::Unit::TestCase
45
45
  assert_equal 30, configurable.instance_variable_get(:'@read_timeout')
46
46
  end
47
47
 
48
+ def test_configure_certificate_with_password
49
+ cert_value = File.read("#{fixture_path}/cert.key")
50
+ configurable = Aggcat.configure do |config|
51
+ config.issuer_id = 'issuer_id'
52
+ config.consumer_key = 'consumer_key'
53
+ config.consumer_secret = 'consumer_secret'
54
+ config.certificate_value = cert_value
55
+ config.certificate_password = 'cert_password'
56
+ end
57
+ assert_equal 'issuer_id', configurable.instance_variable_get(:'@issuer_id')
58
+ assert_equal 'consumer_key', configurable.instance_variable_get(:'@consumer_key')
59
+ assert_equal 'consumer_secret', configurable.instance_variable_get(:'@consumer_secret')
60
+ assert_equal cert_value, configurable.instance_variable_get(:'@certificate_value')
61
+ assert_equal 'cert_password', configurable.instance_variable_get(:'@certificate_password')
62
+ end
63
+
48
64
  def test_scope
49
65
  client1 = Aggcat.scope('1')
50
66
  assert_true client1.is_a?(Aggcat::Client)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aggcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gene Drabkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth