README

Path: examples/README
Last Update: Mon Jun 11 14:31:42 -0700 2007

This directory contains several examples that demonstrate use of the OpenID library. Make sure you have properly installed the library before running the examples. These examples are a great place to start in integrating OpenID into your application.

consumer.rb

consumer.rb runs a simple web server (WEBrick) and will verify OpenID identities. To test this out you‘ll need a valid OpenID URL and to run:

 ruby consumer.rb

Point your browser at localhost:2000/ and follow the instructions.

Rails consumer example

This example is functionally a clone of consumer.rb but uses the Ruby on Rails web framework. To run the example you‘ll need the latest version of rails installed.

 cd rails_consumer
 ./script/server

Open a web browser and go to localhost:3000/ and follow the instructions.

Rails server example

The rails_server contains a fully functions OpenID server, and acts as a starting point for implementing your own production rails server. You‘ll need the latest version of Ruby on Rails installed, and then:

 cd rails_server
 ./script/server

Open a web browser to localhost:3000/ and follow the instructions.

Rails OpenIDLoginGenerator

A port of the standard LoginGenerator OpenID authentication instead of passwords. Use this generator as a starting point for your OpenID enabled rails app.

You can read about LoginGenerator at wiki.rubyonrails.com/rails/pages/LoginGenerator

Running the generator

  • Copy the contents of rails_openid_login_generator into ~/.rails/generators/openid_login
  • run script/generate openid_login Openid

You will now have an openid_controller.rb in app/controllers. For more information see the USAGE and README in the rails_openid_login_generator directory.

You can check out the running code by doing a ./script/server and browsing to localhost:3000/auth/login

Rails ActiveRecord OpenIDStore example

For various reasons you may want or need to deploy your ruby openid consumer/server using an SQL based store. The README and code in the rails_active_record_store example explain in detail how this can be done.

[Validate]