# File lib/merb-auth-core/authentication.rb, line 69
    def authenticate!(request, params, *rest)
      opts = rest.last.kind_of?(Hash) ? rest.pop : {}
      rest = rest.flatten
      
      strategies = if rest.empty?
        if request.session[:authentication_strategies] 
          request.session[:authentication_strategies]
        else
          Merb::Authentication.default_strategy_order
        end
      else
        request.session[:authentication_strategies] ||= []
        request.session[:authentication_strategies] << rest
        request.session[:authentication_strategies].flatten!.uniq!
        request.session[:authentication_strategies]
      end
    
      msg = opts[:message] || error_message
      user = nil    
      # This one should find the first one that matches.  It should not run antother
      strategies.detect do |s|
        s = Merb::Authentication.lookup_strategy[s] # Get the strategy from string or class
        unless s.abstract?
          strategy = s.new(request, params)
          user = strategy.run! 
          if strategy.halted?
            self.headers, self.status, self.body = [strategy.headers, strategy.status, strategy.body]
            halt!
            return
          end
          user
        end
      end
      
      # Check after callbacks to make sure the user is still cool
      user = run_after_authentication_callbacks(user, request, params) if user
      
      # Finally, Raise an error if there is no user found, or set it in the session if there is.
      raise Merb::Controller::Unauthenticated, msg unless user
      session[:authentication_strategies] = nil # clear the session of Failed Strategies if login is successful      
      self.user = user
    end