Skip to content
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

To support multiple authnContext #183

Closed
wants to merge 17 commits into from

Conversation

Dhiviya-Bharathi
Copy link

This fix is to solve the issue raised by me #181. To support multiple authentication method in passport saml. I have upgraded xmlbuilder module from 2.5.6 to 4.1.x from which array parsing is supported.

While configuring authnContext we have to specify as one dimensional array(even for single authntication method - may be we can make it flexible if u want).

DHIVIYA BHARATHI A added 17 commits January 2, 2017 16:26
…the new xml parser: corrected a minor syntax error
…the new xml parser: corrected a minor syntax error#2
…the new xml parser: corrected a minor syntax error#3
@Dhiviya-Bharathi
Copy link
Author

I have updated the test scripts with the help of xdmnl commit

@Dhiviya-Bharathi
Copy link
Author

I didnt know why it was failing for this Node stable version

@Dhiviya-Bharathi Dhiviya-Bharathi changed the title to support multiple authnContext To support multiple authnContext Jan 3, 2017
@bgerlich
Copy link

It would make my life much easier if this fix was merged into the master branch...

@pdspicer pdspicer self-assigned this Mar 29, 2017
@cjbarth
Copy link
Collaborator

cjbarth commented Mar 30, 2017

I really don't like the breaking change of making this an array even for a single value. The function should detect if array or not an act accordingly, and the tests should test for both scenarios.

@pdspicer
Copy link
Contributor

Interestingly the way this was implemented in this PR should technically be non-breaking as the option is still specified as a string, just comma-separated.. That being said, I'd change the implementation as @cjbarth recommended as it is better practice than using comma-separated strings:

options.authnContext = "some authn context"
// OR
options.authnContext = ["array", "of", "contexts"]

@Babsvik
Copy link

Babsvik commented Aug 8, 2017

Any ETA on when this request will make it into passport-saml?

@markstos
Copy link
Contributor

markstos commented Jan 3, 2018

@Babsvik @tjbeers We are currently waiting for:

  1. someone to implement the revision suggested by @pdspicer: To support multiple authnContext #183 (comment)
  2. It's also strange that this PR contains 17 commits, most of which appear to be making a similar modification to the tests. Clean-up solution that squashed the test updates into fewer commits.
  3. update the README to document the new behavior as well.
  4. Given the passage of time, it should also be re-based on the current master branch as well.

@illion20
Copy link

illion20 commented Apr 7, 2018

Is anyone working on merging this in?

@markstos
Copy link
Contributor

markstos commented Apr 7, 2018

@illion20 I'm aware of no action since the call for refinements on Jan 3rd. Are you are interested in taking on the refinements requested then to get it merged?

@illion20
Copy link

illion20 commented Apr 8, 2018

@markstos I was wondering since I already specify the authncontext as an array in the current version and it seems to work, at least I get authenticated through my ADFS. Or perhaps its just ignoring the it?

@markstos
Copy link
Contributor

markstos commented Apr 9, 2018

@illion20 I'm not an expert in that part of the code. Considering reviewing the automated test coverage we have and adding an additional test if you are unsure if it's actually working.

self.options.authnContext.split(',').forEach(function(value, index) {
authnContextInArray.push({
'@xmlns:saml': 'urn:oasis:names:tc:SAML:2.0:assertion',
'#text': self.options.authnContext.split(',')[index]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about just using value?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cadesalaberry Could you say more about what you see that could be improved here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe he is wondering why not use value instead of self.options.authnContext.split(',')[index]

+      self.options.authnContext.split(',').forEach(function(value, index) {
+        authnContextInArray.push({
+            '@xmlns:saml': 'urn:oasis:names:tc:SAML:2.0:assertion',
+            '#text': value

Copy link

@illion20 illion20 Apr 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote for making it an array even if its one value, but I have no status here:

+      self.options.authnContext.forEach( context => {
+        authnContextInArray.push({
+            '@xmlns:saml': 'urn:oasis:names:tc:SAML:2.0:assertion',
+            '#text': context

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment earlier favored detecting if the incoming value was an array or a single value and switching accordingly. That prevents breakage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cjbarth Couldn't either be valid according to the SAML spec? Is the breakage you referring backwards compatibility in the sense that we would continue to handle single values as before?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @markstos , that is the breakage I'm referring to. We should break backwards compatibility of passing in a single value if we don't have to, and in this case I don't think we have to.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm with @cjbarth on using an array instead of comma-separated.

For #252 we could extend an array implementation with detecting string vs objects (e.g.: [{ref: 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport', comparisonType: 'minimum'}]). That would be a pain with a comma-separated value.

@cjbarth
Copy link
Collaborator

cjbarth commented Sep 10, 2018

Aside from changing this to use an array instead of CSV and making sure that backwards compatibility with string is maintained, is there anything holding this PR back? If not, I can fork this branch, fix that up, make a new PR referencing this one, and we can get this issue resolved and close out this PR.

@markstos
Copy link
Contributor

@cjbarth I don't think there's anything hold this back. Your clean-up help would be welcome here.

@cjbarth
Copy link
Collaborator

cjbarth commented Sep 11, 2018

@markstos I've created #298 to supersede this work. If that lands, this PR can be closed without merging it seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants