Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

jeffkreeftmeijer/guestlist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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