saml-kit 0.2.12 → 0.2.13

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: 6a933c25128ff1220caca50012fa928dc9512d9a
4
- data.tar.gz: 9460788814e60d65169adb762ee084aa71743555
3
+ metadata.gz: 70dbb0e0364cd23b3f1afd8b02fb38cbe7b0b6fd
4
+ data.tar.gz: 6f3644f902897ca75eb959b621cd42db9dc9436d
5
5
  SHA512:
6
- metadata.gz: c9eb5d4474d9e4e4dbcb76fa37afc3e819863c00b239df34b0a504b0f008cb5fce0ac0e64211484a00eaf2a868073f9f8be8f61817440ea1ca914c35e241b02f
7
- data.tar.gz: 23a961b54e7ad38e9c4fabd85550f4a0e8e5d64a87e2254e91cd70edee38dba14e0392e8ca9addb156c2ce2f4c6f3ba533f6b6323a6ea203d561c955892e43cb
6
+ metadata.gz: fecaa317d931cf2e07c0b32e34b1787cd85b7b0b8f8b65322abab157f5886b712b0122832e36ce529fc3adfc803c84dd90dc380d02d3d204985eecc71f0d2b79
7
+ data.tar.gz: 07b68fcbcfd29c2777565c63ac66ad3d9a4fa3cac3e4d007986ea6b79fa197f8fc829680345b949aaf9182f05f2019f1c74d4fb540ee3412a757baea6c98f6ef
@@ -70,12 +70,16 @@ module Saml
70
70
  private
71
71
 
72
72
  def assertion
73
- if encrypted?
73
+ @assertion ||= if encrypted?
74
74
  decrypted = XmlDecryption.new(configuration: @configuration).decrypt(@xml_hash['Response']['EncryptedAssertion'])
75
75
  Saml::Kit.logger.debug(decrypted)
76
76
  Hash.from_xml(decrypted)['Assertion']
77
77
  else
78
- @xml_hash.fetch('Response', {}).fetch('Assertion', {})
78
+ result = @xml_hash.fetch('Response', {}).fetch('Assertion', {})
79
+ return result if result.is_a?(Hash)
80
+
81
+ errors[:assertion] << error_message(:must_contain_single_assertion)
82
+ {}
79
83
  end
80
84
  end
81
85
 
@@ -5,6 +5,7 @@ en:
5
5
  Assertion:
6
6
  expired: "must not be expired."
7
7
  must_match_issuer: "must match entityId."
8
+ must_contain_single_assertion: "must contain single Assertion."
8
9
  AuthnRequest:
9
10
  invalid: "must contain AuthnRequest."
10
11
  invalid_fingerprint: "does not match."
@@ -29,6 +29,18 @@ module Saml
29
29
  document.find_all("/md:EntityDescriptor/md:#{name}/md:NameIDFormat").map(&:text)
30
30
  end
31
31
 
32
+ def organization_name
33
+ document.find_by("/md:EntityDescriptor/md:Organization/md:OrganizationName").try(:text)
34
+ end
35
+
36
+ def organization_url
37
+ document.find_by("/md:EntityDescriptor/md:Organization/md:OrganizationURL").try(:text)
38
+ end
39
+
40
+ def contact_person_company
41
+ document.find_by("/md:EntityDescriptor/md:ContactPerson/md:Company").try(:text)
42
+ end
43
+
32
44
  def certificates
33
45
  @certificates ||= document.find_all("/md:EntityDescriptor/md:#{name}/md:KeyDescriptor").map do |item|
34
46
  cert = item.at_xpath("./ds:KeyInfo/ds:X509Data/ds:X509Certificate", Xml::NAMESPACES).text
@@ -1,5 +1,5 @@
1
1
  module Saml
2
2
  module Kit
3
- VERSION = "0.2.12"
3
+ VERSION = "0.2.13"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saml-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan