File: router_helper.rb

# router_helper.rb

Path: | lib/merb-auth-core/router_helper.rb
Last Update: | Tue Aug 17 16:01:28 -0600 2010

### Methods

authenticate

### Public Instance methods

authenticate(*strategies, &block)

Use this method in your router to ensure that the user is authenticated

This will run through any strategies that you have setup, or that you declare as an argument to the authenticate method.

### Example

       authenticate(OpenID) do
          resource :posts

          authenticate do
            match("/").to(:controller => "home")
          end
       end

This is a simple example that shows protecting the entire set of routes for the posts resource with the OpenID strategy.

The match on "/" is protected, first by the OpenID strategy, then by the dfeeault set of stratgies. Strategies are applied from the outer block first, working to the inner blocks.

[Validate]