authlogic 和 oauth-plugin [英] authlogic and oauth-plugin

查看:52
本文介绍了authlogic 和 oauth-plugin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人测试过 - authlogic 是否适用于 oauth-plugin (https://github.com/pelle/oauth-plugin) 与否?

does somebody tested - will authlogic works with oauth-plugin (https://github.com/pelle/oauth-plugin) or not?

推荐答案

简短的回答是.我目前正在将 oauth-plugin 的服务提供商与我自己的身份验证系统(早于 authlogicacts_as_authenticated 和所有其他系统)集成.

The short answer is no. I am currently integrating oauth-plugin's service providership with my own auth system (which predates authlogic, acts_as_authenticated and all the rest).

oauth-plugin 服务提供商通过代码生成器生成两个控制器,然后将它们绑定到插件中的一些库文件中.所有这些文件都需要一个 login_required 类方法,其语义与 acts_as_authenticated 使用的语义相同.

oauth-plugin service providership works by means of a code generator generating two controllers, which are then tied into some library files in the plugin. All of these files expect a login_required class method with the same semantics that acts_as_authenticated uses.

authlogic 根本不对您的控制器做任何假设,因此它不会与 oauth-plugin 一起开箱即用,但是该设计决策也意味着它会以预期的方式构建控制器相当容易.因此,构建一个 shim 来支持 oauth-plugin 应该很容易(也许很简单).

authlogic makes no assumptions about your controllers at all, so it won't work out of the box with oauth-plugin, however that design decision also means it will be fairly easy to structure your controllers in the expected way. Therefore it should be (maybe trivially) easy to build a shim to support oauth-plugin.

但是,在我的情况下,我决定运行生成器,然后从插件中提取我需要的内容并删除插件本身.我这样做的主要原因是我的身份验证系统中明确没有 login_required 方法,因此我必须对 lib 进行猴子修补才能使其工作.其次,插件中有很多我不需要的东西.第三,大部分真正库级的东西已经被抽象到 oauth gem 中,所以 oauth-plugin lib 目录中的东西就在这个奇怪的是,生成的代码和实际的库之间没有任何关系.

However in my case I've decided to run the generator then to extract what I need from the plugin and delete the plugin itself. The primary reason I am doing this is that I explicitly don't have the login_required method in my auth system, so I would have to monkey patch the lib to get it to work. Secondly, there's a lot of stuff in the plugin I just don't need. Thirdly, most of the stuff that is truly library-level has already been abstracted into the oauth gem proper, so the stuff living in the oauth-plugin lib directory is in this weird no mans land between the generated code and the actual library.

这篇关于authlogic 和 oauth-plugin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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