-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[NEW] SAML: Adds possibility to decrypt encrypted assertions #12153
Conversation
@gerbsen can you fix the conflict? |
@rodrigogs I tried fixing the problems but now there are even more :( could you help me, and tell me what needs to be done? |
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.
Added some comments to later improvements
let assertion = response.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'Assertion')[0]; | ||
const encAssertion = response.getElementsByTagNameNS('urn:oasis:names:tc:SAML:2.0:assertion', 'EncryptedAssertion')[0]; | ||
|
||
const xmlenc = require('xml-encryption'); |
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.
Move this to the top of the file as an import
const options = { key: this.options.privateKey }; | ||
|
||
if (typeof encAssertion !== 'undefined') { | ||
xmlenc.decrypt(encAssertion.getElementsByTagNameNS('*', 'EncryptedData')[0], options, function(err, result) { |
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.
Move this to a function to prevent code duplication and prefer to use arrow functions
* - adds possibility to decrypt encrypted assertions * Update saml_utils.js fixes jslint problems https://circleci.com/gh/RocketChat/Rocket.Chat/18744?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
Can someone please make unit tests for saml? Willing to help.. |
Dear Rocket.Chat team,
First of all, thank you very much for providing this software as open source. Very much appreciated.
We have added the possiblity to also use encrypted assertions with the SAML login. We have developed and tested this extension on an instance with a couple of thousand users. We originally have started to develop this fix for the underlying SAML library and it was approved there. Since we discovered to late that Rocket.Chat uses a custom version of this library, our changes are kind of obsolete now. We have asked here if a PR is welcome and herewith deliver the PR. We are aware of the fact that this might take some time. In case we can do anything to speed up this process, we are happy to help. :)
Here is the documentation that we added in the underlying project.
Kind regards,
Daniel (from team netzbegruenung)
Encryption
The
<EncryptedAssertion>
element represents an assertion in encrypted fashion, as defined by the XML Encryption Syntax and Processing specification XMLEnc. Encrypted assertions are intended as a confidentiality protection mechanism when the plain-text value passes through an intermediary.The following schema fragment defines the
<EncryptedAssertion>
element:In case the SAML response contains an
<EncryptedAssertion>
element and the configuration keyprivateKey
is set, the assertion get's decrypted and handled like it would be an unencrypted one.