获取 SAML 响应的 Meteor 帐户(登录后的令牌/用户)
Meteor Accounts obtaining the SAML Response (Token / User after log in)
我使用 Meteor.accounts 和 MS Azure 进行了 SAML 登录。我正在使用这个 https://github.com/steffow/meteor-accounts-saml library for SAML which is derived from https://github.com/bergie/passport-saml
程序是这样的:
- 单击 saml 登录 -> 出现弹出窗口
- 在弹出窗口中输入 user/pw 数据 -> 弹出窗口无错误关闭
- 登录成功
所以现在我想获取 SAML 令牌以进行进一步处理(或者至少是 meteor 从 IDP 获取的有关登录用户的信息)。
由于我不知道 SAML 令牌由 Meteor 存储在哪里或可以在代码中获取,有人可以帮我获得 SAML 响应吗?
现在可能已经解决了,但是就这样..
根据代码,在第 70 行的 "saml_server.js" 中检索到 saml 响应,令牌也应该在其中 (loginRequest.credentialToken)
loginResult 应该很容易保存到 Meteor.users 集合
var loginResult = Accounts.saml.retrieveCredential(loginRequest.credentialToken);
var email = loginResult.profile.email;
var user = Meteor.users.findOne({username: email});
if (!user) {
Accounts.createUser({
"username": email,
"profile": StufffromloginResult
});
} else {
Meteor.users.update(
{
"username": email
},
{ "$set": {
"profile": StufffromloginResult,
}
});
}
并通过以下方式检索:
Meteor.user().profile
我使用 Meteor.accounts 和 MS Azure 进行了 SAML 登录。我正在使用这个 https://github.com/steffow/meteor-accounts-saml library for SAML which is derived from https://github.com/bergie/passport-saml
程序是这样的:
- 单击 saml 登录 -> 出现弹出窗口
- 在弹出窗口中输入 user/pw 数据 -> 弹出窗口无错误关闭
- 登录成功
所以现在我想获取 SAML 令牌以进行进一步处理(或者至少是 meteor 从 IDP 获取的有关登录用户的信息)。
由于我不知道 SAML 令牌由 Meteor 存储在哪里或可以在代码中获取,有人可以帮我获得 SAML 响应吗?
现在可能已经解决了,但是就这样.. 根据代码,在第 70 行的 "saml_server.js" 中检索到 saml 响应,令牌也应该在其中 (loginRequest.credentialToken) loginResult 应该很容易保存到 Meteor.users 集合
var loginResult = Accounts.saml.retrieveCredential(loginRequest.credentialToken);
var email = loginResult.profile.email;
var user = Meteor.users.findOne({username: email});
if (!user) {
Accounts.createUser({
"username": email,
"profile": StufffromloginResult
});
} else {
Meteor.users.update(
{
"username": email
},
{ "$set": {
"profile": StufffromloginResult,
}
});
}
并通过以下方式检索:
Meteor.user().profile