Module: Merb::AuthenticatedHelper

Module | Merb::AuthenticatedHelper
In: | lib/merb-auth-core/authenticated_helper.rb

### Methods

ensure_authenticated

### Protected Instance methods

ensure_authenticated(*strategies)

This is the main method to use as a before filter. You can call it with options and strategies to use. It will check if a user is logged in, and failing that will run through either specified.

@params all are optional. A list of strategies, optionally followed by a options hash.

If used with no options, or only the hash, the default strategies will be used see Authentictaion.default_strategy_order.

If a list of strategies is passed in, the default strategies are ignored, and the passed in strategies are used in order until either one is found, or all fail.

A failed login will result in an Unauthenticated exception being raised.

Use the :message key in the options hash to pass in a failure message to the exception.

### Example

       class MyController < Application
         before :ensure_authenticated, :with => [OpenID,FormPassword, :message => "Failz!"]
          #... <snip>
       end

[Validate]