github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

wycats / merb

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 478
    • 100
  • Source
  • Commits
  • Network (100)
  • Issues (3)
  • Downloads (25)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • 1.0.x
    • master ✓
  • Tags (25)
    • v0.9.4
    • v0.9.3
    • v0.9.2
    • v0.9.1
    • v0.9.0
    • 1.0.12
    • 1.0.10
    • 1.0.9
    • 1.0.8.1
    • 1.0.8
    • 1.0.7.1
    • 1.0.7
    • 1.0.6.1
    • 1.0.6
    • 1.0.5
    • 1.0.4
    • 1.0.3
    • 1.0.2
    • 1.0.1
    • 1.0
    • 0.9.13
    • 0.9.12
    • 0.9.11
    • 0.9.10
    • 0.9.9
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

master merb branch — Read more

  cancel

http://www.merbivore.com

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Merb development has moved to http://github.com/merb 
snusnu (author)
Fri Oct 30 16:43:41 -0700 2009
commit  b34d3d4fb6da70c2e9e9e56ddccc73f8a3e55e39
tree    70ca0e674ec9d6eec568469a03dc9fb9bd478fe5
parent  604e0fdf4467cacde2d11c8ced491cac56ddc5f1
merb / merb-auth
name age
history
message
..
file .gitignore Wed Oct 08 15:02:26 -0700 2008 Move things to merb-more [wycats]
file LICENSE Wed Oct 08 15:02:26 -0700 2008 Adds the merb-auth meta gem [hassox]
file README.textile Fri Oct 17 15:08:11 -0700 2008 Part of a rebase [hassox]
file Rakefile Fri Oct 31 16:57:25 -0700 2008 Modify the rakefiles to be DRY [wycats]
file TODO Fri Jan 18 11:25:19 -0800 2008 Leftover files [wycats]
directory lib/ Mon Oct 13 03:13:28 -0700 2008 Versions updated in the rake tasks Updates the... [hassox]
directory merb-auth-core/ Tue Oct 06 15:06:18 -0700 2009 [merb-auth-core] Don't depend on extlib, merb-c... [pk]
directory merb-auth-more/ Mon Oct 26 21:50:03 -0700 2009 [merb-auth-more] #redirect_back respects Merb::... [snusnu]
directory merb-auth-slice-password/ Tue Oct 20 17:58:50 -0700 2009 [merb-auth-slice-password] Use proper config va... [snusnu]
merb-auth/README.textile

MerbAuth – Merb Merb::Authentication

An extensible architecture for authentication

  • Speaks fluent HTTP, even the errors
  • Pluggable Architecture (so that you can use any authentication algorithms you like)
  • Cascading Merb::Authentication (if one method fails, another is attempted, then another. When no methods succeed, authentication fails)

Principles

  1. Sessions are authenticated
  2. Just because one method of authentication fails doesn’t mean the session, can’t be authenticated another way. This is especially true if your application has an external API as well as a public interface.
  3. HTTP has built-in Errors which every web-browser (should) know how to speak. If you’re application speaks in HTTP Verbs (GET, POST, PUT, DELETE), it should also serve the correct HTTP Errors when things go wrong.

What is it

The merb-auth gem is the default implementation of merb-auth-core and merb-auth-more for
the default Merb Stack. Included are:

merb-auth-slice-password # A basic slice that provides login and logout functionality

Strategies:
:default_password_form # Form based login via a “login” field and “password” field
:default_basic_auth # Basic authentication

Mixins:
redirect_back # For redirect_back_or functionality
salted_user # Automtaically provides the required methods on your user model

Get merb-auth

merb-auth is bundled with the merb gem. To get it as stand alone you can get it two ways.

Gem Style
sudo gem install merb-auth

From Source


git clone http://github.com/wycats/merb.git
cd merb/merb-auth
sudo rake install

Basic Setup

Application Setup (Stack)

When you generate your application with merb-gen app my_app your almost ready to go.

You’ll need something to protect merb-gen resource foos

You’ll need to make your database: rake db:automigrate

Also you need a user


  $ merb -i
  >> u = User.new(:login => "homer")
  >> u.password = u.password_confirmation = "sekrit"
  >> u.save

No you should setup authentication for the things you want to protect:


  # config/router.rb
  authenticate do
    resources :foos
  end

You can protect your controller at an action level also


  # app/controllers/foos.rb 
  before :ensure_authenticated

Fire It Up!

merb

Customize your setup

In the Merb.root/merb/merb-auth directory there are a couple of files that
are generated for you by the stack generator. These are setup.rb and strategies.rb

By default these setup merb-auth to work with the default stack. To customize it,
modify these two files to get the results you want. Serialize in and out of the session,
change the user model for use with the default strategies.

You can of course not use the default strategies and declare your own, or mix and match them.

Configure your routes in the config/router.rb file.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server