signer 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +4 -0
- data/lib/signer.rb +6 -4
- data/lib/signer/version.rb +1 -1
- data/spec/fixtures/input_1.xml +2 -2
- data/spec/fixtures/output_1.xml +8 -8
- data/spec/fixtures/output_1_sha256.xml +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjdkYWY0NGIxMWEwZWEyNDEwNDkwN2E2ZDA0NWZlODcxNGVhMmM3Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2M3Njg5MTE1ZDQ4NTM4ZGU5YjI0OWNjY2IzMmNiMDVhYjE0NjEzYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Zjg3YjhhMzAwZjJmZTM4M2Y1MGIwODM5ZmE4OGFlMTM3ZTYwODM4YjA0ODJl
|
10
|
+
ZWI2MWNkYThkMjNhOTEwNzhkZGI3MmE1MzQ4MDMzMmQ4ZDgyOWZmMDc5MDNi
|
11
|
+
YzY3ZTY2NmY2NDdhODFhMjAxOGE2M2I5Y2UyMjNkODc1MjM4MGI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjIwOWQ4YmJiMjAzZDhmNTRiMjYxNDljMzQzMGEwNzA4N2U0ZTgwNTZjZmVj
|
14
|
+
ZTgxMDg5MzBlOGY4NmZjYWE2YmEzNTgwZDA3NTM4NzQ4ZWU4MGFkY2RiNzYz
|
15
|
+
Nzc1MGYzMTM0NTg4OWRmOTliMmI2NWFkODZhMzcwNjllN2RlN2M=
|
data/CHANGELOG.md
CHANGED
data/lib/signer.rb
CHANGED
@@ -12,6 +12,7 @@ class Signer
|
|
12
12
|
attr_writer :security_node, :security_token_id
|
13
13
|
|
14
14
|
WSU_NAMESPACE = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'
|
15
|
+
WSSE_NAMESPACE = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'
|
15
16
|
|
16
17
|
def initialize(document)
|
17
18
|
self.document = Nokogiri::XML(document.to_s, &:noblanks)
|
@@ -68,7 +69,7 @@ class Signer
|
|
68
69
|
end
|
69
70
|
|
70
71
|
def security_node
|
71
|
-
@security_node ||= document.xpath(
|
72
|
+
@security_node ||= document.xpath('//wsse:Security', wsse: WSSE_NAMESPACE).first
|
72
73
|
end
|
73
74
|
|
74
75
|
def canonicalize(node = document)
|
@@ -118,19 +119,20 @@ class Signer
|
|
118
119
|
# </o:SecurityTokenReference>
|
119
120
|
# </KeyInfo>
|
120
121
|
def binary_security_token_node
|
121
|
-
node = document.xpath(
|
122
|
+
node = document.xpath('//wsse:BinarySecurityToken', wsse: WSSE_NAMESPACE).first
|
122
123
|
unless node
|
123
124
|
node = Nokogiri::XML::Node.new('BinarySecurityToken', document)
|
124
125
|
node['ValueType'] = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3'
|
125
126
|
node['EncodingType'] = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'
|
126
127
|
node.content = Base64.encode64(cert.to_der).gsub("\n", '')
|
127
128
|
signature_node.add_previous_sibling(node)
|
129
|
+
wsse_ns = namespace_prefix(node, WSSE_NAMESPACE, 'wsse')
|
128
130
|
wsu_ns = namespace_prefix(node, WSU_NAMESPACE, 'wsu')
|
129
131
|
node["#{wsu_ns}:Id"] = security_token_id
|
130
132
|
key_info_node = Nokogiri::XML::Node.new('KeyInfo', document)
|
131
|
-
security_token_reference_node = Nokogiri::XML::Node.new(
|
133
|
+
security_token_reference_node = Nokogiri::XML::Node.new("#{wsse_ns}:SecurityTokenReference", document)
|
132
134
|
key_info_node.add_child(security_token_reference_node)
|
133
|
-
reference_node = Nokogiri::XML::Node.new(
|
135
|
+
reference_node = Nokogiri::XML::Node.new("#{wsse_ns}:Reference", document)
|
134
136
|
reference_node['ValueType'] = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3'
|
135
137
|
reference_node['URI'] = "##{security_token_id}"
|
136
138
|
security_token_reference_node.add_child(reference_node)
|
data/lib/signer/version.rb
CHANGED
data/spec/fixtures/input_1.xml
CHANGED
@@ -7,12 +7,12 @@
|
|
7
7
|
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
|
8
8
|
</a:ReplyTo>
|
9
9
|
<To xmlns="http://www.w3.org/2005/08/addressing" xmlns:a="http://www.w3.org/2003/05/soap-envelope" a:mustUnderstand="1">http://tempuri.org/PublicServices/Test/1.0.12/PublicServices/DocumentService.svc</To>
|
10
|
-
<
|
10
|
+
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
|
11
11
|
<wsurandom:Timestamp>
|
12
12
|
<wsurandom:Created>2012-05-02T18:17:14.467Z</wsurandom:Created>
|
13
13
|
<wsurandom:Expires>2012-05-02T18:22:14.467Z</wsurandom:Expires>
|
14
14
|
</wsurandom:Timestamp>
|
15
|
-
</
|
15
|
+
</wsse:Security>
|
16
16
|
</s:Header>
|
17
17
|
<s:Body>
|
18
18
|
<SearchDocuments xmlns="http://tempuri.org/">
|
data/spec/fixtures/output_1.xml
CHANGED
@@ -7,12 +7,12 @@
|
|
7
7
|
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
|
8
8
|
</a:ReplyTo>
|
9
9
|
<To xmlns="http://www.w3.org/2005/08/addressing" xmlns:a="http://www.w3.org/2003/05/soap-envelope" a:mustUnderstand="1" wsurandom:Id="_7e75a8ded22253b163ca76a40b6cc0c670ed0c33">http://tempuri.org/PublicServices/Test/1.0.12/PublicServices/DocumentService.svc</To>
|
10
|
-
<
|
10
|
+
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
|
11
11
|
<wsurandom:Timestamp wsurandom:Id="_3e2f6b0b9430b7f2b69712172db02293291f5322">
|
12
12
|
<wsurandom:Created>2012-05-02T18:17:14.467Z</wsurandom:Created>
|
13
13
|
<wsurandom:Expires>2012-05-02T18:22:14.467Z</wsurandom:Expires>
|
14
14
|
</wsurandom:Timestamp>
|
15
|
-
<
|
15
|
+
<wsse:BinarySecurityToken ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" wsurandom:Id="uuid-639b8970-7644-4f9e-9bc4-9c2e367808fc-1">MIICsDCCAhmgAwIBAgIJAOUHvh4oho0tMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMTIwNTAzMTMxODIyWhcNMTMwNTAzMTMxODIyWjBFMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvK5hMPv/R5IFmwWyJOyEaFUrF/ZsmN+Gip8hvR6rLP3YPNx9iFYvPcZllFmuVwyaz7YT2N5BsqTwLdyi5v4HY4fUtuz0p8jIPoSd6dfDvcnSpf4QLTOgOaL3ciPEbgDHH2tnIksukoWzqCYva+qFZ74NFl19swXotW9fA4Jzs4QIDAQABo4GnMIGkMB0GA1UdDgQWBBRU1WEHDnP8Hr7ZulxrSzEwOcYpMzB1BgNVHSMEbjBsgBRU1WEHDnP8Hr7ZulxrSzEwOcYpM6FJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAOUHvh4oho0tMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEASY/9SAOK57q9mGnNJJeyDbmyGrAHSJTod646xTHYkMvhUqwHyk9PTr5bdfmswpmyVn+AQ43U2tU5vnpTBmKpHWD2+HSHgGa92mMLrfBOd8EBZ329NL3N2HDPIaHr4NPGyhNrSK3QVOnAq2D0jlyrGYJlLli1NxHiBz7FCEJaVI8=</wsse:BinarySecurityToken>
|
16
16
|
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
|
17
17
|
<SignedInfo>
|
18
18
|
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
|
@@ -36,17 +36,17 @@
|
|
36
36
|
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
|
37
37
|
</Transforms>
|
38
38
|
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
|
39
|
-
<DigestValue>
|
39
|
+
<DigestValue>QfyyHQKBXN21QNXRHMDBkxZeTMI=</DigestValue>
|
40
40
|
</Reference>
|
41
41
|
</SignedInfo>
|
42
|
-
<SignatureValue>
|
42
|
+
<SignatureValue>c1YkLvip/5njmwGakJ1Er6PMDUO2zC1HpinFkEEQkL+Ay1XJzGFehQdflIQjb6oRkT3c5DY3c+tcvE+G9/Wzy1m89RKkLvUAdPeI+ZMZw+90Rf5mvJku3QJ/G1bDlBOL54zYIC76El+XmHy1YM71x9+Y56z2mtCxZWAFOP7C3rA=</SignatureValue>
|
43
43
|
<KeyInfo>
|
44
|
-
<
|
45
|
-
<
|
46
|
-
</
|
44
|
+
<wsse:SecurityTokenReference>
|
45
|
+
<wsse:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#uuid-639b8970-7644-4f9e-9bc4-9c2e367808fc-1"/>
|
46
|
+
</wsse:SecurityTokenReference>
|
47
47
|
</KeyInfo>
|
48
48
|
</Signature>
|
49
|
-
</
|
49
|
+
</wsse:Security>
|
50
50
|
</s:Header>
|
51
51
|
<s:Body>
|
52
52
|
<SearchDocuments xmlns="http://tempuri.org/">
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<?xml version="1.0"?>
|
2
|
-
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:wsurandom="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/IDocumentService/SearchDocuments</a:Action><a:MessageID>urn:uuid:30db5d4f-ab84-46be-907c-be690a92979b</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><To xmlns="http://www.w3.org/2005/08/addressing" xmlns:a="http://www.w3.org/2003/05/soap-envelope" a:mustUnderstand="1">http://tempuri.org/PublicServices/Test/1.0.12/PublicServices/DocumentService.svc</To><
|
2
|
+
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:wsurandom="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/IDocumentService/SearchDocuments</a:Action><a:MessageID>urn:uuid:30db5d4f-ab84-46be-907c-be690a92979b</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><To xmlns="http://www.w3.org/2005/08/addressing" xmlns:a="http://www.w3.org/2003/05/soap-envelope" a:mustUnderstand="1">http://tempuri.org/PublicServices/Test/1.0.12/PublicServices/DocumentService.svc</To><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1"><wsurandom:Timestamp><wsurandom:Created>2012-05-02T18:17:14.467Z</wsurandom:Created><wsurandom:Expires>2012-05-02T18:22:14.467Z</wsurandom:Expires></wsurandom:Timestamp><wsse:BinarySecurityToken ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" wsurandom:Id="uuid-639b8970-7644-4f9e-9bc4-9c2e367808fc-1">MIICsDCCAhmgAwIBAgIJAOUHvh4oho0tMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMTIwNTAzMTMxODIyWhcNMTMwNTAzMTMxODIyWjBFMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvK5hMPv/R5IFmwWyJOyEaFUrF/ZsmN+Gip8hvR6rLP3YPNx9iFYvPcZllFmuVwyaz7YT2N5BsqTwLdyi5v4HY4fUtuz0p8jIPoSd6dfDvcnSpf4QLTOgOaL3ciPEbgDHH2tnIksukoWzqCYva+qFZ74NFl19swXotW9fA4Jzs4QIDAQABo4GnMIGkMB0GA1UdDgQWBBRU1WEHDnP8Hr7ZulxrSzEwOcYpMzB1BgNVHSMEbjBsgBRU1WEHDnP8Hr7ZulxrSzEwOcYpM6FJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAOUHvh4oho0tMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEASY/9SAOK57q9mGnNJJeyDbmyGrAHSJTod646xTHYkMvhUqwHyk9PTr5bdfmswpmyVn+AQ43U2tU5vnpTBmKpHWD2+HSHgGa92mMLrfBOd8EBZ329NL3N2HDPIaHr4NPGyhNrSK3QVOnAq2D0jlyrGYJlLli1NxHiBz7FCEJaVI8=</wsse:BinarySecurityToken><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><Reference URI="#uuid-639b8970-7644-4f9e-9bc4-9c2e367808fc-1"><Transforms><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><DigestValue>2ca0eR2o1+y/CovNwnle3yEK1wI+ztlKQfCqcGvoSAA=</DigestValue></Reference></SignedInfo><SignatureValue>ml/HJ0ouBwAag9Kr4yTyrc4RrHc3sspx2YbQHPiTxB3QOT+T2kM5wU+gnHVIk5VOYVR9FIvm/bb6RWnLyW78/7eN6eIoh+Zr1YsEavCHw3AR9Zf4d7S+9ugCrPmrrEO1lOiyEHU0HuWS5gqua+/ttuTPtV24fGeWvxl15SIxFa8=</SignatureValue><KeyInfo><wsse:SecurityTokenReference><wsse:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#uuid-639b8970-7644-4f9e-9bc4-9c2e367808fc-1"/></wsse:SecurityTokenReference></KeyInfo></Signature></wsse:Security></s:Header><s:Body><SearchDocuments xmlns="http://tempuri.org/"><searchCriteria xmlns:b="http://schemas.datacontract.org/2004/07/BusinessLogic.Data.Documents.Integration" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><b:RegistrationNo>1</b:RegistrationNo></searchCriteria></SearchDocuments></s:Body></s:Envelope>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgars Beigarts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
version_requirements: !ruby/object:Gem::Requirement
|