-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Introduces a new 'addElement' option to WSSE Security to add custom xml to <wsse> header #1362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Introduces a new 'addElement' option to WSSE Security to add custom xml to <wsse> header #1362
Conversation
Seems like build is broken |
appendElement: '<Certificate>Mfg...1+</Certificate>' | ||
}); | ||
var xml = instance.postProcess('<soap:Envelope><soap:Header></soap:Header><soap:Body><Body></Body></soap:Body></soap:Envelope>', 'soap'); | ||
xml.should.containEql('<Certificate>Mfg...1+</Certificate>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does the full XML look like? Maybe assert full one so it will provide better understanding of where new element is added?
test/security/WSSecurityCert.js
Outdated
it('should not add appendElement when not provided', function () { | ||
var instance = new WSSecurityCert(key, cert, ''); | ||
var xml = instance.postProcess('<soap:Envelope><soap:Header></soap:Header><soap:Body><Body></Body></soap:Body></soap:Envelope>', 'soap'); | ||
xml.should.not.containEql('<Certificate>Mfg...1+</Certificate>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case assert full message would help as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've decided to remove this test case as a full assertion made me realize this is redundant. With the default instantiation we are indirectly ensuring that there is no extra/custom element present in the WSSESecurity element.
See test case starting at line 38 for reference. That should do the same job (no custom element when one isn't provided in options as appendElement).
Readme.md
Outdated
- `prefix`: (optional) Adds this value as a prefix for the generated signature tags. | ||
- `attrs`: (optional) A hash of attributes and values attrName: value to add to the signature root node | ||
- `idMode`: (optional) either 'wssecurity' to generate wsse-scoped reference Id on <Body> or undefined for an unscoped reference Id | ||
- `appendElement`: (optional) A string containing XML to append to the end of the wsse:Security element. This can be used to add custom elements like certificates or other security tokens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `appendElement`: (optional) A string containing XML to append to the end of the wsse:Security element. This can be used to add custom elements like certificates or other security tokens. | |
- `appendElement`: (optional) A string containing XML element to append to the end of the WSSecurity element. This can be used to add custom elements like certificates or other security tokens. |
Readme.md
Outdated
</SignedInfo> | ||
</Signature> | ||
<!-- Custom element is appended to the end of the security block --> | ||
<custom:Element>test</custom:Element> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<custom:MyCustomElement xmlns:custom="http://example.com/custom">
foo
</custom:MyCustomElement>
probably better to follow spec and provide xml namespace declaration in the example
Also, project was recently converted to use prettier, there are new npm scripts |
Thanks for the feedback @w666. I'll do some refactoring and update the PR in a few days. |
ac8f8bc
to
e4235f4
Compare
…lement'. This allows user to pass a custom xml string that will be added to the Wsse Security element.
e4235f4
to
f525051
Compare
Hi, sorry, I stuck with another issue, will review this one as soon as I can. |
Add appendElement option to WSSecurity, WSSecurityCert, and WSSecurityCertWithToken. When provided with an xml as a string it adds that to the end of the wsse header.
appendElement
property in IWSSecurityOptions and IWSSecurityCertOptions interfaces.