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

Possibility to get SamlResponse XML #328

Closed
josecolella opened this issue Dec 17, 2018 · 10 comments
Closed

Possibility to get SamlResponse XML #328

josecolella opened this issue Dec 17, 2018 · 10 comments

Comments

@josecolella
Copy link
Contributor

Is it possible to obtain the raw SamlResponse XML from passport-saml.

Currently the only thing possible is to extract the assertion xml.

@josecolella
Copy link
Contributor Author

@markstos When you have a second, can you check out my PR, would like to get your feedback on it.

@markstos
Copy link
Contributor

So getAssertionXml() doesn't work for you?

@markstos markstos reopened this Dec 18, 2018
@markstos
Copy link
Contributor

I agree on the problem, but not on the solution.

In reviewing the way I use passport-saml, I have a function to get the raw XML myself because it's useful for debugging.

One of the times when it's really useful is when login fails. At that point, there might be no profile found, right? So I'm not sure it makes sense to add this feature as a method of the the profile.

I end up parsing the body myself before I even hand to passport-saml:

``
// strip default namespace for xpath parsing
body = body.replace('xmlns="urn:oasis:names:tc:SAML:2.0:metadata"','xmlns=""');
var doc, dsSelect;

  // SAML errors can be hard to debug, so try one step at a time for maximally precise diagnostics.
  try {
    doc = new dom().parseFromString(body);
  }
  catch (e) {
    return _handleXmlError("Error parsing body of XML response", {
      error: e,
      xml: body
    }, callback);
  }

I'll review this in more detail. 

@josecolella
Copy link
Contributor Author

@markstos Unfortunately getAssertionXml does not completely work for me. I need to be able to get the entire SamlResponseXml as well. Please let me know if I need to make any changes, or any other solution to expose the samlresponsexml. I would love to get this in passport-saml. :)

@josecolella
Copy link
Contributor Author

@markstos I agree that having it part of the profile object might not be the best solution for the problem, I just need to be able to have access to the generated saml response xml (base64 or xml string)

@josecolella
Copy link
Contributor Author

@markstos Any update on this?

@josecolella
Copy link
Contributor Author

@markstos Any news on this? I would really like to get the ability to extract the saml response xml into the library. Please let me know if there are any changes you would like for the PR to be approved.

@josecolella
Copy link
Contributor Author

@markstos Apologies to keep pressing on this, but any news?

@josecolella
Copy link
Contributor Author

@markstos Any update?

@josecolella
Copy link
Contributor Author

@markstos Whenever you have a second, can you please let me know what I would need to change in the PR to get this into the library?

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

No branches or pull requests

2 participants