Ruby on Rails + WebORB +真实逻辑 +柔性
我正在开发一个使用 authlogic 进行身份验证的 Rails 项目。我参与了该项目,该项目是通过 Flex 实现的,我需要知道如何对用户进行身份验证,无论他或她是否登录。
我已经设置了一个名为 UserSessionService
的 Web 服务,并且尝试获取已登录的用户,但它不起作用。如果我尝试使用 UserSession.find 获取它,我只会得到一个 # 作为结果(因此这总是正确的)。
这是 UserSessionService.rb:
require 'weborb/context'
require 'rbconfig'
class UserSessionService
def login
UserSession.find
end
end
我尝试从 Authlogic::Session::Base
扩展 UserSessionService
类,但这也不起作用。
I'm developing a Rails project that uses authlogic for authentication. And I have a part in that project that is realized with Flex, and I need to know how a user can be authenticated if he or she is logged in or not.
I've set up a webservice called UserSessionService
and I was trying to get the user who is logged in, but it doesn't work. If I try to get it with UserSession.find
, I just get a # as the result (and therefore that's always true).
Here's the UserSessionService.rb:
require 'weborb/context'
require 'rbconfig'
class UserSessionService
def login
UserSession.find
end
end
I tried to extend the UserSessionService
class from Authlogic::Session::Base
, but that doesn't work either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我现在在 Flex 中使用额外的 HTTPService 来访问 UserSessions 控制器中的函数。欲了解更多详情,请查看
http://blog.sketchit.de /2009/12/flex-mit-ruby-on-rails-authlogic-authenitifizieren/(抱歉,只有德语)
谢谢您的帮助!
无尾礼服
I've made it now with an extra HTTPService in Flex that accesses a function in the UserSessions Controller. For more details, look at
http://blog.sketchit.de/2009/12/flex-mit-ruby-on-rails-authlogic-authenitifizieren/ (sorry, only in german)
thx for your help!
tux
我对 Flex 不熟悉,但您似乎正在寻找远程身份验证器。以下是一些想法:
确保用户可以在 Rails 端“登录”,并且所有这些功能都可以正常工作。您可能想从 http://github.com/binarylogic/authlogic_example 开始,这是一个真正的良好的起点。
通过一个操作创建一个“TestController”:#logged_in,它仅根据您是否登录来打印“是”或“否”。然后在浏览器中输入 - http://localhost:3000/test/logged_in,然后查看它说了什么。然后您可以在 Flex 应用程序中尝试相同的操作。
在您的应用程序中添加一个调试器,检查他们是否已登录,并找出原因。它通常与cookie有关。请参阅 http://guides.rubyonrails.org/debugging_rails_applications.html 了解如何在 Rails 中进行调试.
请让我知道进展如何!
I'm not familiar with Flex, but it seems you're looking for a remote authenticator. Here are some ideas:
Make sure a user can "log in" on the Rails side, and all of that functionality works. You may want to start with http://github.com/binarylogic/authlogic_example, which is a really good starting place.
Make a "TestController" with one action: #logged_in, which just prints "yes" or "no" based on whether you're logged in or not. Then go hit that in a browser - http://localhost:3000/test/logged_in, and see what it says. Then you can try the same in your Flex app.
Throw up a debugger in your app where it checks whether they're logged in, and figure out why not. It's usually related to cookies. See http://guides.rubyonrails.org/debugging_rails_applications.html for how to debug in Rails.
Please let me know how it goes!