libsaml 2.12.1 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/saml/base.rb +4 -3
- data/lib/saml/elements/signature.rb +2 -3
- data/lib/saml/provider.rb +54 -19
- data/lib/saml/version.rb +1 -1
- data/lib/saml/xml_helpers.rb +19 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5359f70cb191c9ed46d66b875efca2c5a456eef1
|
4
|
+
data.tar.gz: 1c6d0fa41102a3c807c05fdf3d7d21f7b5e6a5ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8379e0e7114a14b779325201a333226b803135d5ff417ad48e601e47d20f087bdce965a26cf29fab9adb48d81be00f6fe5d3bd86aac74e27c202a4c5306d9823
|
7
|
+
data.tar.gz: 6bce47311f98cdc0aba1ceaee744e76005c5465ef013a3e9410f72b170d21049ff52c898e5c32810f05d5de930b3258a366fe22a74d8fd7e9c7fedf73c739580
|
data/lib/saml/base.rb
CHANGED
@@ -8,6 +8,9 @@ module Saml
|
|
8
8
|
include ::HappyMapper
|
9
9
|
include ::ActiveModel::Validations
|
10
10
|
|
11
|
+
attr_accessor :xml_value
|
12
|
+
has_xml_content
|
13
|
+
|
11
14
|
extend HappyMapperClassMethods
|
12
15
|
include HappyMapperInstanceMethods
|
13
16
|
end
|
@@ -19,9 +22,7 @@ module Saml
|
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
22
|
-
|
23
|
-
@from_xml = bool
|
24
|
-
end
|
25
|
+
attr_writer :from_xml
|
25
26
|
|
26
27
|
def from_xml?
|
27
28
|
@from_xml
|
@@ -23,9 +23,8 @@ module Saml
|
|
23
23
|
|
24
24
|
def initialize(*args)
|
25
25
|
super(*args)
|
26
|
-
options
|
27
|
-
@signed_info
|
28
|
-
@key_info ||= KeyInfo.new
|
26
|
+
options = args.extract_options!
|
27
|
+
@signed_info ||= SignedInfo.new(:uri => options.delete(:uri), :digest_value => options.delete(:digest_value))
|
29
28
|
end
|
30
29
|
|
31
30
|
def key_name
|
data/lib/saml/provider.rb
CHANGED
@@ -3,24 +3,25 @@ module Saml
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
def assertion_consumer_service_url(index = nil)
|
6
|
-
find_indexed_service_url(
|
6
|
+
find_indexed_service_url(sp_descriptor.assertion_consumer_services, index)
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
# @param [Symbol] type (see #descriptor)
|
10
|
+
def artifact_resolution_service_url(index = nil, type = :descriptor)
|
11
|
+
find_indexed_service_url(descriptor(type).artifact_resolution_services, index)
|
11
12
|
end
|
12
13
|
|
13
14
|
def attribute_consuming_service(index = nil)
|
14
|
-
find_indexed_service(
|
15
|
+
find_indexed_service(sp_descriptor.attribute_consuming_services, index)
|
15
16
|
end
|
16
17
|
|
17
18
|
def assertion_consumer_service(index = nil)
|
18
|
-
find_indexed_service(
|
19
|
+
find_indexed_service(sp_descriptor.assertion_consumer_services, index)
|
19
20
|
end
|
20
21
|
|
21
22
|
def assertion_consumer_service_indices
|
22
|
-
if
|
23
|
-
|
23
|
+
if sp_descriptor.assertion_consumer_services.present?
|
24
|
+
sp_descriptor.assertion_consumer_services.map(&:index)
|
24
25
|
else
|
25
26
|
[]
|
26
27
|
end
|
@@ -34,13 +35,15 @@ module Saml
|
|
34
35
|
entity_descriptor.entity_id
|
35
36
|
end
|
36
37
|
|
37
|
-
|
38
|
-
|
38
|
+
# @param [Symbol] type (see #descriptor)
|
39
|
+
def certificate(key_name = nil, use = "signing", type = :descriptor)
|
40
|
+
key_descriptor = find_key_descriptor(key_name, use, type)
|
39
41
|
key_descriptor.certificate if key_descriptor
|
40
42
|
end
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
+
# @param [Symbol] type (see #descriptor)
|
45
|
+
def find_key_descriptor(key_name = nil, use = "signing", type = :descriptor)
|
46
|
+
descriptor(type).find_key_descriptor(key_name, use)
|
44
47
|
end
|
45
48
|
|
46
49
|
def private_key
|
@@ -52,19 +55,28 @@ module Saml
|
|
52
55
|
end
|
53
56
|
|
54
57
|
def single_sign_on_service_url(binding)
|
55
|
-
find_binding_service(
|
58
|
+
find_binding_service(idp_descriptor.single_sign_on_services, binding)
|
56
59
|
end
|
57
60
|
|
58
|
-
|
59
|
-
|
61
|
+
# @param [Symbol] type (see #descriptor)
|
62
|
+
def single_logout_service_url(binding, type = :descriptor)
|
63
|
+
find_binding_service(descriptor(type).single_logout_services, binding)
|
60
64
|
end
|
61
65
|
|
62
66
|
def attribute_service_url(binding)
|
63
|
-
find_binding_service(
|
67
|
+
find_binding_service(aa_descriptor.attribute_service, binding)
|
64
68
|
end
|
65
69
|
|
66
70
|
def type
|
67
|
-
|
71
|
+
if idp_descriptor(false)
|
72
|
+
if sp_descriptor(false)
|
73
|
+
"identity_and_service_provider"
|
74
|
+
else
|
75
|
+
"identity_provider"
|
76
|
+
end
|
77
|
+
else
|
78
|
+
"service_provider"
|
79
|
+
end
|
68
80
|
end
|
69
81
|
|
70
82
|
def verify(signature_algorithm, signature, data, key_name = nil)
|
@@ -72,7 +84,7 @@ module Saml
|
|
72
84
|
end
|
73
85
|
|
74
86
|
def authn_requests_signed?
|
75
|
-
|
87
|
+
sp_descriptor.authn_requests_signed
|
76
88
|
end
|
77
89
|
|
78
90
|
private
|
@@ -87,11 +99,34 @@ module Saml
|
|
87
99
|
end
|
88
100
|
end
|
89
101
|
|
90
|
-
# @
|
91
|
-
|
102
|
+
# @param type [Symbol] Descriptor type, available types :sp_descriptor, :idp_descriptor, :aa_descriptor or :descriptor
|
103
|
+
# @return [Saml::ComplexTypes::SSODescriptorType]
|
104
|
+
def descriptor(type = :descriptor)
|
105
|
+
return sp_descriptor if :sp_descriptor == type
|
106
|
+
return idp_descriptor if :idp_descriptor == type
|
107
|
+
return aa_descriptor if :aa_descriptor == type
|
92
108
|
entity_descriptor.sp_sso_descriptor || entity_descriptor.idp_sso_descriptor || entity_descriptor.attribute_authority_descriptor
|
93
109
|
end
|
94
110
|
|
111
|
+
# @return [Saml::Elements::SPSSODescriptor]
|
112
|
+
def sp_descriptor(raise_error = true)
|
113
|
+
entity_descriptor.sp_sso_descriptor || raise_error &&
|
114
|
+
raise(Saml::Errors::InvalidProvider.new("Cannot find service provider with entity_id: #{entity_id}"))
|
115
|
+
end
|
116
|
+
|
117
|
+
# @return [Saml::Elements::IDPSSODescriptor]
|
118
|
+
def idp_descriptor(raise_error = true)
|
119
|
+
entity_descriptor.idp_sso_descriptor || raise_error &&
|
120
|
+
raise(Saml::Errors::InvalidProvider.new("Cannot find identity provider with entity_id: #{entity_id}"))
|
121
|
+
end
|
122
|
+
|
123
|
+
# Attribute authority descriptor
|
124
|
+
# @return [Saml::Elements::AttributeAuthorityDescriptor]
|
125
|
+
def aa_descriptor(raise_error = true)
|
126
|
+
entity_descriptor.attribute_authority_descriptor || raise_error &&
|
127
|
+
raise(Saml::Errors::InvalidProvider.new("Cannot find attribute authority provider with entity_id: #{entity_id}"))
|
128
|
+
end
|
129
|
+
|
95
130
|
def find_indexed_service_url(service_list, index)
|
96
131
|
service = find_indexed_service(service_list, index)
|
97
132
|
service.location if service
|
data/lib/saml/version.rb
CHANGED
data/lib/saml/xml_helpers.rb
CHANGED
@@ -8,20 +8,24 @@ module Saml
|
|
8
8
|
self.signature.key_info = Saml::Elements::KeyInfo.new(x509certificate.to_pem) if x509certificate
|
9
9
|
end
|
10
10
|
|
11
|
-
def to_xml(
|
11
|
+
def to_xml(*args)
|
12
|
+
options = args.extract_options!
|
13
|
+
builder, default_namespace, instruct = args
|
14
|
+
instruct = true if instruct.nil?
|
15
|
+
|
12
16
|
write_xml = builder.nil? ? true : false
|
13
17
|
builder ||= Nokogiri::XML::Builder.new
|
14
18
|
builder.doc.encoding = "UTF-8"
|
15
19
|
result = super(builder, default_namespace)
|
20
|
+
|
16
21
|
if write_xml
|
17
|
-
instruct ? result.to_xml : result.doc.root
|
22
|
+
instruct ? result.to_xml(nokogiri_options(options)) : result.doc.root
|
18
23
|
else
|
19
24
|
result
|
20
25
|
end
|
21
|
-
|
22
26
|
end
|
23
27
|
|
24
|
-
def to_soap
|
28
|
+
def to_soap(options = {})
|
25
29
|
builder = Nokogiri::XML::Builder.new
|
26
30
|
body = self.to_xml(builder)
|
27
31
|
|
@@ -32,7 +36,17 @@ module Saml
|
|
32
36
|
builder.parent.add_child body.doc.root
|
33
37
|
end
|
34
38
|
end
|
35
|
-
builder.to_xml
|
39
|
+
builder.to_xml(nokogiri_options(options))
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def nokogiri_options(options)
|
45
|
+
nokogiri_options = {
|
46
|
+
save_with: Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::FORMAT
|
47
|
+
}
|
48
|
+
nokogiri_options[:save_with] = Nokogiri::XML::Node::SaveOptions::AS_XML if options[:no_space]
|
49
|
+
nokogiri_options
|
36
50
|
end
|
37
51
|
end
|
38
52
|
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.
|
4
|
+
version: 2.13.1
|
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-11-
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.3.
|
61
|
+
version: 0.3.2
|
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
|
-
version: 0.3.
|
68
|
+
version: 0.3.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: xmlenc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|