Meteor帐户获取SAML响应(登录后的令牌/用户)

时间:2016-10-24 07:49:04

标签: authentication meteor authorization saml-2.0

我在使用Meteor.accounts和MS Azure进行SAML登录。我将此https://github.com/steffow/meteor-accounts-saml库用于SAML,该库源自https://github.com/bergie/passport-saml

程序如下:

  1. 点击saml登录 - >弹出窗口
  2. 在弹出窗口中输入用户/ pw数据 - >弹出窗口关闭而没有错误
  3. 登录成功
  4. 所以现在我想获得进一步处理的SAML令牌(或者至少是关于meteor从IDP获取的登录用户的信息)。

    由于我不知道Meteor存储SAML令牌或者可以在代码中获取SAML令牌,有人可以帮助我获取SAML响应吗?

1 个答案:

答案 0 :(得分:2)

现在可能已经解决但是在这里...... 根据代码,在" saml_server.js"中检索saml响应。在第70行,令牌也应该在那里(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