通过PHP和Ruby on Rails应用程序之间的身份验证 [英] Pass authentication between php and Ruby On Rails application

查看:139
本文介绍了通过PHP和Ruby on Rails应用程序之间的身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的Ruby on Rails应用程序,我想与现有的PHP网站集成。我只想说谁是被认证的PHP应用程序将有机会获得我的Ruby on Rails应用的用户(它应该出现以用户为同一网站,在同一个域中,尽管它可以是一个不同的子域,如果我选择至)
什么是做到这一点的最好办法?

I have a simple Ruby on rails application that I want to integrate with an existing php website. I only want that users who's been authenticated by the php application would have access to my Ruby on Rails application (it should appear to the user as the same website, in the same domain, though it can be a different sub-domain if I chose to) What's the best way to do that?

感谢您的帮助,

推荐答案

要保持登录用户最常用的方法是存储像 current_user_id:777 在用户的会话。因此,easyest方式是将Rails应用程序和PHP应用程序之间共享会话。然后,您必须使用相同的约定来存储的登录用户的身份。

The most common way to keep a user logged in is to store something like current_user_id:777 in the user's session. Therefore, the easyest way is to share the session between the Rails app and the PHP app. Then, you must use the same convention to store the identity of a logged in user.

做到这一点的方法是使用memcached的作为会议的支持。

A way to do this is to use memcached as the session support.

这种方法的问题:你可以设置/读取相同的会话变量,从两个应用程序在同一时间(但它可以被避免)

Problems with this approach: you could set/read the same session variable in the same time from both apps (but it can be avoided).

参考文献:

使用memcached的存储你的PHP会话

Usind内存缓存为轨道会话存储

这篇关于通过PHP和Ruby on Rails应用程序之间的身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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