libsaml 2.1.5 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -0
- data/lib/saml/assertion.rb +5 -4
- data/lib/saml/bindings/http_artifact.rb +4 -0
- data/lib/saml/elements/key_descriptor.rb +1 -1
- data/lib/saml/elements/key_info.rb +28 -0
- data/lib/saml/elements/key_info/x509_data.rb +32 -0
- data/lib/saml/elements/signature.rb +1 -1
- data/lib/saml/version.rb +1 -1
- data/lib/saml/xml_helpers.rb +1 -1
- metadata +38 -25
- data/lib/saml/elements/key_descriptor/key_info.rb +0 -30
- data/lib/saml/elements/key_descriptor/key_info/x509_data.rb +0 -34
- data/lib/saml/elements/signature/key_info.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 777d61727d4b2593863f72a4621312e617a18178
|
4
|
+
data.tar.gz: ca56f6007f85800d1d6808cbbd5cd95024c88635
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89f6aa619c04a9d42e842d43cf56ded84bbe3a53bd6a258b4b93d28a868dfcbbf848d8c37913b2d6b8d999c8e4f08d3826d299b83d5bc6ade8882c3b01007ab9
|
7
|
+
data.tar.gz: 56be7dd01abb97f50a773347c5ba841e6a401c2077e4d7a265bd7d0bf3955e49361819cf483db76bc6b7122b0266ac36985e8e60b3ca602908c4715d3dd9719e
|
data/README.rdoc
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
{<img src="https://travis-ci.org/digidentity/libsaml.png?branch=master" alt="Build Status" />}[https://travis-ci.org/digidentity/libsaml]
|
2
|
+
{<img src="https://coveralls.io/repos/digidentity/libsaml/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/digidentity/libsaml]
|
2
3
|
{<img src="https://gemnasium.com/digidentity/libsaml.png" alt="Dependency Status" />}[https://gemnasium.com/digidentity/libsaml]
|
3
4
|
{<img src="https://codeclimate.com/github/digidentity/libsaml.png" />}[https://codeclimate.com/github/digidentity/libsaml]
|
4
5
|
= libsaml
|
data/lib/saml/assertion.rb
CHANGED
@@ -45,6 +45,11 @@ module Saml
|
|
45
45
|
@version ||= Saml::SAML_VERSION
|
46
46
|
end
|
47
47
|
|
48
|
+
# @return [Saml::Provider]
|
49
|
+
def provider
|
50
|
+
@provider ||= Saml.provider(issuer)
|
51
|
+
end
|
52
|
+
|
48
53
|
def add_attribute(key, value)
|
49
54
|
self.attribute_statement ||= Saml::Elements::AttributeStatement.new
|
50
55
|
self.attribute_statement.attribute ||= []
|
@@ -57,10 +62,6 @@ module Saml
|
|
57
62
|
attribute_statement.fetch_attribute(key)
|
58
63
|
end
|
59
64
|
|
60
|
-
def provider
|
61
|
-
@provider ||= Saml.provider(issuer)
|
62
|
-
end
|
63
|
-
|
64
65
|
private
|
65
66
|
|
66
67
|
def check_issue_instant
|
@@ -8,6 +8,10 @@ module Saml
|
|
8
8
|
Saml::Util.sign_xml(artifact_response, :soap)
|
9
9
|
end
|
10
10
|
|
11
|
+
def create_response(artifact_response)
|
12
|
+
{xml: create_response_xml(artifact_response), content_type: 'text/xml'}
|
13
|
+
end
|
14
|
+
|
11
15
|
def create_url(location, artifact, options = {})
|
12
16
|
uri = URI.parse(location)
|
13
17
|
query = [uri.query, "SAMLart=#{CGI.escape(artifact.to_s)}"]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'saml/elements/key_info/x509_data'
|
2
|
+
|
3
|
+
module Saml
|
4
|
+
module Elements
|
5
|
+
class KeyInfo
|
6
|
+
include Saml::Base
|
7
|
+
|
8
|
+
register_namespace 'ds', Saml::XML_DSIG_NAMESPACE
|
9
|
+
namespace 'ds'
|
10
|
+
tag 'KeyInfo'
|
11
|
+
|
12
|
+
element :key_name, String, :namespace => 'ds', :tag => "KeyName"
|
13
|
+
|
14
|
+
has_one :x509Data, X509Data
|
15
|
+
|
16
|
+
validates :x509Data, :presence => true
|
17
|
+
|
18
|
+
def initialize(cert = nil)
|
19
|
+
if cert
|
20
|
+
self.x509Data = X509Data.new(cert)
|
21
|
+
end
|
22
|
+
if self.x509Data && self.x509Data.x509certificate
|
23
|
+
self.key_name = Digest::SHA1.hexdigest(self.x509Data.x509certificate.to_der)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Saml
|
2
|
+
module Elements
|
3
|
+
class KeyInfo
|
4
|
+
class X509Data
|
5
|
+
include Saml::Base
|
6
|
+
|
7
|
+
tag 'X509Data'
|
8
|
+
namespace 'ds'
|
9
|
+
|
10
|
+
element :x509certificate, String, :tag => "X509Certificate", :on_save => lambda { |c| c.present? ? Base64.encode64(c.to_der) : "" }
|
11
|
+
|
12
|
+
validates :x509certificate, :presence => true
|
13
|
+
|
14
|
+
def initialize(cert = nil)
|
15
|
+
self.x509certificate = cert
|
16
|
+
end
|
17
|
+
|
18
|
+
def x509certificate=(cert)
|
19
|
+
if cert.present?
|
20
|
+
if cert =~ /-----BEGIN CERTIFICATE-----/
|
21
|
+
@x509certificate = OpenSSL::X509::Certificate.new(cert)
|
22
|
+
else
|
23
|
+
@x509certificate = OpenSSL::X509::Certificate.new(Base64.decode64(cert))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
rescue OpenSSL::X509::CertificateError => e
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -6,7 +6,7 @@ require 'saml/elements/signature/reference'
|
|
6
6
|
require 'saml/elements/signature/signature_method'
|
7
7
|
require 'saml/elements/signature/canonicalization_method'
|
8
8
|
require 'saml/elements/signature/signed_info'
|
9
|
-
require 'saml/elements/
|
9
|
+
require 'saml/elements/key_info'
|
10
10
|
|
11
11
|
module Saml
|
12
12
|
module Elements
|
data/lib/saml/version.rb
CHANGED
data/lib/saml/xml_helpers.rb
CHANGED
@@ -5,7 +5,7 @@ module Saml
|
|
5
5
|
def add_signature
|
6
6
|
self.signature = Saml::Elements::Signature.new(uri: "##{self._id}")
|
7
7
|
x509certificate = OpenSSL::X509::Certificate.new(provider.certificate) rescue nil
|
8
|
-
self.signature.key_info = Saml::Elements::
|
8
|
+
self.signature.key_info = Saml::Elements::KeyInfo.new(x509certificate.to_pem) if x509certificate
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_xml(builder = nil, default_namespace = nil, instruct = true)
|
metadata
CHANGED
@@ -1,99 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libsaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoist Claassen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 3.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nokogiri-happymapper
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.5.7
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.5.7
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: xmldsig
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.2.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.2.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: xmlenc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.1.1
|
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
82
|
version: 0.1.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: curb
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.7'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.7'
|
97
111
|
description: Libsaml makes the creation of SAML 2.0 messages easy. The object structure
|
98
112
|
is modeled after the SAML Core 2.0 specification from OASIS. Supported bindings
|
99
113
|
are HTTP-Post, HTTP-Redirect, HTTP-Artifact and SOAP. Features include XML signing,
|
@@ -104,6 +118,10 @@ executables: []
|
|
104
118
|
extensions: []
|
105
119
|
extra_rdoc_files: []
|
106
120
|
files:
|
121
|
+
- MIT-LICENSE
|
122
|
+
- README.rdoc
|
123
|
+
- Rakefile
|
124
|
+
- lib/saml.rb
|
107
125
|
- lib/saml/artifact.rb
|
108
126
|
- lib/saml/artifact_resolve.rb
|
109
127
|
- lib/saml/artifact_response.rb
|
@@ -139,9 +157,9 @@ files:
|
|
139
157
|
- lib/saml/elements/entity_attributes.rb
|
140
158
|
- lib/saml/elements/entity_descriptor.rb
|
141
159
|
- lib/saml/elements/idp_sso_descriptor.rb
|
142
|
-
- lib/saml/elements/key_descriptor/key_info/x509_data.rb
|
143
|
-
- lib/saml/elements/key_descriptor/key_info.rb
|
144
160
|
- lib/saml/elements/key_descriptor.rb
|
161
|
+
- lib/saml/elements/key_info.rb
|
162
|
+
- lib/saml/elements/key_info/x509_data.rb
|
145
163
|
- lib/saml/elements/md_extensions.rb
|
146
164
|
- lib/saml/elements/name_id.rb
|
147
165
|
- lib/saml/elements/organization.rb
|
@@ -153,16 +171,15 @@ files:
|
|
153
171
|
- lib/saml/elements/samlp_extensions.rb
|
154
172
|
- lib/saml/elements/service_description.rb
|
155
173
|
- lib/saml/elements/service_name.rb
|
174
|
+
- lib/saml/elements/signature.rb
|
156
175
|
- lib/saml/elements/signature/canonicalization_method.rb
|
157
176
|
- lib/saml/elements/signature/digest_method.rb
|
158
177
|
- lib/saml/elements/signature/inclusive_namespaces.rb
|
159
|
-
- lib/saml/elements/signature/key_info.rb
|
160
178
|
- lib/saml/elements/signature/reference.rb
|
161
179
|
- lib/saml/elements/signature/signature_method.rb
|
162
180
|
- lib/saml/elements/signature/signed_info.rb
|
163
181
|
- lib/saml/elements/signature/transform.rb
|
164
182
|
- lib/saml/elements/signature/transforms.rb
|
165
|
-
- lib/saml/elements/signature.rb
|
166
183
|
- lib/saml/elements/sp_sso_descriptor.rb
|
167
184
|
- lib/saml/elements/status.rb
|
168
185
|
- lib/saml/elements/status_code.rb
|
@@ -182,11 +199,7 @@ files:
|
|
182
199
|
- lib/saml/util.rb
|
183
200
|
- lib/saml/version.rb
|
184
201
|
- lib/saml/xml_helpers.rb
|
185
|
-
- lib/saml.rb
|
186
202
|
- lib/tasks/saml_tasks.rake
|
187
|
-
- MIT-LICENSE
|
188
|
-
- Rakefile
|
189
|
-
- README.rdoc
|
190
203
|
homepage: https://www.digidentity.eu
|
191
204
|
licenses:
|
192
205
|
- MIT
|
@@ -197,17 +210,17 @@ require_paths:
|
|
197
210
|
- lib
|
198
211
|
required_ruby_version: !ruby/object:Gem::Requirement
|
199
212
|
requirements:
|
200
|
-
- -
|
213
|
+
- - ">="
|
201
214
|
- !ruby/object:Gem::Version
|
202
215
|
version: '0'
|
203
216
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
217
|
requirements:
|
205
|
-
- -
|
218
|
+
- - ">="
|
206
219
|
- !ruby/object:Gem::Version
|
207
220
|
version: '0'
|
208
221
|
requirements: []
|
209
222
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.
|
223
|
+
rubygems_version: 2.2.1
|
211
224
|
signing_key:
|
212
225
|
specification_version: 4
|
213
226
|
summary: A gem to easily create SAML 2.0 messages.
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'saml/elements/key_descriptor/key_info/x509_data'
|
2
|
-
|
3
|
-
module Saml
|
4
|
-
module Elements
|
5
|
-
class KeyDescriptor
|
6
|
-
class KeyInfo
|
7
|
-
include Saml::Base
|
8
|
-
|
9
|
-
register_namespace 'ds', Saml::XML_DSIG_NAMESPACE
|
10
|
-
namespace 'ds'
|
11
|
-
tag 'KeyInfo'
|
12
|
-
|
13
|
-
element :key_name, String, :namespace => 'ds', :tag => "KeyName"
|
14
|
-
|
15
|
-
has_one :x509Data, X509Data
|
16
|
-
|
17
|
-
validates :x509Data, :presence => true
|
18
|
-
|
19
|
-
def initialize(cert = nil)
|
20
|
-
if cert
|
21
|
-
self.x509Data = X509Data.new(cert)
|
22
|
-
end
|
23
|
-
if self.x509Data && self.x509Data.x509certificate
|
24
|
-
self.key_name = Digest::SHA1.hexdigest(self.x509Data.x509certificate.to_der)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module Saml
|
2
|
-
module Elements
|
3
|
-
class KeyDescriptor
|
4
|
-
class KeyInfo
|
5
|
-
class X509Data
|
6
|
-
include Saml::Base
|
7
|
-
|
8
|
-
tag 'X509Data'
|
9
|
-
namespace 'ds'
|
10
|
-
|
11
|
-
element :x509certificate, String, :tag => "X509Certificate", :on_save => lambda { |c| c.present? ? Base64.encode64(c.to_der) : "" }
|
12
|
-
|
13
|
-
validates :x509certificate, :presence => true
|
14
|
-
|
15
|
-
def initialize(cert = nil)
|
16
|
-
self.x509certificate = cert
|
17
|
-
end
|
18
|
-
|
19
|
-
def x509certificate=(cert)
|
20
|
-
if cert.present?
|
21
|
-
if cert =~ /-----BEGIN CERTIFICATE-----/
|
22
|
-
@x509certificate = OpenSSL::X509::Certificate.new(cert)
|
23
|
-
else
|
24
|
-
@x509certificate = OpenSSL::X509::Certificate.new(Base64.decode64(cert))
|
25
|
-
end
|
26
|
-
end
|
27
|
-
rescue OpenSSL::X509::CertificateError => e
|
28
|
-
nil
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|