Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Simple user authentication using Github credentials
branch: develop

This branch is even with jeffkreeftmeijer:develop

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
LICENCE
README.textile
guestlist.gemspec

README.textile

Guestlist

Simple authentication using Github credentials.

Installation

The installation is really simple, just throw this in your Gemfile:

gem 'guestlist'

And run:

bundle install

Or — if you’re using Rails 2.x — put this in config/environment.rb:

config.gem 'guestlist'

And run:

rake gems:install

Include Guestlist in your user model (mine is called User):

class User
  # It works with ActiveRecord too. ;)
  include MongoMapper::Document
  include Guestlist

  key :login,           String
  key :encrypted_token, String
end

Make sure you have both login and encrypted_token fields in your database if you’re using ActiveRecord (here’s a migration), or add some keys to your MongoMapper model like in the example above.

Believe it or not, you’re all set. Let’s try it (you can find your token on the Github account page):

User.authenticate 'github_login', 'github_token'

Guestlist will automatically create a new User for you and return that, or false if you’ve entered a wrong login or token. The user’s token is stored — yes, encrypted — , so next time you log in, it’ll just authenticate you via the database.

Contributing

Found any issues? Have a great idea? Want to help? Great! Create an issue issue for it, or even better; fork the project. Pull requests are always welcome. :)

License

Copyright © 2009 Jeff Kreeftmeijer, released under the MIT license

Something went wrong with that request. Please try again.