Parsing saml token with node.js

时间:2016-04-04 16:42:33

标签: node.js authentication saml

I found a node.js package to parse SAML tokens:

https://github.com/leandrob/saml20

Here's a snippet of the configuration code:

saml.validate(rawAssertion, options, function(err, profile) {
    // err
    var claims = profile.claims; // Array of user attributes;
    var issuer = profile.issuer: // String Issuer name.
});

However, I'm not sure where the rawAssertion parameter comes from or is defined. Is it part of the http request? And if so, which attribute is it?

Additional context - I need this because I am building a node.js app that will use Active Directory Federation Services for authentication purposes.

Thank you in advance!

1 个答案:

答案 0 :(得分:0)

断言是身份提供商向您的应用发回的POST的一部分。正式地,当您的应用程序重定向到提供程序并且提供程序验证凭据时,它会返回一个表单,其中action指向您的应用程序以及导致表单被POST的微小javascript。 POSTed正文包含其中一个字段中的标记(取决于是否使用SAML 1或2)。

示例代币在这里

https://www.samltool.com/generic_sso_res.php

这是您从POST中提取并提供给saml20模块的内容。