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.

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


Merb::Authentication.activate!(:default_password_form)
Merb::Authentication.activate!(:default_openid)

class MyApiLogin < ::Merb::Authentication::Strategy
  def run!
    # check for api login
  end
end

So far there are:

  • :default_password_form
  • :default_basic_auth
  • :default_openid

“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.


  require 'merb-auth-more/mixins/salted_user'
  
  class User
    include Merb::Authentication::Mixins::SaltedUser
    
  end

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