使用不同应用程序的单一登录方式在轨道上使用ruby [英] Single logon with different applications approach ruby on rails

查看:116
本文介绍了使用不同应用程序的单一登录方式在轨道上使用ruby的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下情况下,最好的方法是什么:

What would be the best approach in the following situation:


  • 处理用户认证(主要是Devise)的主要应用程序。 li>
  • 可以访问用户数据库进行单一登录的几个不同的应用程序。

  • 用户数据的同步(首选项,配置文件数据)

方案示例:


  • 应用程序A的用户注册

  • 用户可以使用相同的凭据访问应用程序B(但必须明确确认新协议,然后才能使用应用程序B)

推荐答案

首先,所有的应用都需要访问用户数据库,所以用户只需要注册一次。您可以使用属性或关系来检查用户是否已确认不同应用程序的协议。

First of all, all the apps need to have access to the users database, so the users only need to register once. You can have an attribute or relation to check if the user has confirmed agreements for different apps.

为使所有应用只能使用一次登录,您可以使用相同的所有应用程序的会话存储。

For making all the apps accesible with only one login, you can use the same session store for all the apps.

例如,您可以为会话存储使用memcached,并在所有应用程序中使用相同的会话存储键。如果用户在一个应用程序中登录,当他在不关闭会话的情况下转到另一个应用程序时,此应用程序可以检查会话是否已创建,用户可以在没有登录的情况下输入新应用。

For example you can use memcached for the session store and use the same session store key in all the apps. If the user makes login in one app, when he goes to another app without closing the session, this app can check that the session has been created and the user can enter in the new app whithout login in.

使用此解决方案,您需要注意会话数据,因此一个应用的数据与其他应用的数据不重叠。

With this solution you need to be careful with the session data, so the data of one app doesn't overlap the data of other app.

这篇关于使用不同应用程序的单一登录方式在轨道上使用ruby的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆