我在使用Authlogic进行OpenId身份验证时遇到了困难。似乎问题出现在open_id_authentication插件的更改中。从我到目前为止所读到的,人们需要从使用宝石切换到使用插件。
到目前为止,我所做的是让Authlogic-OpenID集成工作:
Mogrel未能启动,返回以下错误:
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- rack/openid (MissingSourceFile)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/plugins/open_id_authentication/lib/open_id_authentication.rb:3
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/plugins/open_id_authentication/init.rb:5:in `evaluate_init_rb'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:146:in `evaluate_init_rb'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:142:in `evaluate_init_rb'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:48:in `load'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:38:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `each'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:348:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:163:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /Users/craibuc/NetBeansProjects/authlogic_example/config/environment.rb:13
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/railties/lib/commands/server.rb:84
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
我怀疑这与rack-openid宝石有关,但由于它依赖于ruby-openid宝石,所以当去掉ruby-openid宝石时它会被移除。也许这可以作为插件安装。
非常感谢对此事的任何帮助 - 我即将放弃OpenId集成。
* ruby-openid(2.1.2)安装在/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8。我不确定这是否会影响任何事情。在任何情况下,我都不确定如何卸载它或我是否应该。
**编辑**
似乎/Library/Ruby/Gems/1.8/gems目录中有许多宝石可能导致问题:
问题: - 为什么gem list命令没有列出这些宝石? - 为什么gem uninstall命令没有删除这些宝石?
答案 0 :(得分:3)
我刚刚遇到同样的问题,但修复了安装机架openid宝石的问题。 我会要求他们在文档
上添加rack-openid到所需的库答案 1 :(得分:3)
我和你一样经历过同样的麻烦。 也许你应该检查一下,让一切正常:
http://github.com/shripadk/authlogic_openid_selector_example
这包括像openid自动注册一样的stackoverflow。我已经在heroku上托管了一个示例应用程序,如果你愿意,可以在结帐前试用。
答案 2 :(得分:0)
不确定OSX上的工作原理,但在Linux中,如果我将gems作为普通用户安装,则会将其放入我的主目录,如果我使用sudo
安装它们,则会进入系统目录。
我也遇到了gems的权限问题,并且必须在我的shell中明确设置GEM_PATH
以使ruby从特定位置加载gem。
sudo gem list
?/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
?修改强>:
好的,我会启动一个irb
会话,看看明确require
宝石时会发生什么。
$ irb
> require 'authlogic'
> require 'authlogic-oid'
...
修改强>
如果安装了authlogic-oid
gem,并在运行sudo gem list
时显示,请尝试以超级用户身份启动irb
。如果您可以要求authlogic-oid
,则存在权限问题:部分或全部gem文件只读root。
如果这不起作用,您可能会遇到负载路径问题 - ruby对于在哪里查找已安装的宝石感到困惑。在这种情况下,您的authlogic
gem可能安装在authlogic-oid
gem的不同位置。