Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brookr/calhawk

Reads casehawk-php events and writes them into casehawk-rails
https://github.com/brookr/calhawk

Last synced: 4 days ago
JSON representation

Reads casehawk-php events and writes them into casehawk-rails

Awesome Lists containing this project

README

        

== Welcome to the OpenID Rails Kit

This kit will help you get a quick start on building new web
applications that need to allow logins via OpenID, as well as with
a standard username/password combination. Running the app as-is
will allow to create accounts and log in to accounts that have
been previously created. The kit even handles Yahoo's OpenID
implementation of passing back to the application a different
identity URL than the user specifies when creating an account.

Most of this kit is made up of the excellent work done by others,
in particular the restful_authentication and
open_id_authentication plugins. I have made minor tweaks here and
there, and added some glue code for account creation, but
otherwise the bulk of what you've received has been generously
provided by others to the community. The new code I have
contributed is released under the MIT License (see the MIT-LICENSE
file for more info).

== Getting Started

This code provides a complete, running Rails application. There
are a few things you need to do to get started, though. First, you
need to have the ruby-openid gem installed (version 2.0.4 is the
latest at the time of this writing):

gem install ruby-openid

Next, you should create your SQLite database and the database
tables with the following rake command on the command line:

rake db:schema:load

After bootstrapping the database, you'll need to make at least one
edit to the code. In config/environment.rb, you need to specify a
new secret for the cookie session storage. Change line 41 of
config/environment.rb, replacing the secret with the one generated
by this command:

rake secret

Once that's done, you are ready to go. Start up the app and browse
to it in your web browser. Create a new account, and you'll be logged in.

== Contents

Hopefully you're familiar enough with the basics of Rails that I
don't have to explain what every file in this archive does. If
not, go read some books like Agile Web Development with Rails and
then come back here. With that out of the way, here are some of
the files you'll want to check out. Basically, the kit is made up
of the files you get from running the generator from the
restful_authentication plugin, with changes made for creating and
authenticating accounts via OpenID.

app/
controllers/
users_controller.rb - The create method has been modified to
check whether OpenID is being used, and if so, stuffs the
parameters submitted from the form into the session so they
can be retrieved when the user returns from the OpenID
provider. Upon returning from the provider, the new user
account is created and the user is logged in.

sessions_controller.rb - Similar to the UsersController, the
create method has been changed to redirect to the OpenID
provider if an OpenID URL was provided, and then loads the
user record based on the identity URL after returning from the
OpenID provider.

models/
user.rb - I have made a few changes here (and related changes
deeper in the plugin code) to allow a User record to validate
without a login and password if OpenID is being used.

== Shameless self-promotion

If you find this code useful, you might also be interested in
other, similar starter applications that can be found at
http://railskits.com/. For example, if you are building a
software-as-a-service Rails application, the SaaS Rails Kit
provides you tried and tested code for recurring billing,
subdomain-based accounts, etc. It will save you a ton of time in
building your next Rails application.