ruby-saml 0.8.16 → 0.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ruby-saml might be problematic. Click here for more details.

Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.travis.yml +1 -6
  4. data/Gemfile +2 -12
  5. data/README.md +363 -35
  6. data/Rakefile +14 -0
  7. data/changelog.md +22 -9
  8. data/lib/onelogin/ruby-saml/attribute_service.rb +34 -0
  9. data/lib/onelogin/ruby-saml/attributes.rb +26 -64
  10. data/lib/onelogin/ruby-saml/authrequest.rb +47 -89
  11. data/lib/onelogin/ruby-saml/idp_metadata_parser.rb +87 -0
  12. data/lib/onelogin/ruby-saml/logoutrequest.rb +34 -93
  13. data/lib/onelogin/ruby-saml/logoutresponse.rb +25 -24
  14. data/lib/onelogin/ruby-saml/metadata.rb +46 -16
  15. data/lib/onelogin/ruby-saml/response.rb +62 -322
  16. data/lib/onelogin/ruby-saml/saml_message.rb +78 -0
  17. data/lib/onelogin/ruby-saml/settings.rb +54 -121
  18. data/lib/onelogin/ruby-saml/slo_logoutrequest.rb +26 -61
  19. data/lib/onelogin/ruby-saml/slo_logoutresponse.rb +27 -84
  20. data/lib/onelogin/ruby-saml/utils.rb +32 -199
  21. data/lib/onelogin/ruby-saml/version.rb +1 -1
  22. data/lib/ruby-saml.rb +5 -2
  23. data/lib/schemas/{saml20assertion_schema.xsd → saml-schema-assertion-2.0.xsd} +283 -283
  24. data/lib/schemas/saml-schema-authn-context-2.0.xsd +23 -0
  25. data/lib/schemas/saml-schema-authn-context-types-2.0.xsd +821 -0
  26. data/lib/schemas/saml-schema-metadata-2.0.xsd +339 -0
  27. data/lib/schemas/{saml20protocol_schema.xsd → saml-schema-protocol-2.0.xsd} +302 -302
  28. data/lib/schemas/sstc-metadata-attr.xsd +35 -0
  29. data/lib/schemas/sstc-saml-attribute-ext.xsd +25 -0
  30. data/lib/schemas/sstc-saml-metadata-algsupport-v1.0.xsd +41 -0
  31. data/lib/schemas/sstc-saml-metadata-ui-v1.0.xsd +89 -0
  32. data/lib/schemas/{xenc_schema.xsd → xenc-schema.xsd} +1 -11
  33. data/lib/schemas/xml.xsd +287 -0
  34. data/lib/schemas/{xmldsig_schema.xsd → xmldsig-core-schema.xsd} +0 -9
  35. data/lib/xml_security.rb +83 -235
  36. data/ruby-saml.gemspec +1 -0
  37. data/test/idp_metadata_parser_test.rb +54 -0
  38. data/test/logoutrequest_test.rb +68 -144
  39. data/test/logoutresponse_test.rb +43 -25
  40. data/test/metadata_test.rb +87 -0
  41. data/test/request_test.rb +103 -90
  42. data/test/response_test.rb +181 -471
  43. data/test/responses/idp_descriptor.xml +3 -0
  44. data/test/responses/logoutresponse_fixtures.rb +5 -5
  45. data/test/responses/response_no_cert_and_encrypted_attrs.xml +29 -0
  46. data/test/responses/response_with_multiple_attribute_values.xml +1 -1
  47. data/test/responses/slo_request.xml +4 -0
  48. data/test/settings_test.rb +25 -112
  49. data/test/slo_logoutrequest_test.rb +41 -44
  50. data/test/slo_logoutresponse_test.rb +87 -167
  51. data/test/test_helper.rb +27 -102
  52. data/test/xml_security_test.rb +114 -337
  53. metadata +34 -84
  54. data/lib/onelogin/ruby-saml/setting_error.rb +0 -6
  55. data/test/certificates/certificate.der +0 -0
  56. data/test/certificates/formatted_certificate +0 -14
  57. data/test/certificates/formatted_chained_certificate +0 -42
  58. data/test/certificates/formatted_private_key +0 -12
  59. data/test/certificates/formatted_rsa_private_key +0 -12
  60. data/test/certificates/invalid_certificate1 +0 -1
  61. data/test/certificates/invalid_certificate2 +0 -1
  62. data/test/certificates/invalid_certificate3 +0 -12
  63. data/test/certificates/invalid_chained_certificate1 +0 -1
  64. data/test/certificates/invalid_private_key1 +0 -1
  65. data/test/certificates/invalid_private_key2 +0 -1
  66. data/test/certificates/invalid_private_key3 +0 -10
  67. data/test/certificates/invalid_rsa_private_key1 +0 -1
  68. data/test/certificates/invalid_rsa_private_key2 +0 -1
  69. data/test/certificates/invalid_rsa_private_key3 +0 -10
  70. data/test/certificates/ruby-saml-2.crt +0 -15
  71. data/test/requests/logoutrequest_fixtures.rb +0 -47
  72. data/test/responses/encrypted_new_attack.xml.base64 +0 -1
  73. data/test/responses/invalids/invalid_issuer_assertion.xml.base64 +0 -1
  74. data/test/responses/invalids/invalid_issuer_message.xml.base64 +0 -1
  75. data/test/responses/invalids/multiple_signed.xml.base64 +0 -1
  76. data/test/responses/invalids/no_signature.xml.base64 +0 -1
  77. data/test/responses/invalids/response_with_concealed_signed_assertion.xml +0 -51
  78. data/test/responses/invalids/response_with_doubled_signed_assertion.xml +0 -49
  79. data/test/responses/invalids/signature_wrapping_attack.xml.base64 +0 -1
  80. data/test/responses/response_node_text_attack.xml.base64 +0 -1
  81. data/test/responses/response_with_concealed_signed_assertion.xml +0 -51
  82. data/test/responses/response_with_doubled_signed_assertion.xml +0 -49
  83. data/test/responses/response_with_multiple_attribute_statements.xml +0 -72
  84. data/test/responses/response_with_signed_assertion_3.xml +0 -30
  85. data/test/responses/response_with_signed_message_and_assertion.xml +0 -34
  86. data/test/responses/response_with_undefined_recipient.xml.base64 +0 -1
  87. data/test/responses/response_wrapped.xml.base64 +0 -150
  88. data/test/responses/valid_response.xml.base64 +0 -1
  89. data/test/responses/valid_response_without_x509certificate.xml.base64 +0 -1
  90. data/test/utils_test.rb +0 -231
@@ -1,211 +1,44 @@
1
- if RUBY_VERSION < '1.9'
2
- require 'uuid'
3
- else
4
- require 'securerandom'
5
- end
6
-
7
- require "base64"
8
- require "zlib"
9
-
10
1
  module OneLogin
11
2
  module RubySaml
12
-
13
- # SAML2 Auxiliary class
14
- #
15
3
  class Utils
16
- @@uuid_generator = UUID.new if RUBY_VERSION < '1.9'
17
-
18
- BASE64_FORMAT = %r(\A([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\Z)
19
-
20
- # Given a REXML::Element instance, return the concatenation of all child text nodes. Assumes
21
- # that there all children other than text nodes can be ignored (e.g. comments). If nil is
22
- # passed, nil will be returned.
23
- def self.element_text(element)
24
- element.texts.map(&:value).join if element
25
- end
26
-
27
- # Return a properly formatted x509 certificate
28
- #
29
- # @param cert [String] The original certificate
30
- # @return [String] The formatted certificate
31
- #
32
- def self.format_cert(cert)
33
- # don't try to format an encoded certificate or if is empty or nil
34
- if cert.respond_to?(:ascii_only?)
35
- return cert if cert.nil? || cert.empty? || !cert.ascii_only?
36
- else
37
- return cert if cert.nil? || cert.empty? || cert.match(/\x0d/)
38
- end
39
-
40
- if cert.scan(/BEGIN CERTIFICATE/).length > 1
41
- formatted_cert = []
42
- cert.scan(/-{5}BEGIN CERTIFICATE-{5}[\n\r]?.*?-{5}END CERTIFICATE-{5}[\n\r]?/m) {|c|
43
- formatted_cert << format_cert(c)
44
- }
45
- formatted_cert.join("\n")
46
- else
47
- cert = cert.gsub(/\-{5}\s?(BEGIN|END) CERTIFICATE\s?\-{5}/, "")
48
- cert = cert.gsub(/\r/, "")
49
- cert = cert.gsub(/\n/, "")
50
- cert = cert.gsub(/\s/, "")
51
- cert = cert.scan(/.{1,64}/)
52
- cert = cert.join("\n")
53
- "-----BEGIN CERTIFICATE-----\n#{cert}\n-----END CERTIFICATE-----"
4
+ def self.format_cert(cert, heads=true)
5
+ cert = cert.delete("\n").delete("\r").delete("\x0D")
6
+ if cert
7
+ cert = cert.gsub('-----BEGIN CERTIFICATE-----', '')
8
+ cert = cert.gsub('-----END CERTIFICATE-----', '')
9
+ cert = cert.gsub(' ', '')
10
+
11
+ if heads
12
+ cert = cert.scan(/.{1,64}/).join("\n")+"\n"
13
+ cert = "-----BEGIN CERTIFICATE-----\n" + cert + "-----END CERTIFICATE-----\n"
14
+ end
54
15
  end
55
- end
56
-
57
- # Return a properly formatted private key
58
- #
59
- # @param key [String] The original private key
60
- # @return [String] The formatted private key
61
- #
62
- def self.format_private_key(key)
63
- # don't try to format an encoded private key or if is empty
64
- return key if key.nil? || key.empty? || key.match(/\x0d/)
65
-
66
- # is this an rsa key?
67
- rsa_key = key.match("RSA PRIVATE KEY")
68
- key = key.gsub(/\-{5}\s?(BEGIN|END)( RSA)? PRIVATE KEY\s?\-{5}/, "")
69
- key = key.gsub(/\n/, "")
70
- key = key.gsub(/\r/, "")
71
- key = key.gsub(/\s/, "")
72
- key = key.scan(/.{1,64}/)
73
- key = key.join("\n")
74
- key_label = rsa_key ? "RSA PRIVATE KEY" : "PRIVATE KEY"
75
- "-----BEGIN #{key_label}-----\n#{key}\n-----END #{key_label}-----"
76
- end
77
-
78
- # Build the Query String signature that will be used in the HTTP-Redirect binding
79
- # to generate the Signature
80
- # @param params [Hash] Parameters to build the Query String
81
- # @option params [String] :type 'SAMLRequest' or 'SAMLResponse'
82
- # @option params [String] :data Base64 encoded SAMLRequest or SAMLResponse
83
- # @option params [String] :relay_state The RelayState parameter
84
- # @option params [String] :sig_alg The SigAlg parameter
85
- # @return [String] The Query String
86
- #
87
- def self.build_query(params)
88
- type, data, relay_state, sig_alg = [:type, :data, :relay_state, :sig_alg].map { |k| params[k]}
89
- url_string = "#{type}=#{CGI.escape(data)}"
90
- url_string << "&RelayState=#{CGI.escape(relay_state)}" if relay_state
91
- url_string << "&SigAlg=#{CGI.escape(sig_alg)}"
92
- end
93
-
94
- def self.uuid
95
- RUBY_VERSION < '1.9' ? "_#{@@uuid_generator.generate}" : "_#{SecureRandom.uuid}"
96
- end
97
-
98
- # Build the status error message
99
- # @param status_code [String] StatusCode value
100
- # @param status_message [Strig] StatusMessage value
101
- # @return [String] The status error message
102
- def self.status_error_msg(error_msg, raw_status_code = nil, status_message = nil)
103
- unless raw_status_code.nil?
104
- if raw_status_code.include? "|"
105
- status_codes = raw_status_code.split(' | ')
106
- values = status_codes.collect do |status_code|
107
- status_code.split(':').last
16
+ cert
17
+ end
18
+
19
+ def self.format_private_key(key, heads=true)
20
+ key = key.delete("\n").delete("\r").delete("\x0D")
21
+ if key
22
+ if key.index('-----BEGIN PRIVATE KEY-----') != nil
23
+ key = key.gsub('-----BEGIN PRIVATE KEY-----', '')
24
+ key = key.gsub('-----END PRIVATE KEY-----', '')
25
+ key = key.gsub(' ', '')
26
+ if heads
27
+ key = key.scan(/.{1,64}/).join("\n")+"\n"
28
+ key = "-----BEGIN PRIVATE KEY-----\n" + key + "-----END PRIVATE KEY-----\n"
108
29
  end
109
- printable_code = values.join(" => ")
110
30
  else
111
- printable_code = raw_status_code.split(':').last
31
+ key = key.gsub('-----BEGIN RSA PRIVATE KEY-----', '')
32
+ key = key.gsub('-----END RSA PRIVATE KEY-----', '')
33
+ key = key.gsub(' ', '')
34
+ if heads
35
+ key = key.scan(/.{1,64}/).join("\n")+"\n"
36
+ key = "-----BEGIN RSA PRIVATE KEY-----\n" + key + "-----END RSA PRIVATE KEY-----\n"
37
+ end
112
38
  end
113
- error_msg << ', was ' + printable_code
114
- end
115
-
116
- unless status_message.nil?
117
- error_msg << ' -> ' + status_message
118
39
  end
119
-
120
- error_msg
121
- end
122
-
123
- # Base64 decode and try also to inflate a SAML Message
124
- # @param saml [String] The deflated and encoded SAML Message
125
- # @return [String] The plain SAML Message
126
- #
127
- def self.decode_raw_saml(saml)
128
- return saml unless base64_encoded?(saml)
129
-
130
- decoded = decode(saml)
131
- begin
132
- inflate(decoded)
133
- rescue
134
- decoded
135
- end
136
- end
137
-
138
- # Base 64 decode method
139
- # @param string [String] The string message
140
- # @return [String] The decoded string
141
- #
142
- def self.decode(string)
143
- Base64.decode64(string)
144
- end
145
-
146
- # Base 64 encode method
147
- # @param string [String] The string
148
- # @return [String] The encoded string
149
- #
150
- def self.encode(string)
151
- if Base64.respond_to?('strict_encode64')
152
- Base64.strict_encode64(string)
153
- else
154
- Base64.encode64(string).gsub(/\n/, "")
155
- end
156
- end
157
-
158
- # Check if a string is base64 encoded
159
- # @param string [String] string to check the encoding of
160
- # @return [true, false] whether or not the string is base64 encoded
161
- #
162
- def self.base64_encoded?(string)
163
- !!string.gsub(/[\r\n]|\\r|\\n|\s/, "").match(BASE64_FORMAT)
164
- end
165
-
166
- # Inflate method
167
- # @param deflated [String] The string
168
- # @return [String] The inflated string
169
- #
170
- def self.inflate(deflated)
171
- Zlib::Inflate.new(-Zlib::MAX_WBITS).inflate(deflated)
172
- end
173
-
174
- # Deflate method
175
- # @param inflated [String] The string
176
- # @return [String] The deflated string
177
- #
178
- def self.deflate(inflated)
179
- Zlib::Deflate.deflate(inflated, 9)[2..-5]
180
- end
181
-
182
- # Given two strings, attempt to match them as URIs using Rails' parse method. If they can be parsed,
183
- # then the fully-qualified domain name and the host should performa a case-insensitive match, per the
184
- # RFC for URIs. If Rails can not parse the string in to URL pieces, return a boolean match of the
185
- # two strings. This maintains the previous functionality.
186
- # @return [Boolean]
187
- def self.uri_match?(destination_url, settings_url)
188
- dest_uri = URI.parse(destination_url)
189
- acs_uri = URI.parse(settings_url)
190
-
191
- if dest_uri.scheme.nil? || acs_uri.scheme.nil? || dest_uri.host.nil? || acs_uri.host.nil?
192
- raise URI::InvalidURIError
193
- else
194
- dest_uri.scheme.downcase == acs_uri.scheme.downcase &&
195
- dest_uri.host.downcase == acs_uri.host.downcase &&
196
- dest_uri.path == acs_uri.path &&
197
- dest_uri.query == acs_uri.query
198
- end
199
- rescue URI::InvalidURIError
200
- original_uri_match?(destination_url, settings_url)
201
- end
202
-
203
- # If Rails' URI.parse can't match to valid URL, default back to the original matching service.
204
- # @return [Boolean]
205
- def self.original_uri_match?(destination_url, settings_url)
206
- destination_url == settings_url
207
40
  end
208
41
 
209
42
  end
210
43
  end
211
- end
44
+ end
@@ -1,5 +1,5 @@
1
1
  module OneLogin
2
2
  module RubySaml
3
- VERSION = '0.8.16'
3
+ VERSION = '0.9'
4
4
  end
5
5
  end
@@ -1,13 +1,16 @@
1
1
  require 'onelogin/ruby-saml/logging'
2
+ require 'onelogin/ruby-saml/saml_message'
2
3
  require 'onelogin/ruby-saml/authrequest'
3
4
  require 'onelogin/ruby-saml/logoutrequest'
4
5
  require 'onelogin/ruby-saml/logoutresponse'
6
+ require 'onelogin/ruby-saml/attributes'
5
7
  require 'onelogin/ruby-saml/slo_logoutrequest'
6
8
  require 'onelogin/ruby-saml/slo_logoutresponse'
7
9
  require 'onelogin/ruby-saml/response'
8
10
  require 'onelogin/ruby-saml/settings'
9
- require 'onelogin/ruby-saml/utils'
11
+ require 'onelogin/ruby-saml/attribute_service'
10
12
  require 'onelogin/ruby-saml/validation_error'
11
13
  require 'onelogin/ruby-saml/metadata'
14
+ require 'onelogin/ruby-saml/idp_metadata_parser'
15
+ require 'onelogin/ruby-saml/utils'
12
16
  require 'onelogin/ruby-saml/version'
13
- require 'onelogin/ruby-saml/attributes'
@@ -1,283 +1,283 @@
1
- <?xml version="1.0" encoding="US-ASCII"?>
2
- <schema
3
- targetNamespace="urn:oasis:names:tc:SAML:2.0:assertion"
4
- xmlns="http://www.w3.org/2001/XMLSchema"
5
- xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
6
- xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
7
- xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
8
- elementFormDefault="unqualified"
9
- attributeFormDefault="unqualified"
10
- blockDefault="substitution"
11
- version="2.0">
12
- <import namespace="http://www.w3.org/2000/09/xmldsig#"
13
- schemaLocation="xmldsig_schema.xsd"/>
14
- <import namespace="http://www.w3.org/2001/04/xmlenc#"
15
- schemaLocation="xenc_schema.xsd"/>
16
- <annotation>
17
- <documentation>
18
- Document identifier: saml-schema-assertion-2.0
19
- Location: http://docs.oasis-open.org/security/saml/v2.0/
20
- Revision history:
21
- V1.0 (November, 2002):
22
- Initial Standard Schema.
23
- V1.1 (September, 2003):
24
- Updates within the same V1.0 namespace.
25
- V2.0 (March, 2005):
26
- New assertion schema for SAML V2.0 namespace.
27
- </documentation>
28
- </annotation>
29
- <attributeGroup name="IDNameQualifiers">
30
- <attribute name="NameQualifier" type="string" use="optional"/>
31
- <attribute name="SPNameQualifier" type="string" use="optional"/>
32
- </attributeGroup>
33
- <element name="BaseID" type="saml:BaseIDAbstractType"/>
34
- <complexType name="BaseIDAbstractType" abstract="true">
35
- <attributeGroup ref="saml:IDNameQualifiers"/>
36
- </complexType>
37
- <element name="NameID" type="saml:NameIDType"/>
38
- <complexType name="NameIDType">
39
- <simpleContent>
40
- <extension base="string">
41
- <attributeGroup ref="saml:IDNameQualifiers"/>
42
- <attribute name="Format" type="anyURI" use="optional"/>
43
- <attribute name="SPProvidedID" type="string" use="optional"/>
44
- </extension>
45
- </simpleContent>
46
- </complexType>
47
- <complexType name="EncryptedElementType">
48
- <sequence>
49
- <element ref="xenc:EncryptedData"/>
50
- <element ref="xenc:EncryptedKey" minOccurs="0" maxOccurs="unbounded"/>
51
- </sequence>
52
- </complexType>
53
- <element name="EncryptedID" type="saml:EncryptedElementType"/>
54
- <element name="Issuer" type="saml:NameIDType"/>
55
- <element name="AssertionIDRef" type="NCName"/>
56
- <element name="AssertionURIRef" type="anyURI"/>
57
- <element name="Assertion" type="saml:AssertionType"/>
58
- <complexType name="AssertionType">
59
- <sequence>
60
- <element ref="saml:Issuer"/>
61
- <element ref="ds:Signature" minOccurs="0"/>
62
- <element ref="saml:Subject" minOccurs="0"/>
63
- <element ref="saml:Conditions" minOccurs="0"/>
64
- <element ref="saml:Advice" minOccurs="0"/>
65
- <choice minOccurs="0" maxOccurs="unbounded">
66
- <element ref="saml:Statement"/>
67
- <element ref="saml:AuthnStatement"/>
68
- <element ref="saml:AuthzDecisionStatement"/>
69
- <element ref="saml:AttributeStatement"/>
70
- </choice>
71
- </sequence>
72
- <attribute name="Version" type="string" use="required"/>
73
- <attribute name="ID" type="ID" use="required"/>
74
- <attribute name="IssueInstant" type="dateTime" use="required"/>
75
- </complexType>
76
- <element name="Subject" type="saml:SubjectType"/>
77
- <complexType name="SubjectType">
78
- <choice>
79
- <sequence>
80
- <choice>
81
- <element ref="saml:BaseID"/>
82
- <element ref="saml:NameID"/>
83
- <element ref="saml:EncryptedID"/>
84
- </choice>
85
- <element ref="saml:SubjectConfirmation" minOccurs="0" maxOccurs="unbounded"/>
86
- </sequence>
87
- <element ref="saml:SubjectConfirmation" maxOccurs="unbounded"/>
88
- </choice>
89
- </complexType>
90
- <element name="SubjectConfirmation" type="saml:SubjectConfirmationType"/>
91
- <complexType name="SubjectConfirmationType">
92
- <sequence>
93
- <choice minOccurs="0">
94
- <element ref="saml:BaseID"/>
95
- <element ref="saml:NameID"/>
96
- <element ref="saml:EncryptedID"/>
97
- </choice>
98
- <element ref="saml:SubjectConfirmationData" minOccurs="0"/>
99
- </sequence>
100
- <attribute name="Method" type="anyURI" use="required"/>
101
- </complexType>
102
- <element name="SubjectConfirmationData" type="saml:SubjectConfirmationDataType"/>
103
- <complexType name="SubjectConfirmationDataType" mixed="true">
104
- <complexContent>
105
- <restriction base="anyType">
106
- <sequence>
107
- <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
108
- </sequence>
109
- <attribute name="NotBefore" type="dateTime" use="optional"/>
110
- <attribute name="NotOnOrAfter" type="dateTime" use="optional"/>
111
- <attribute name="Recipient" type="anyURI" use="optional"/>
112
- <attribute name="InResponseTo" type="NCName" use="optional"/>
113
- <attribute name="Address" type="string" use="optional"/>
114
- <anyAttribute namespace="##other" processContents="lax"/>
115
- </restriction>
116
- </complexContent>
117
- </complexType>
118
- <complexType name="KeyInfoConfirmationDataType" mixed="false">
119
- <complexContent>
120
- <restriction base="saml:SubjectConfirmationDataType">
121
- <sequence>
122
- <element ref="ds:KeyInfo" maxOccurs="unbounded"/>
123
- </sequence>
124
- </restriction>
125
- </complexContent>
126
- </complexType>
127
- <element name="Conditions" type="saml:ConditionsType"/>
128
- <complexType name="ConditionsType">
129
- <choice minOccurs="0" maxOccurs="unbounded">
130
- <element ref="saml:Condition"/>
131
- <element ref="saml:AudienceRestriction"/>
132
- <element ref="saml:OneTimeUse"/>
133
- <element ref="saml:ProxyRestriction"/>
134
- </choice>
135
- <attribute name="NotBefore" type="dateTime" use="optional"/>
136
- <attribute name="NotOnOrAfter" type="dateTime" use="optional"/>
137
- </complexType>
138
- <element name="Condition" type="saml:ConditionAbstractType"/>
139
- <complexType name="ConditionAbstractType" abstract="true"/>
140
- <element name="AudienceRestriction" type="saml:AudienceRestrictionType"/>
141
- <complexType name="AudienceRestrictionType">
142
- <complexContent>
143
- <extension base="saml:ConditionAbstractType">
144
- <sequence>
145
- <element ref="saml:Audience" maxOccurs="unbounded"/>
146
- </sequence>
147
- </extension>
148
- </complexContent>
149
- </complexType>
150
- <element name="Audience" type="anyURI"/>
151
- <element name="OneTimeUse" type="saml:OneTimeUseType" />
152
- <complexType name="OneTimeUseType">
153
- <complexContent>
154
- <extension base="saml:ConditionAbstractType"/>
155
- </complexContent>
156
- </complexType>
157
- <element name="ProxyRestriction" type="saml:ProxyRestrictionType"/>
158
- <complexType name="ProxyRestrictionType">
159
- <complexContent>
160
- <extension base="saml:ConditionAbstractType">
161
- <sequence>
162
- <element ref="saml:Audience" minOccurs="0" maxOccurs="unbounded"/>
163
- </sequence>
164
- <attribute name="Count" type="nonNegativeInteger" use="optional"/>
165
- </extension>
166
- </complexContent>
167
- </complexType>
168
- <element name="Advice" type="saml:AdviceType"/>
169
- <complexType name="AdviceType">
170
- <choice minOccurs="0" maxOccurs="unbounded">
171
- <element ref="saml:AssertionIDRef"/>
172
- <element ref="saml:AssertionURIRef"/>
173
- <element ref="saml:Assertion"/>
174
- <element ref="saml:EncryptedAssertion"/>
175
- <any namespace="##other" processContents="lax"/>
176
- </choice>
177
- </complexType>
178
- <element name="EncryptedAssertion" type="saml:EncryptedElementType"/>
179
- <element name="Statement" type="saml:StatementAbstractType"/>
180
- <complexType name="StatementAbstractType" abstract="true"/>
181
- <element name="AuthnStatement" type="saml:AuthnStatementType"/>
182
- <complexType name="AuthnStatementType">
183
- <complexContent>
184
- <extension base="saml:StatementAbstractType">
185
- <sequence>
186
- <element ref="saml:SubjectLocality" minOccurs="0"/>
187
- <element ref="saml:AuthnContext"/>
188
- </sequence>
189
- <attribute name="AuthnInstant" type="dateTime" use="required"/>
190
- <attribute name="SessionIndex" type="string" use="optional"/>
191
- <attribute name="SessionNotOnOrAfter" type="dateTime" use="optional"/>
192
- </extension>
193
- </complexContent>
194
- </complexType>
195
- <element name="SubjectLocality" type="saml:SubjectLocalityType"/>
196
- <complexType name="SubjectLocalityType">
197
- <attribute name="Address" type="string" use="optional"/>
198
- <attribute name="DNSName" type="string" use="optional"/>
199
- </complexType>
200
- <element name="AuthnContext" type="saml:AuthnContextType"/>
201
- <complexType name="AuthnContextType">
202
- <sequence>
203
- <choice>
204
- <sequence>
205
- <element ref="saml:AuthnContextClassRef"/>
206
- <choice minOccurs="0">
207
- <element ref="saml:AuthnContextDecl"/>
208
- <element ref="saml:AuthnContextDeclRef"/>
209
- </choice>
210
- </sequence>
211
- <choice>
212
- <element ref="saml:AuthnContextDecl"/>
213
- <element ref="saml:AuthnContextDeclRef"/>
214
- </choice>
215
- </choice>
216
- <element ref="saml:AuthenticatingAuthority" minOccurs="0" maxOccurs="unbounded"/>
217
- </sequence>
218
- </complexType>
219
- <element name="AuthnContextClassRef" type="anyURI"/>
220
- <element name="AuthnContextDeclRef" type="anyURI"/>
221
- <element name="AuthnContextDecl" type="anyType"/>
222
- <element name="AuthenticatingAuthority" type="anyURI"/>
223
- <element name="AuthzDecisionStatement" type="saml:AuthzDecisionStatementType"/>
224
- <complexType name="AuthzDecisionStatementType">
225
- <complexContent>
226
- <extension base="saml:StatementAbstractType">
227
- <sequence>
228
- <element ref="saml:Action" maxOccurs="unbounded"/>
229
- <element ref="saml:Evidence" minOccurs="0"/>
230
- </sequence>
231
- <attribute name="Resource" type="anyURI" use="required"/>
232
- <attribute name="Decision" type="saml:DecisionType" use="required"/>
233
- </extension>
234
- </complexContent>
235
- </complexType>
236
- <simpleType name="DecisionType">
237
- <restriction base="string">
238
- <enumeration value="Permit"/>
239
- <enumeration value="Deny"/>
240
- <enumeration value="Indeterminate"/>
241
- </restriction>
242
- </simpleType>
243
- <element name="Action" type="saml:ActionType"/>
244
- <complexType name="ActionType">
245
- <simpleContent>
246
- <extension base="string">
247
- <attribute name="Namespace" type="anyURI" use="required"/>
248
- </extension>
249
- </simpleContent>
250
- </complexType>
251
- <element name="Evidence" type="saml:EvidenceType"/>
252
- <complexType name="EvidenceType">
253
- <choice maxOccurs="unbounded">
254
- <element ref="saml:AssertionIDRef"/>
255
- <element ref="saml:AssertionURIRef"/>
256
- <element ref="saml:Assertion"/>
257
- <element ref="saml:EncryptedAssertion"/>
258
- </choice>
259
- </complexType>
260
- <element name="AttributeStatement" type="saml:AttributeStatementType"/>
261
- <complexType name="AttributeStatementType">
262
- <complexContent>
263
- <extension base="saml:StatementAbstractType">
264
- <choice maxOccurs="unbounded">
265
- <element ref="saml:Attribute"/>
266
- <element ref="saml:EncryptedAttribute"/>
267
- </choice>
268
- </extension>
269
- </complexContent>
270
- </complexType>
271
- <element name="Attribute" type="saml:AttributeType"/>
272
- <complexType name="AttributeType">
273
- <sequence>
274
- <element ref="saml:AttributeValue" minOccurs="0" maxOccurs="unbounded"/>
275
- </sequence>
276
- <attribute name="Name" type="string" use="required"/>
277
- <attribute name="NameFormat" type="anyURI" use="optional"/>
278
- <attribute name="FriendlyName" type="string" use="optional"/>
279
- <anyAttribute namespace="##other" processContents="lax"/>
280
- </complexType>
281
- <element name="AttributeValue" type="anyType" nillable="true"/>
282
- <element name="EncryptedAttribute" type="saml:EncryptedElementType"/>
283
- </schema>
1
+ <?xml version="1.0" encoding="US-ASCII"?>
2
+ <schema
3
+ targetNamespace="urn:oasis:names:tc:SAML:2.0:assertion"
4
+ xmlns="http://www.w3.org/2001/XMLSchema"
5
+ xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
6
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
7
+ xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
8
+ elementFormDefault="unqualified"
9
+ attributeFormDefault="unqualified"
10
+ blockDefault="substitution"
11
+ version="2.0">
12
+ <import namespace="http://www.w3.org/2000/09/xmldsig#"
13
+ schemaLocation="xmldsig-core-schema.xsd"/>
14
+ <import namespace="http://www.w3.org/2001/04/xmlenc#"
15
+ schemaLocation="xenc-schema.xsd"/>
16
+ <annotation>
17
+ <documentation>
18
+ Document identifier: saml-schema-assertion-2.0
19
+ Location: http://docs.oasis-open.org/security/saml/v2.0/
20
+ Revision history:
21
+ V1.0 (November, 2002):
22
+ Initial Standard Schema.
23
+ V1.1 (September, 2003):
24
+ Updates within the same V1.0 namespace.
25
+ V2.0 (March, 2005):
26
+ New assertion schema for SAML V2.0 namespace.
27
+ </documentation>
28
+ </annotation>
29
+ <attributeGroup name="IDNameQualifiers">
30
+ <attribute name="NameQualifier" type="string" use="optional"/>
31
+ <attribute name="SPNameQualifier" type="string" use="optional"/>
32
+ </attributeGroup>
33
+ <element name="BaseID" type="saml:BaseIDAbstractType"/>
34
+ <complexType name="BaseIDAbstractType" abstract="true">
35
+ <attributeGroup ref="saml:IDNameQualifiers"/>
36
+ </complexType>
37
+ <element name="NameID" type="saml:NameIDType"/>
38
+ <complexType name="NameIDType">
39
+ <simpleContent>
40
+ <extension base="string">
41
+ <attributeGroup ref="saml:IDNameQualifiers"/>
42
+ <attribute name="Format" type="anyURI" use="optional"/>
43
+ <attribute name="SPProvidedID" type="string" use="optional"/>
44
+ </extension>
45
+ </simpleContent>
46
+ </complexType>
47
+ <complexType name="EncryptedElementType">
48
+ <sequence>
49
+ <element ref="xenc:EncryptedData"/>
50
+ <element ref="xenc:EncryptedKey" minOccurs="0" maxOccurs="unbounded"/>
51
+ </sequence>
52
+ </complexType>
53
+ <element name="EncryptedID" type="saml:EncryptedElementType"/>
54
+ <element name="Issuer" type="saml:NameIDType"/>
55
+ <element name="AssertionIDRef" type="NCName"/>
56
+ <element name="AssertionURIRef" type="anyURI"/>
57
+ <element name="Assertion" type="saml:AssertionType"/>
58
+ <complexType name="AssertionType">
59
+ <sequence>
60
+ <element ref="saml:Issuer"/>
61
+ <element ref="ds:Signature" minOccurs="0"/>
62
+ <element ref="saml:Subject" minOccurs="0"/>
63
+ <element ref="saml:Conditions" minOccurs="0"/>
64
+ <element ref="saml:Advice" minOccurs="0"/>
65
+ <choice minOccurs="0" maxOccurs="unbounded">
66
+ <element ref="saml:Statement"/>
67
+ <element ref="saml:AuthnStatement"/>
68
+ <element ref="saml:AuthzDecisionStatement"/>
69
+ <element ref="saml:AttributeStatement"/>
70
+ </choice>
71
+ </sequence>
72
+ <attribute name="Version" type="string" use="required"/>
73
+ <attribute name="ID" type="ID" use="required"/>
74
+ <attribute name="IssueInstant" type="dateTime" use="required"/>
75
+ </complexType>
76
+ <element name="Subject" type="saml:SubjectType"/>
77
+ <complexType name="SubjectType">
78
+ <choice>
79
+ <sequence>
80
+ <choice>
81
+ <element ref="saml:BaseID"/>
82
+ <element ref="saml:NameID"/>
83
+ <element ref="saml:EncryptedID"/>
84
+ </choice>
85
+ <element ref="saml:SubjectConfirmation" minOccurs="0" maxOccurs="unbounded"/>
86
+ </sequence>
87
+ <element ref="saml:SubjectConfirmation" maxOccurs="unbounded"/>
88
+ </choice>
89
+ </complexType>
90
+ <element name="SubjectConfirmation" type="saml:SubjectConfirmationType"/>
91
+ <complexType name="SubjectConfirmationType">
92
+ <sequence>
93
+ <choice minOccurs="0">
94
+ <element ref="saml:BaseID"/>
95
+ <element ref="saml:NameID"/>
96
+ <element ref="saml:EncryptedID"/>
97
+ </choice>
98
+ <element ref="saml:SubjectConfirmationData" minOccurs="0"/>
99
+ </sequence>
100
+ <attribute name="Method" type="anyURI" use="required"/>
101
+ </complexType>
102
+ <element name="SubjectConfirmationData" type="saml:SubjectConfirmationDataType"/>
103
+ <complexType name="SubjectConfirmationDataType" mixed="true">
104
+ <complexContent>
105
+ <restriction base="anyType">
106
+ <sequence>
107
+ <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
108
+ </sequence>
109
+ <attribute name="NotBefore" type="dateTime" use="optional"/>
110
+ <attribute name="NotOnOrAfter" type="dateTime" use="optional"/>
111
+ <attribute name="Recipient" type="anyURI" use="optional"/>
112
+ <attribute name="InResponseTo" type="NCName" use="optional"/>
113
+ <attribute name="Address" type="string" use="optional"/>
114
+ <anyAttribute namespace="##other" processContents="lax"/>
115
+ </restriction>
116
+ </complexContent>
117
+ </complexType>
118
+ <complexType name="KeyInfoConfirmationDataType" mixed="false">
119
+ <complexContent>
120
+ <restriction base="saml:SubjectConfirmationDataType">
121
+ <sequence>
122
+ <element ref="ds:KeyInfo" maxOccurs="unbounded"/>
123
+ </sequence>
124
+ </restriction>
125
+ </complexContent>
126
+ </complexType>
127
+ <element name="Conditions" type="saml:ConditionsType"/>
128
+ <complexType name="ConditionsType">
129
+ <choice minOccurs="0" maxOccurs="unbounded">
130
+ <element ref="saml:Condition"/>
131
+ <element ref="saml:AudienceRestriction"/>
132
+ <element ref="saml:OneTimeUse"/>
133
+ <element ref="saml:ProxyRestriction"/>
134
+ </choice>
135
+ <attribute name="NotBefore" type="dateTime" use="optional"/>
136
+ <attribute name="NotOnOrAfter" type="dateTime" use="optional"/>
137
+ </complexType>
138
+ <element name="Condition" type="saml:ConditionAbstractType"/>
139
+ <complexType name="ConditionAbstractType" abstract="true"/>
140
+ <element name="AudienceRestriction" type="saml:AudienceRestrictionType"/>
141
+ <complexType name="AudienceRestrictionType">
142
+ <complexContent>
143
+ <extension base="saml:ConditionAbstractType">
144
+ <sequence>
145
+ <element ref="saml:Audience" maxOccurs="unbounded"/>
146
+ </sequence>
147
+ </extension>
148
+ </complexContent>
149
+ </complexType>
150
+ <element name="Audience" type="anyURI"/>
151
+ <element name="OneTimeUse" type="saml:OneTimeUseType" />
152
+ <complexType name="OneTimeUseType">
153
+ <complexContent>
154
+ <extension base="saml:ConditionAbstractType"/>
155
+ </complexContent>
156
+ </complexType>
157
+ <element name="ProxyRestriction" type="saml:ProxyRestrictionType"/>
158
+ <complexType name="ProxyRestrictionType">
159
+ <complexContent>
160
+ <extension base="saml:ConditionAbstractType">
161
+ <sequence>
162
+ <element ref="saml:Audience" minOccurs="0" maxOccurs="unbounded"/>
163
+ </sequence>
164
+ <attribute name="Count" type="nonNegativeInteger" use="optional"/>
165
+ </extension>
166
+ </complexContent>
167
+ </complexType>
168
+ <element name="Advice" type="saml:AdviceType"/>
169
+ <complexType name="AdviceType">
170
+ <choice minOccurs="0" maxOccurs="unbounded">
171
+ <element ref="saml:AssertionIDRef"/>
172
+ <element ref="saml:AssertionURIRef"/>
173
+ <element ref="saml:Assertion"/>
174
+ <element ref="saml:EncryptedAssertion"/>
175
+ <any namespace="##other" processContents="lax"/>
176
+ </choice>
177
+ </complexType>
178
+ <element name="EncryptedAssertion" type="saml:EncryptedElementType"/>
179
+ <element name="Statement" type="saml:StatementAbstractType"/>
180
+ <complexType name="StatementAbstractType" abstract="true"/>
181
+ <element name="AuthnStatement" type="saml:AuthnStatementType"/>
182
+ <complexType name="AuthnStatementType">
183
+ <complexContent>
184
+ <extension base="saml:StatementAbstractType">
185
+ <sequence>
186
+ <element ref="saml:SubjectLocality" minOccurs="0"/>
187
+ <element ref="saml:AuthnContext"/>
188
+ </sequence>
189
+ <attribute name="AuthnInstant" type="dateTime" use="required"/>
190
+ <attribute name="SessionIndex" type="string" use="optional"/>
191
+ <attribute name="SessionNotOnOrAfter" type="dateTime" use="optional"/>
192
+ </extension>
193
+ </complexContent>
194
+ </complexType>
195
+ <element name="SubjectLocality" type="saml:SubjectLocalityType"/>
196
+ <complexType name="SubjectLocalityType">
197
+ <attribute name="Address" type="string" use="optional"/>
198
+ <attribute name="DNSName" type="string" use="optional"/>
199
+ </complexType>
200
+ <element name="AuthnContext" type="saml:AuthnContextType"/>
201
+ <complexType name="AuthnContextType">
202
+ <sequence>
203
+ <choice>
204
+ <sequence>
205
+ <element ref="saml:AuthnContextClassRef"/>
206
+ <choice minOccurs="0">
207
+ <element ref="saml:AuthnContextDecl"/>
208
+ <element ref="saml:AuthnContextDeclRef"/>
209
+ </choice>
210
+ </sequence>
211
+ <choice>
212
+ <element ref="saml:AuthnContextDecl"/>
213
+ <element ref="saml:AuthnContextDeclRef"/>
214
+ </choice>
215
+ </choice>
216
+ <element ref="saml:AuthenticatingAuthority" minOccurs="0" maxOccurs="unbounded"/>
217
+ </sequence>
218
+ </complexType>
219
+ <element name="AuthnContextClassRef" type="anyURI"/>
220
+ <element name="AuthnContextDeclRef" type="anyURI"/>
221
+ <element name="AuthnContextDecl" type="anyType"/>
222
+ <element name="AuthenticatingAuthority" type="anyURI"/>
223
+ <element name="AuthzDecisionStatement" type="saml:AuthzDecisionStatementType"/>
224
+ <complexType name="AuthzDecisionStatementType">
225
+ <complexContent>
226
+ <extension base="saml:StatementAbstractType">
227
+ <sequence>
228
+ <element ref="saml:Action" maxOccurs="unbounded"/>
229
+ <element ref="saml:Evidence" minOccurs="0"/>
230
+ </sequence>
231
+ <attribute name="Resource" type="anyURI" use="required"/>
232
+ <attribute name="Decision" type="saml:DecisionType" use="required"/>
233
+ </extension>
234
+ </complexContent>
235
+ </complexType>
236
+ <simpleType name="DecisionType">
237
+ <restriction base="string">
238
+ <enumeration value="Permit"/>
239
+ <enumeration value="Deny"/>
240
+ <enumeration value="Indeterminate"/>
241
+ </restriction>
242
+ </simpleType>
243
+ <element name="Action" type="saml:ActionType"/>
244
+ <complexType name="ActionType">
245
+ <simpleContent>
246
+ <extension base="string">
247
+ <attribute name="Namespace" type="anyURI" use="required"/>
248
+ </extension>
249
+ </simpleContent>
250
+ </complexType>
251
+ <element name="Evidence" type="saml:EvidenceType"/>
252
+ <complexType name="EvidenceType">
253
+ <choice maxOccurs="unbounded">
254
+ <element ref="saml:AssertionIDRef"/>
255
+ <element ref="saml:AssertionURIRef"/>
256
+ <element ref="saml:Assertion"/>
257
+ <element ref="saml:EncryptedAssertion"/>
258
+ </choice>
259
+ </complexType>
260
+ <element name="AttributeStatement" type="saml:AttributeStatementType"/>
261
+ <complexType name="AttributeStatementType">
262
+ <complexContent>
263
+ <extension base="saml:StatementAbstractType">
264
+ <choice maxOccurs="unbounded">
265
+ <element ref="saml:Attribute"/>
266
+ <element ref="saml:EncryptedAttribute"/>
267
+ </choice>
268
+ </extension>
269
+ </complexContent>
270
+ </complexType>
271
+ <element name="Attribute" type="saml:AttributeType"/>
272
+ <complexType name="AttributeType">
273
+ <sequence>
274
+ <element ref="saml:AttributeValue" minOccurs="0" maxOccurs="unbounded"/>
275
+ </sequence>
276
+ <attribute name="Name" type="string" use="required"/>
277
+ <attribute name="NameFormat" type="anyURI" use="optional"/>
278
+ <attribute name="FriendlyName" type="string" use="optional"/>
279
+ <anyAttribute namespace="##other" processContents="lax"/>
280
+ </complexType>
281
+ <element name="AttributeValue" type="anyType" nillable="true"/>
282
+ <element name="EncryptedAttribute" type="saml:EncryptedElementType"/>
283
+ </schema>