saml2 2.0.1 → 2.0.2

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
  SHA256:
3
- metadata.gz: 7d3c2cf34b42162517f28e8463bd69c24ae209e2371b2958ecb87f0bd297cd98
4
- data.tar.gz: 6ddc72a8cdb8e3e01261b73f5b6c854fa8aa77473e7bd2149601f19175920131
3
+ metadata.gz: c776c54f1dc7f9b26b39544abd6bdde6c2f68a1f28339627ad9d8745cdfc4ee7
4
+ data.tar.gz: 703170dd49abeb43b09070b6000f748737d1ccbe0374b154c274f84065935daa
5
5
  SHA512:
6
- metadata.gz: e297bdeafbf073a1959c47c95d53a30d9cfe956e65eaca3e13cbb243b95e8d3cb2cd6cfaf8a698a148b7215a097b34593b5e5d2edd82a9610f4c5bb98931f126
7
- data.tar.gz: 97dc5d43ba1b89abcdb9b7cbf6914a82b3281d7606fe1485ea3af2d8993e353f1330b62b8c16feb8c89dc1bbd039b585037f65b4212e610ab83ae2e8524fa3d0
6
+ metadata.gz: 74fe75be6913966fd33a9e72535398a2ecc6916f483aeb47b3202afba09fb175b3c2234c8dfb63a0d48b1aa9f3536204635471e0ab73c125b8276d063838e7cb
7
+ data.tar.gz: dd4f61cc065ebfc647c4306a084b56e5eb5fd57877898f05a67a09c5df87837f34d8c503ca933aa2f50cc770f44e6712bc0ee9192a0f9d07a48d8fb4a974154f
@@ -11,11 +11,16 @@ module SAML2
11
11
 
12
12
  attr_reader :xml
13
13
 
14
+ def initialize
15
+ @pretty = true
16
+ end
17
+
14
18
  def from_xml(node)
15
19
  @xml = node
16
20
  end
17
21
 
18
- def to_s(pretty: true)
22
+ def to_s(pretty: nil)
23
+ pretty = @pretty if pretty.nil?
19
24
  if xml
20
25
  xml.to_s
21
26
  elsif pretty
@@ -72,6 +72,7 @@ module SAML2
72
72
  end
73
73
 
74
74
  def initialize
75
+ super
75
76
  @id = "_#{SecureRandom.uuid}"
76
77
  @issue_instant = Time.now.utc
77
78
  end
@@ -71,6 +71,9 @@ module SAML2
71
71
 
72
72
  def sign(*args)
73
73
  assertions.each { |assertion| assertion.sign(*args) }
74
+ # make sure we no longer pretty print this object
75
+ @pretty = false
76
+ nil
74
77
  end
75
78
 
76
79
  private
@@ -1,3 +1,3 @@
1
1
  module SAML2
2
- VERSION = '2.0.1'
2
+ VERSION = '2.0.2'
3
3
  end
@@ -1,5 +1,7 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
+ require 'openssl'
4
+
3
5
  module SAML2
4
6
  describe Bindings::HTTPRedirect do
5
7
  describe '.decode' do
@@ -42,14 +42,14 @@ module SAML2
42
42
  expect(Schemas.protocol.validate(response.to_xml)).to eq []
43
43
  # verifiable on the command line with:
44
44
  # xmlsec1 --verify --pubkey-cert-pem certificate.pem --privkey-pem privatekey.key --id-attr:ID urn:oasis:names:tc:SAML:2.0:assertion:Assertion response_signed.xml
45
- expect(response.to_s(pretty: false)).to eq fixture('response_signed.xml')
45
+ expect(response.to_s).to eq fixture('response_signed.xml')
46
46
  end
47
47
 
48
48
  it "should generate a valid signature when attributes are present" do
49
49
  freeze_response
50
50
  response.assertions.first.statements << sp.attribute_consuming_services.default.create_statement('givenName' => 'cody')
51
51
  response.sign(fixture('certificate.pem'), fixture('privatekey.key'))
52
- expect(response.to_s(pretty: false)).to eq fixture('response_with_attribute_signed.xml')
52
+ expect(response.to_s).to eq fixture('response_with_attribute_signed.xml')
53
53
  end
54
54
 
55
55
  it "should generate valid XML for IdP initiated response" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saml2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer