【问题标题】:Implementing a SSO endpoint in Meteor在 Meteor 中实现 SSO 端点
【发布时间】:2014-05-06 05:50:40
【问题描述】:

似乎需要使用iron-router(或类似的)来创建端点路由。这当然不应该在客户端完成;但我不确定如何实现此服务器端,因为您无法检查用户是否已登录(Meteor 报告 Meteor.userId can only be invoked in method calls):

this.route('sso', {
  where: 'server',
  path: '/sso',
  onBeforeAction: function() {
    if (Meteor.user()) {
      this.redirect('endpoint url');
    }
  }
});

在 Meteor 中实现端点单点登录的最佳方法是什么?

【问题讨论】:

    标签: meteor single-sign-on


    【解决方案1】:

    在 Meteor 中,这实际上是在应用加载后在客户端上处理的,因此“查询字符串不会通过 HTTP 请求通过网络发送”。

    查看用于处理密码重置和电子邮件验证的 Meteor 代码,了解它是如何完成的:

    https://github.com/meteor/meteor/blob/devel/packages/accounts-base/url_client.js

    这是更广泛的accounts-base 包的一部分,Meteor 的用户帐户系统:

    https://github.com/meteor/meteor/tree/devel/packages/accounts-base

    【讨论】:

    • 非常感谢,这正是我想要的。抱歉这么久才接受!
    猜你喜欢
    • 1970-01-01
    • 2011-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多