ActiveRecord Store driver for ruby-openid (rails plugin)
In the beginning I thought using as little libraries as possible and was going to write a driver for mysql. Instead I opted for active-record. this trade gave this plugin the capability of accessing various databases and abstract details away from what this plugin really is suppose to do.
Who should use this?
By using this plugin you can now sync your cluster and make sure all openid transactions are being redirected to the right place.
If your server is an independent machine you'll probably don't need this unless you really, really want the openid transactions to live in your database
Reliability === Tests
How well tested is this library?
All tests found in this plugin are an exact-copy of the ones found in the original ruby-openid library. By doing that this plugin certifies that at least that-minimum-coverage is being supported
Note: only tests concerning the store-drivers where copied
Support for other test-frameworks, well.. if your thinking BDD the only thing I have to say is that an experienced programmer should be able to do BDD with almost any testing-framework, BDD is not in the framework but in how you code. and trully a lot of smart BDDing is achieved by refactoring
This plugin is compatible with the rails default-testing-engine. If what you want to do is to test if the plugin works. Then it should pass the tests right out of the box.
If your using another testing-framework then create a brand-new rails-app and run the plugin tests (see the known bugs section)
The ActiveRecord Sqlite driver does not escape properly and it fails to insert data sometimes depending on the complexity of the cryptography that is generated by the ruby-openid gem
So until that problem is fixed or someone decides to patch up this plugin and sanitize stuff before they are handled to active record I wouldn't recomend it for production use.
Install the plugin Note: (this will add two migrations and three models to your application) $ ./script/plugin install git://github.com/ktlacaelel/openid_active_recod_store.git
Migrate $ rake db:migrate
Setup pass the store object to the openid consumer store = OpenID::Store::ActiveRecord.new OpenID::Consumer.new(session, store)
If you are using an authentication plugin for openid you might have to patch that code yourself and tell it to use this storage-driver.
Specifics could be very different depending on how you have it set it up. basically the (number 3) is all you need to know and twick to get it to work.
I personally recomend that you implement your own openid athentication system.
There is an abstract parent model for the openid models in this distribution so if you want to store all of your openid transactions in another database you only need to add a line like this.
class OpenidAbstract < ActiveRecord::Base # Append this line, and edit the corresponding configuration in your # (config/database.yml) file # Note: do this by creating a new model with the same name in your # app and simply overload, so if you need plugin updates you dont # need to repatch anything. establish_connection(:openid_active_record_store) def self.abstract_class? true end end
- Rails 2.3.2
Works on / tested under
- ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
- Rails 2.3.2
Copyright (c) 2009 [Kazuyoshi Tlacaelel], released under the MIT license