aaf-mdqt 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/codeql-analysis.yml +70 -0
  3. data/.github/workflows/ruby.yml +41 -0
  4. data/.gitignore +25 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +1 -0
  7. data/.rubocop_todo.yml +296 -0
  8. data/.ruby-version +1 -0
  9. data/.tool-versions +1 -0
  10. data/.travis.yml +7 -0
  11. data/CHANGELOG.md +168 -0
  12. data/CODE_OF_CONDUCT.md +74 -0
  13. data/Gemfile +9 -0
  14. data/LICENSE.txt +21 -0
  15. data/Makefile +4 -0
  16. data/README.md +268 -0
  17. data/Rakefile +5 -0
  18. data/aaf-mdqt.gemspec +46 -0
  19. data/bin/console +14 -0
  20. data/bin/setup +8 -0
  21. data/cucumber.yml +2 -0
  22. data/exe/mdqt +174 -0
  23. data/lib/mdqt/cli/base.rb +190 -0
  24. data/lib/mdqt/cli/cache_control.rb +25 -0
  25. data/lib/mdqt/cli/check.rb +78 -0
  26. data/lib/mdqt/cli/compliance.rb +0 -0
  27. data/lib/mdqt/cli/defaults.rb +70 -0
  28. data/lib/mdqt/cli/entities.rb +47 -0
  29. data/lib/mdqt/cli/exists.rb +0 -0
  30. data/lib/mdqt/cli/get.rb +130 -0
  31. data/lib/mdqt/cli/list.rb +65 -0
  32. data/lib/mdqt/cli/ln.rb +81 -0
  33. data/lib/mdqt/cli/ls.rb +54 -0
  34. data/lib/mdqt/cli/rename.rb +75 -0
  35. data/lib/mdqt/cli/reset.rb +27 -0
  36. data/lib/mdqt/cli/services.rb +25 -0
  37. data/lib/mdqt/cli/transform.rb +33 -0
  38. data/lib/mdqt/cli/url.rb +37 -0
  39. data/lib/mdqt/cli/version.rb +17 -0
  40. data/lib/mdqt/cli.rb +24 -0
  41. data/lib/mdqt/client/identifier_utils.rb +51 -0
  42. data/lib/mdqt/client/metadata_file.rb +144 -0
  43. data/lib/mdqt/client/metadata_response.rb +182 -0
  44. data/lib/mdqt/client/metadata_service.rb +194 -0
  45. data/lib/mdqt/client/metadata_validator.rb +81 -0
  46. data/lib/mdqt/client.rb +83 -0
  47. data/lib/mdqt/schema/MetadataExchange.xsd +112 -0
  48. data/lib/mdqt/schema/mdqt_check_schema.xsd +5 -0
  49. data/lib/mdqt/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd +195 -0
  50. data/lib/mdqt/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd +108 -0
  51. data/lib/mdqt/schema/saml-schema-assertion-2.0.xsd +283 -0
  52. data/lib/mdqt/schema/saml-schema-metadata-2.0.xsd +337 -0
  53. data/lib/mdqt/schema/ws-addr.xsd +137 -0
  54. data/lib/mdqt/schema/ws-authorization.xsd +145 -0
  55. data/lib/mdqt/schema/ws-federation.xsd +471 -0
  56. data/lib/mdqt/schema/ws-securitypolicy-1.2.xsd +1205 -0
  57. data/lib/mdqt/schema/xenc-schema.xsd +136 -0
  58. data/lib/mdqt/schema/xml.xsd +287 -0
  59. data/lib/mdqt/schema/xmldsig-core-schema.xsd +309 -0
  60. data/lib/mdqt/version.rb +3 -0
  61. data/lib/mdqt.rb +5 -0
  62. data/lib/tasks/cucumber.rake +8 -0
  63. data/lib/tasks/spec.rake +5 -0
  64. data/lib/tasks/tests.rake +6 -0
  65. data/lib/tasks/yard.rake +6 -0
  66. metadata +332 -0
@@ -0,0 +1,194 @@
1
+ module MDQT
2
+ class Client
3
+
4
+ class MetadataService
5
+
6
+ require 'cgi'
7
+
8
+ require 'faraday'
9
+ require 'faraday-http-cache'
10
+ require 'faraday/follow_redirects'
11
+
12
+ require 'active_support'
13
+ require 'active_support/core_ext'
14
+ require 'active_support/cache'
15
+ require 'active_support/cache/file_store'
16
+ require 'active_support/cache/mem_cache_store'
17
+ require 'active_support/logger'
18
+ require 'active_support/notifications'
19
+ require "httpx/adapters/faraday"
20
+
21
+ require_relative './metadata_response'
22
+
23
+ #Rails.application.config.active_support.cache_format_version = 7.0
24
+ ActiveSupport::Deprecation.behavior = :silence
25
+
26
+ def initialize(base_url, options = {})
27
+ @base_url = base_url
28
+ @cache_type = options[:cache_type] ? options[:cache_type].to_sym : :none
29
+ @store_config = options[:cache_store]
30
+ @verbose = options[:verbose] ? true : false
31
+ @explain = options[:explain] ? true : false
32
+ @tls_cert_check = options[:tls_cert_check] ? true : false
33
+ end
34
+
35
+ def base_url
36
+ @base_url
37
+ end
38
+
39
+ def get(entity_id)
40
+
41
+ entity_id = prepare_id(entity_id)
42
+
43
+ begin
44
+ http_response = connection.get do |req|
45
+ req.url request_path(entity_id)
46
+ req.options.timeout = 1000
47
+ req.options.open_timeout = 60
48
+ end
49
+ rescue Faraday::ConnectionFailed => oops
50
+ abort "Error - can't connect to MDQ service at URL #{base_url}: #{oops.to_s}"
51
+ rescue Faraday::TimeoutError => oops
52
+ abort "Error - connection to #{base_url} timed out!"
53
+ end
54
+
55
+ MetadataResponse.new(entity_id, base_url, http_response, explain: explain?)
56
+
57
+ end
58
+
59
+ def exists?(entity_id)
60
+
61
+ entity_id = prepare_id(entity_id)
62
+
63
+ begin
64
+ http_response = connection.head do |req|
65
+ req.url request_path(entity_id)
66
+ req.options.timeout = 1000
67
+ req.options.open_timeout = 60
68
+ end
69
+ rescue Faraday::ConnectionFailed => oops
70
+ abort "Error - can't connect to MDQ service at URL #{base_url}: #{oops.to_s}"
71
+ rescue Faraday::TimeoutError => oops
72
+ abort "Error - connection to #{base_url} timed out!"
73
+ end
74
+
75
+ http_response.status == 200
76
+
77
+ end
78
+
79
+ def prepare_id(id)
80
+ case id
81
+ when :all, "", nil
82
+ ""
83
+ when /^{sha1}/i
84
+ CGI.escape(validate_sha1!(id.downcase.strip))
85
+ when /^\[sha1\]/i
86
+ CGI.escape(validate_sha1!(id.downcase.strip.gsub "[sha1]", "{sha1}"))
87
+ else
88
+ CGI.escape(id.strip)
89
+ end
90
+ end
91
+
92
+ def verbose?
93
+ @verbose
94
+ end
95
+
96
+ def explain?
97
+ @explain
98
+ end
99
+
100
+ def tls_cert_check?
101
+ @tls_cert_check
102
+ end
103
+
104
+ def cache?
105
+ cache_type == :none ? false : true
106
+ end
107
+
108
+ def cache_type
109
+ @cache_type || :none
110
+ end
111
+
112
+ def store_config
113
+ @store_config || default_store_config
114
+ end
115
+
116
+ def validate_sha1!(sha1)
117
+ abort "Error: SHA1 identifier '#{sha1}' is malformed, halting" unless valid_sha1?(sha1)
118
+ sha1
119
+ end
120
+
121
+ def valid_sha1?(sha1)
122
+ (sha1 =~ /^[{\[]sha1[\]}][0-9a-f]{40}$/i).nil? ? false : true
123
+ end
124
+
125
+ def tidy_cache!
126
+ return unless cache_store
127
+ cache_store.cleanup
128
+ end
129
+
130
+ def purge_cache!
131
+ return unless cache_store
132
+ cache_store.clear
133
+ end
134
+
135
+ private
136
+
137
+ def request_path(entity_id)
138
+ case entity_id
139
+ when nil, ""
140
+ 'entities'
141
+ else
142
+ ['entities', entity_id].join('/')
143
+ end
144
+ end
145
+
146
+ def connection
147
+ Faraday.new(:url => base_url) do |faraday|
148
+ faraday.request :url_encoded
149
+ faraday.response :follow_redirects
150
+ if cache?
151
+ faraday.use :http_cache,
152
+ store: cache_store,
153
+ shared_cache: false,
154
+ serializer: Marshal,
155
+ instrumenter: ActiveSupport::Notifications
156
+ end
157
+ faraday.ssl.verify = tls_cert_check?
158
+ faraday.headers['Accept'] = 'application/samlmetadata+xml'
159
+ faraday.headers['Accept-Charset'] = 'utf-8'
160
+ faraday.headers['User-Agent'] = "MDQT v#{MDQT::VERSION}"
161
+ #faraday.response :logger
162
+ faraday.adapter :httpx
163
+ end
164
+ end
165
+
166
+ def default_store_config
167
+ case cache_type
168
+ when :none, nil
169
+ nil
170
+ when :file, :files
171
+ File.absolute_path(File.join(Dir.tmpdir, 'mdqt_cache'))
172
+ when :memcached, :memcache
173
+ 'localhost:11211'
174
+ end
175
+ end
176
+
177
+ def cache_logger
178
+ verbose? ? Logger.new('mdqt_cache.log') : nil
179
+ end
180
+
181
+ def cache_store
182
+ case cache_type
183
+ when :file, :files, nil
184
+ @cache_store = ActiveSupport::Cache.lookup_store(:file_store, store_config)
185
+ when :memcache, :memcached
186
+ @cache_store = ActiveSupport::Cache.lookup_store(:mem_cache_store, [store_config])
187
+ end
188
+ end
189
+
190
+ end
191
+
192
+ end
193
+
194
+ end
@@ -0,0 +1,81 @@
1
+ module MDQT
2
+ class Client
3
+
4
+ class MetadataValidator
5
+
6
+ def initialize(options = {})
7
+ @certs = options[:certs] || []
8
+ end
9
+
10
+ def verified_signature?(response)
11
+ begin
12
+ signed_document = Xmldsig::SignedDocument.new(response.data)
13
+ return true if certificates.any? {|c| signed_document.validate(c)}
14
+ false
15
+ rescue => oops
16
+ STDERR.puts oops
17
+ false
18
+ end
19
+ end
20
+
21
+ def valid?(response)
22
+ begin
23
+ errors = schema.validate(Nokogiri::XML(response.data) { |config| config.strict } )
24
+ return false unless errors.length.zero?
25
+ true
26
+ rescue => oops
27
+ false
28
+ end
29
+ end
30
+
31
+ def validation_error(response)
32
+ begin
33
+ errors = schema.validate(Nokogiri::XML(response.data) { |config| config.strict } )
34
+ return nil if errors.empty?
35
+ errors.join("\n")
36
+ rescue => oops
37
+ return "Invalid XML! #{oops.to_s}"
38
+ end
39
+ end
40
+
41
+ def certificates?
42
+ certificates.present?
43
+ end
44
+
45
+ def certificates
46
+ @certificates ||= normalize_certs(certs)
47
+ end
48
+
49
+ private
50
+
51
+ def certs
52
+ @certs
53
+ end
54
+
55
+ def normalize_certs(certs)
56
+ certs.collect {|c| normalize_cert(c)}
57
+ end
58
+
59
+ def normalize_cert(cert_object)
60
+ begin
61
+ return cert_object if cert_object.kind_of?(OpenSSL::X509::Certificate)
62
+ return OpenSSL::X509::Certificate.new(cert_object) if cert_object.kind_of?(String) && cert_object.include?("-----BEGIN CERTIFICATE-----")
63
+ OpenSSL::X509::Certificate.new(File.open(cert_object))
64
+ rescue => oops
65
+ raise
66
+ end
67
+ end
68
+
69
+ def schema
70
+ @schema ||= Nokogiri::XML::Schema(schema_data_fh)
71
+ end
72
+
73
+ def schema_data_fh
74
+ File.open(File.join(__dir__, '../schema/mdqt_check_schema.xsd'))
75
+ end
76
+
77
+ end
78
+
79
+ end
80
+
81
+ end
@@ -0,0 +1,83 @@
1
+ module MDQT
2
+ class Client
3
+
4
+ require 'rubygems'
5
+ require 'mdqt/client/metadata_service'
6
+ require 'mdqt/client/metadata_validator'
7
+ require 'mdqt/client/metadata_file'
8
+ require 'mdqt/client/identifier_utils'
9
+
10
+ begin
11
+ raise if ENV['MDQT_FAKE_MISSING_XMLSIG_GEM']
12
+ require 'xmldsig'
13
+ @xmlsig_available = true
14
+ rescue LoadError => oops
15
+ @xmlsig_available = false
16
+ end
17
+
18
+ def self.verification_available?
19
+ @xmlsig_available
20
+ end
21
+
22
+ def initialize(base_url, options={})
23
+
24
+ @base_url = base_url
25
+ @verbose = options[:verbose] || false
26
+ @explain = options[:explain] || false
27
+ @tls_cert_check = options[:tls_risky] ? false : true
28
+ @cache_type = options[:cache_type] || :none
29
+
30
+ @md_service = MetadataService.new(@base_url, verbose: @verbose, cache_type: @cache_type, explain: @explain, tls_cert_check: tls_cert_check?)
31
+ @md_service.tidy_cache!
32
+
33
+ end
34
+
35
+ def open_metadata(filename)
36
+ MetadataFile.new(filename, verbose: @verbose)
37
+ end
38
+
39
+ def get_metadata(entity_id)
40
+ md_service.get(entity_id)
41
+ end
42
+
43
+ def exists?(entity_id)
44
+ md_service.exists?(entity_id)
45
+ end
46
+
47
+ def transform_uri(uri)
48
+ MDQT::Client::IdentifierUtils.transform_uri(uri)
49
+ end
50
+
51
+ def base_url
52
+ @base_url
53
+ end
54
+
55
+ def verbose?
56
+ @verbose
57
+ end
58
+
59
+ def explain?
60
+ @explain
61
+ end
62
+
63
+ def tls_cert_check?
64
+ @tls_cert_check
65
+ end
66
+
67
+ def cache_type
68
+ @cache_type
69
+ end
70
+
71
+ def cache_reset!
72
+ md_service.purge_cache!
73
+ end
74
+
75
+ private
76
+
77
+ def md_service
78
+ @md_service
79
+ end
80
+
81
+ end
82
+
83
+ end
@@ -0,0 +1,112 @@
1
+ <?xml version='1.0' encoding='UTF-8' ?>
2
+ <!--
3
+ (c) 2004-2006 BEA Systems Inc., Computer Associates International, Inc.,
4
+ International Business Machines Corporation, Microsoft Corporation,
5
+ Inc., SAP AG, Sun Microsystems, and webMethods. All rights reserved.
6
+
7
+ Permission to copy and display the WS-MetadataExchange Specification
8
+ (the "Specification"), in any medium without fee or royalty is hereby
9
+ granted, provided that you include the following on ALL copies of the
10
+ Specification that you make:
11
+
12
+ 1. A link or URL to the Specification at this location.
13
+ 2. The copyright notice as shown in the Specification.
14
+
15
+ BEA Systems, Computer Associates, IBM, Microsoft, SAP, Sun, and
16
+ webMethods (collectively, the "Authors") each agree to grant you a
17
+ license, under royalty-free and otherwise reasonable,
18
+ non-discriminatory terms and conditions, to their respective essential
19
+ patent claims that they deem necessary to implement the
20
+ WS-MetadataExchange Specification.
21
+
22
+ THE SPECIFICATION IS PROVIDED "AS IS," AND THE AUTHORS MAKE NO
23
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT
24
+ LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25
+ PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE
26
+ SPECIFICATION ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE
27
+ IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY
28
+ PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
29
+
30
+ THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
31
+ INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
32
+ USE OR DISTRIBUTION OF THE SPECIFICATIONS.
33
+
34
+ The name and trademarks of the Authors may NOT be used in any manner,
35
+ including advertising or publicity pertaining to the Specifications or
36
+ their contents without specific, written prior permission. Title to
37
+ copyright in the Specifications will at all times remain with the
38
+ Authors.
39
+
40
+ No other rights are granted by implication, estoppel or otherwise.
41
+ -->
42
+
43
+ <xs:schema
44
+ targetNamespace='http://schemas.xmlsoap.org/ws/2004/09/mex'
45
+ xmlns:tns='http://schemas.xmlsoap.org/ws/2004/09/mex'
46
+ xmlns:wsa10='http://www.w3.org/2005/08/addressing'
47
+ xmlns:wsa04='http://schemas.xmlsoap.org/ws/2004/08/addressing'
48
+ xmlns:xs='http://www.w3.org/2001/XMLSchema'
49
+ elementFormDefault='qualified'
50
+ blockDefault='#all' >
51
+
52
+ <!-- Get Metadata request -->
53
+ <xs:element name='GetMetadata' >
54
+ <xs:complexType>
55
+ <xs:sequence>
56
+ <xs:element ref='tns:Dialect' minOccurs='0' />
57
+ <xs:element ref='tns:Identifier' minOccurs='0' />
58
+ </xs:sequence>
59
+ <xs:anyAttribute namespace='##other' processContents='lax' />
60
+ </xs:complexType>
61
+ </xs:element>
62
+
63
+ <xs:element name='Dialect' type='xs:anyURI' />
64
+ <xs:element name='Identifier' type='xs:anyURI' />
65
+
66
+ <!-- Get Metadata response -->
67
+ <xs:element name='Metadata' >
68
+ <xs:complexType>
69
+ <xs:sequence>
70
+ <xs:element ref='tns:MetadataSection'
71
+ minOccurs='0'
72
+ maxOccurs='unbounded' />
73
+ <xs:any namespace='##other' processContents='lax'
74
+ minOccurs='0'
75
+ maxOccurs='unbounded' />
76
+ </xs:sequence>
77
+ <xs:anyAttribute namespace='##other' processContents='lax' />
78
+ </xs:complexType>
79
+ </xs:element>
80
+
81
+ <xs:element name='MetadataSection' >
82
+ <xs:complexType>
83
+ <xs:choice>
84
+ <xs:any namespace='##other' processContents='lax' />
85
+ <xs:element ref='tns:MetadataReference' />
86
+ <xs:element ref='tns:Location' />
87
+ </xs:choice>
88
+ <xs:attribute name='Dialect' type='xs:anyURI' use='required' />
89
+ <xs:attribute name='Identifier' type='xs:anyURI' />
90
+ <xs:anyAttribute namespace='##other' processContents='lax' />
91
+ </xs:complexType>
92
+ </xs:element>
93
+
94
+ <!--
95
+ Ideally, the type of the MetadataReference would have been
96
+ the union of wsa04:EndpointReferenceType and
97
+ wsa10:EndpointReferenceType but unfortunately xs:union only
98
+ works for simple types. As a result, we have to define
99
+ the mex:MetadataReference using xs:any.
100
+ -->
101
+
102
+ <xs:element name='MetadataReference'>
103
+ <xs:complexType>
104
+ <xs:sequence>
105
+ <xs:any minOccurs='1' maxOccurs='unbounded'
106
+ processContents='lax' namespace='##other' />
107
+ </xs:sequence>
108
+ </xs:complexType>
109
+ </xs:element>
110
+ <xs:element name='Location'
111
+ type='xs:anyURI' />
112
+ </xs:schema>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://digitalidentitylabs.com/r/schema/saml_metadata_bundle">
3
+ <xs:import namespace="urn:oasis:names:tc:SAML:2.0:metadata" schemaLocation="saml-schema-metadata-2.0.xsd" />
4
+ <xs:import namespace="http://docs.oasis-open.org/wsfed/federation/200706" schemaLocation="ws-federation.xsd" />
5
+ </xs:schema>
@@ -0,0 +1,195 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ OASIS takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on OASIS's procedures with respect to rights in OASIS specifications can be found at the OASIS website. Copies of claims of rights made available for publication and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementors or users of this specification, can be obtained from the OASIS Executive Director.
4
+ OASIS invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to implement this specification. Please address the information to the OASIS Executive Director.
5
+ Copyright © OASIS Open 2002-2004. All Rights Reserved.
6
+ This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself does not be modified in any way, such as by removing the copyright notice or references to OASIS, except as needed for the purpose of developing OASIS specifications, in which case the procedures for copyrights defined in the OASIS Intellectual Property Rights document must be followed, or as required to translate it into languages other than English.
7
+ The limited permissions granted above are perpetual and will not be revoked by OASIS or its successors or assigns.
8
+ This document and the information contained herein is provided on an “AS IS” basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
9
+ -->
10
+ <xsd:schema targetNamespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" elementFormDefault="qualified" attributeFormDefault="unqualified" blockDefault="#all" version="0.2">
11
+ <xsd:import namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" schemaLocation="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"/>
12
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
13
+ <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/>
14
+ <xsd:complexType name="AttributedString">
15
+ <xsd:annotation>
16
+ <xsd:documentation>This type represents an element with arbitrary attributes.</xsd:documentation>
17
+ </xsd:annotation>
18
+ <xsd:simpleContent>
19
+ <xsd:extension base="xsd:string">
20
+ <xsd:attribute ref="wsu:Id"/>
21
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
22
+ </xsd:extension>
23
+ </xsd:simpleContent>
24
+ </xsd:complexType>
25
+ <xsd:complexType name="PasswordString">
26
+ <xsd:annotation>
27
+ <xsd:documentation>This type is used for password elements per Section 4.1.</xsd:documentation>
28
+ </xsd:annotation>
29
+ <xsd:simpleContent>
30
+ <xsd:extension base="wsse:AttributedString">
31
+ <xsd:attribute name="Type" type="xsd:anyURI"/>
32
+ </xsd:extension>
33
+ </xsd:simpleContent>
34
+ </xsd:complexType>
35
+ <xsd:complexType name="EncodedString">
36
+ <xsd:annotation>
37
+ <xsd:documentation>This type is used for elements containing stringified binary data.</xsd:documentation>
38
+ </xsd:annotation>
39
+ <xsd:simpleContent>
40
+ <xsd:extension base="wsse:AttributedString">
41
+ <xsd:attribute name="EncodingType" type="xsd:anyURI"/>
42
+ </xsd:extension>
43
+ </xsd:simpleContent>
44
+ </xsd:complexType>
45
+ <xsd:complexType name="UsernameTokenType">
46
+ <xsd:annotation>
47
+ <xsd:documentation>This type represents a username token per Section 4.1</xsd:documentation>
48
+ </xsd:annotation>
49
+ <xsd:sequence>
50
+ <xsd:element name="Username" type="wsse:AttributedString"/>
51
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
52
+ </xsd:sequence>
53
+ <xsd:attribute ref="wsu:Id"/>
54
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
55
+ </xsd:complexType>
56
+ <xsd:complexType name="BinarySecurityTokenType">
57
+ <xsd:annotation>
58
+ <xsd:documentation>A security token that is encoded in binary</xsd:documentation>
59
+ </xsd:annotation>
60
+ <xsd:simpleContent>
61
+ <xsd:extension base="wsse:EncodedString">
62
+ <xsd:attribute name="ValueType" type="xsd:anyURI"/>
63
+ </xsd:extension>
64
+ </xsd:simpleContent>
65
+ </xsd:complexType>
66
+ <xsd:complexType name="KeyIdentifierType">
67
+ <xsd:annotation>
68
+ <xsd:documentation>A security token key identifier</xsd:documentation>
69
+ </xsd:annotation>
70
+ <xsd:simpleContent>
71
+ <xsd:extension base="wsse:EncodedString">
72
+ <xsd:attribute name="ValueType" type="xsd:anyURI"/>
73
+ </xsd:extension>
74
+ </xsd:simpleContent>
75
+ </xsd:complexType>
76
+ <xsd:simpleType name="tUsage">
77
+ <xsd:annotation>
78
+ <xsd:documentation>Typedef to allow a list of usages (as URIs).</xsd:documentation>
79
+ </xsd:annotation>
80
+ <xsd:list itemType="xsd:anyURI"/>
81
+ </xsd:simpleType>
82
+ <xsd:attribute name="Usage" type="tUsage">
83
+ <xsd:annotation>
84
+ <xsd:documentation>This global attribute is used to indicate the usage of a referenced or indicated token within the containing context</xsd:documentation>
85
+ </xsd:annotation>
86
+ </xsd:attribute>
87
+ <xsd:complexType name="ReferenceType">
88
+ <xsd:annotation>
89
+ <xsd:documentation>This type represents a reference to an external security token.</xsd:documentation>
90
+ </xsd:annotation>
91
+ <xsd:attribute name="URI" type="xsd:anyURI"/>
92
+ <xsd:attribute name="ValueType" type="xsd:anyURI"/>
93
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
94
+ </xsd:complexType>
95
+ <xsd:complexType name="EmbeddedType">
96
+ <xsd:annotation>
97
+ <xsd:documentation>This type represents a reference to an embedded security token.</xsd:documentation>
98
+ </xsd:annotation>
99
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
100
+ <xsd:any processContents="lax"/>
101
+ </xsd:choice>
102
+ <xsd:attribute name="ValueType" type="xsd:anyURI"/>
103
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
104
+ </xsd:complexType>
105
+ <xsd:complexType name="SecurityTokenReferenceType">
106
+ <xsd:annotation>
107
+ <xsd:documentation>This type is used reference a security token.</xsd:documentation>
108
+ </xsd:annotation>
109
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
110
+ <xsd:any processContents="lax"/>
111
+ </xsd:choice>
112
+ <xsd:attribute ref="wsu:Id"/>
113
+ <xsd:attribute ref="wsse:Usage"/>
114
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
115
+ </xsd:complexType>
116
+ <xsd:complexType name="SecurityHeaderType">
117
+ <xsd:annotation>
118
+ <xsd:documentation>This complexType defines header block to use for security-relevant data directed at a specific SOAP actor.</xsd:documentation>
119
+ </xsd:annotation>
120
+ <xsd:sequence>
121
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded">
122
+ <xsd:annotation>
123
+ <xsd:documentation>The use of "any" is to allow extensibility and different forms of security data.</xsd:documentation>
124
+ </xsd:annotation>
125
+ </xsd:any>
126
+ </xsd:sequence>
127
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
128
+ </xsd:complexType>
129
+ <xsd:complexType name="TransformationParametersType">
130
+ <xsd:annotation>
131
+ <xsd:documentation>This complexType defines a container for elements to be specified from any namespace as properties/parameters of a DSIG transformation.</xsd:documentation>
132
+ </xsd:annotation>
133
+ <xsd:sequence>
134
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded">
135
+ <xsd:annotation>
136
+ <xsd:documentation>The use of "any" is to allow extensibility from any namespace.</xsd:documentation>
137
+ </xsd:annotation>
138
+ </xsd:any>
139
+ </xsd:sequence>
140
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
141
+ </xsd:complexType>
142
+ <xsd:element name="UsernameToken" type="wsse:UsernameTokenType">
143
+ <xsd:annotation>
144
+ <xsd:documentation>This element defines the wsse:UsernameToken element per Section 4.1.</xsd:documentation>
145
+ </xsd:annotation>
146
+ </xsd:element>
147
+ <xsd:element name="BinarySecurityToken" type="wsse:BinarySecurityTokenType">
148
+ <xsd:annotation>
149
+ <xsd:documentation>This element defines the wsse:BinarySecurityToken element per Section 4.2.</xsd:documentation>
150
+ </xsd:annotation>
151
+ </xsd:element>
152
+ <xsd:element name="Reference" type="wsse:ReferenceType">
153
+ <xsd:annotation>
154
+ <xsd:documentation>This element defines a security token reference</xsd:documentation>
155
+ </xsd:annotation>
156
+ </xsd:element>
157
+ <xsd:element name="Embedded" type="wsse:EmbeddedType">
158
+ <xsd:annotation>
159
+ <xsd:documentation>This element defines a security token embedded reference</xsd:documentation>
160
+ </xsd:annotation>
161
+ </xsd:element>
162
+ <xsd:element name="KeyIdentifier" type="wsse:KeyIdentifierType">
163
+ <xsd:annotation>
164
+ <xsd:documentation>This element defines a key identifier reference</xsd:documentation>
165
+ </xsd:annotation>
166
+ </xsd:element>
167
+ <xsd:element name="SecurityTokenReference" type="wsse:SecurityTokenReferenceType">
168
+ <xsd:annotation>
169
+ <xsd:documentation>This element defines the wsse:SecurityTokenReference per Section 4.3.</xsd:documentation>
170
+ </xsd:annotation>
171
+ </xsd:element>
172
+ <xsd:element name="Security" type="wsse:SecurityHeaderType">
173
+ <xsd:annotation>
174
+ <xsd:documentation>This element defines the wsse:Security SOAP header element per Section 4.</xsd:documentation>
175
+ </xsd:annotation>
176
+ </xsd:element>
177
+ <xsd:element name="TransformationParameters" type="wsse:TransformationParametersType">
178
+ <xsd:annotation>
179
+ <xsd:documentation>This element contains properties for transformations from any namespace, including DSIG.</xsd:documentation>
180
+ </xsd:annotation>
181
+ </xsd:element>
182
+ <xsd:element name="Password" type="wsse:PasswordString"/>
183
+ <xsd:element name="Nonce" type="wsse:EncodedString"/>
184
+ <xsd:simpleType name="FaultcodeEnum">
185
+ <xsd:restriction base="xsd:QName">
186
+ <xsd:enumeration value="wsse:UnsupportedSecurityToken"/>
187
+ <xsd:enumeration value="wsse:UnsupportedAlgorithm"/>
188
+ <xsd:enumeration value="wsse:InvalidSecurity"/>
189
+ <xsd:enumeration value="wsse:InvalidSecurityToken"/>
190
+ <xsd:enumeration value="wsse:FailedAuthentication"/>
191
+ <xsd:enumeration value="wsse:FailedCheck"/>
192
+ <xsd:enumeration value="wsse:SecurityTokenUnavailable"/>
193
+ </xsd:restriction>
194
+ </xsd:simpleType>
195
+ </xsd:schema>