Authlogic OpenID integration

Posted by Craig on Stack Overflow See other posts from Stack Overflow or by Craig
Published on 2010-05-19T16:05:55Z Indexed on 2010/05/19 16:30 UTC
Read the original article Hit count: 322

Filed under:
|
|

I'm having difficulty getting OpenId authentication working with Authlogic. It appears that the problem arose with changes to the open_id_authentication plugin. From what I've read so far, one needs to switch from using gems to using plugins.

Here's what I done thus far to get Authlogic-OpenID integration working:

  1. Removed relevant gems:
    • authlogic
    • authlogic-oid
    • rack-openid
    • ruby-openid *
    • Installed, configured, and started the authlogic sample application (http://github.com/binarylogic/authlogic_example)--works as expected. This required:
    • installing the authlogic (2.1.3) gem ($ sudo gem install authlogic)
    • adding a dependency (config.gem "authlogic") to the environment.rb file.
    • added migration to add open-id support to User model; ran migration; columns added as expected
    • made changes to the UsersController and UserSessionsController to use blocks to save each.
    • made changes to new user-sessions view to support open id (f.text_field :openid_identifier)
    • installed open_id_authentication plugin ($ script/plugin install git://github.com/rails/open_id_authentication.git)
    • installed the authlogic-oid plugin ($ script/plugin install git://github.com/binarylogic/authlogic_openid.git)
    • installed the plugin ($ script/plugin install git://github.com/glebm/ruby-openid.git)
    • restarted mongrel (CTRL-C; $ script/server)

Mogrel failed to start, returning the following error:

/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

I suspect this is related the rack-openid gem, but as it was dependent upon the ruby-openid gem, it was removed when the ruby-openid gem was removed. Perhaps this can be installed as a plugin.

Any assistance with this matter is greatly appreciated--I'm just about to give up on OpenId integration.

* ruby-openid (2.1.2) is installed at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8. I'm not certain if this is affecting anything. In any case, I'm not sure how to uninstall it or if I should.

** edit **

It appears that there are a number of gems in the /Library/Ruby/Gems/1.8/gems directory that may be causing an issue:

  • authlogic-oid (1.0.4)
  • rack-openid (1.0.3)
  • ruby-openid (2.1.7)

Questions: - why doesn't the gem list command list these gems? - Why doesn't the gem uninstall command remove these gems?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about authlogic