Ruby on Rails + WebORB +真实逻辑 +柔性

发布于 2024-08-14 07:26:08 字数 500 浏览 5 评论 0原文

我正在开发一个使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

围归者 2024-08-21 07:26:08

我现在在 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

原来是傀儡 2024-08-21 07:26:08

我对 Flex 不熟悉,但您似乎正在寻找远程身份验证器。以下是一些想法:

  1. 确保用户可以在 Rails 端“登录”,并且所有这些功能都可以正常工作。您可能想从 http://github.com/binarylogic/authlogic_example 开始,这是一个真正的良好的起点。

  2. 通过一个操作创建一个“TestController”:#logged_in,它仅根据您是否登录来打印“是”或“否”。然后在浏览器中输入 - http://localhost:3000/test/logged_in,然后查看它说了什么。然后您可以在 Flex 应用程序中尝试相同的操作。

    类 TestController <应用控制器
      def 登录
        渲染:文本=>当前用户? '是' : '否'
      结尾
    结尾
    
  3. 在您的应用程序中添加一个调试器,检查他们是否已登录,并找出原因。它通常与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:

  1. 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.

  2. 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.

    class TestController < ApplicationController
      def logged_in
        render :text => current_user ? 'yes' : 'no'
      end
    end
    
  3. 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文