libsaml 2.6.9 → 2.7.0

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: 2f3cf75b46d2b609833d25d95885729375da73aa
4
- data.tar.gz: 5805bc07e25fb8adf789e01241a6f345d83f6255
3
+ metadata.gz: 15b1bc506c0d773071297dcf07db5790ae88f380
4
+ data.tar.gz: ec73cff60998ef1fbb56ff21997cd28765dfd818
5
5
  SHA512:
6
- metadata.gz: 1d2956bfb640175f6130875d8c7a60066e073187c9d99472d982d26468ff65ad08edba8405393f31aaee6e64dfcdddfd30a65cd4c9d99d79a9343a36c28f5ac0
7
- data.tar.gz: 84006915de32c6dbba5a8e6d184b165f49aa1548c819cbd2d4500d00afd78f7808e7eb5680e7d2ebe36163b83b818d5d87b3f2936ad3cb30667a36aef6920ba5
6
+ metadata.gz: 5774652f6ed9ad934b8bc619ec691cfe1bd90c423723f785ad5e5697a12973ef2ce182a76bd0f8973858efc20a42c4cc1eee77d0ff47a0dca9a40d314057d576
7
+ data.tar.gz: cc807e052949b5d7319e504329644e330fea0d9a32898a9333b8379c597914e521995b4e46d99fa0ffc9e713264be4d6bea9b35ac49cf376d510a5f11692af39
data/lib/saml/provider.rb CHANGED
@@ -35,10 +35,14 @@ module Saml
35
35
  end
36
36
 
37
37
  def certificate(key_name = nil, use = "signing")
38
- key_descriptor = descriptor.find_key_descriptor(key_name, use)
38
+ key_descriptor = find_key_descriptor(key_name, use)
39
39
  key_descriptor.certificate if key_descriptor
40
40
  end
41
41
 
42
+ def find_key_descriptor(key_name = nil, use = "signing")
43
+ descriptor.find_key_descriptor(key_name, use)
44
+ end
45
+
42
46
  def private_key
43
47
  @private_key
44
48
  end
data/lib/saml/util.rb CHANGED
@@ -51,7 +51,18 @@ module Saml
51
51
  end
52
52
  end
53
53
 
54
- def encrypt_assertion(assertion, certificate)
54
+ def encrypt_assertion(assertion, key_descriptor_or_certificate)
55
+ case key_descriptor_or_certificate
56
+ when OpenSSL::X509::Certificate
57
+ certificate = key_descriptor_or_certificate
58
+ key_name = nil
59
+ when Saml::Elements::KeyDescriptor
60
+ certificate = key_descriptor_or_certificate.certificate
61
+ key_name = key_descriptor_or_certificate.key_info.key_name
62
+ else
63
+ raise ArgumentError.new("Expecting Certificate or KeyDescriptor got: #{key_descriptor_or_certificate.class}")
64
+ end
65
+
55
66
  assertion = assertion.to_xml(nil, nil, false) if assertion.is_a?(Assertion) # create xml without instruct
56
67
 
57
68
  encrypted_data = Xmlenc::Builder::EncryptedData.new
@@ -60,6 +71,7 @@ module Saml
60
71
  encrypted_key = encrypted_data.encrypt(assertion.to_s)
61
72
  encrypted_key.set_encryption_method(algorithm: 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p',
62
73
  digest_method_algorithm: 'http://www.w3.org/2000/09/xmldsig#sha1')
74
+ encrypted_key.set_key_name(key_name)
63
75
  encrypted_key.encrypt(certificate.public_key)
64
76
 
65
77
  Saml::Elements::EncryptedAssertion.new(encrypted_data: encrypted_data, encrypted_keys: encrypted_key)
data/lib/saml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Saml
2
- VERSION = "2.6.9"
2
+ VERSION = "2.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libsaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.9
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoist Claassen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-09 00:00:00.000000000 Z
11
+ date: 2015-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.2.0
75
+ version: 0.3.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.2.0
82
+ version: 0.3.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: curb
85
85
  requirement: !ruby/object:Gem::Requirement