README.textile

Path: README.textile
Last Update: Sun Mar 01 20:42:03 -0700 2009

merb-auth-more

========

merb-auth-more provides stuff that‘s useful, but not core to the functionality of merb-auth. Strategies and "User" object mixins are here.

h3. What Strategies are there?

Strategies are really simple to implement, but we‘ve made some basic ones available.

The built in ones are basic but should be enough to get you going for most things.

To specify them, simply require them. For example,in Merb.root/merb/merb-auth/strategies.rb

<pre><code> Merb::Authentication.activate!(:default_password_form) Merb::Authentication.activate!(:default_openid)

class MyApiLogin < ::Merb::Authentication::Strategy

  def run!
    # check for api login
  end

end </code></pre>

So far there are:

  • :default_password_form
  • :default_basic_auth
  • :default_openid

h3. "User" mixins

To assist with your authenticating needs, there is user mixins available to enhance your user model for basic cases. These really are just for the basic case, so if you need something extra you should overwrite the methods, or implement your requirements.

To use these, require the specific mixin, and then include it into your "User" class.

<pre><code>

  require 'merb-auth-more/mixins/salted_user'

  class User
    include Merb::Authentication::Mixins::SaltedUser

  end

</code></pre>

The salted user mixin provides basic salted SHA1 password authentication. It implements the required User.authenticate method for use with the default password strategies.

[Validate]