def authorized?(options = {})
      raise "Configuration values not found. Please run rails g restful_api_authentication:install to generate a config file." if @@header_timestamp.nil? || @@header_signature.nil? || @@header_api_key.nil? || @@time_window.nil? || @@disabled_message.nil?
      return_val = false
      if headers_have_values?
        if in_time_window?
          if test_hash.downcase == @http_headers[@@header_signature].downcase
            if is_disabled?
              @errors << @@disabled_message
              return false
            end
            if options[:require_master] == true
              if is_master?
                return_val = true
              else
                @errors << "client does not have the required permissions"
              end
            else
              return_val = true
            end
          else
            @errors << "signature is invalid"
          end
        else
          @errors << "request is outside the required time window of #{@@time_window.to_s} minutes"
        end
      else
        @errors << "one or more required headers is missing"
      end
      if return_val == false && @errors.count == 0
        @errors << "authentication failed"
      end
      return_val
    end
def authorized?(options = {})
      raise "Configuration values not found. Please run rails g restful_api_authentication:install to generate a config file." if @@header_timestamp.nil? || @@header_signature.nil? || @@header_api_key.nil? || @@time_window.nil? || @@disabled_message.nil?
      return_val = false
      if headers_have_values?
        if in_time_window?
          if test_hash.downcase == @http_headers[@@header_signature].downcase
            if is_disabled?
              @errors << @@disabled_message
              return false
            end
            if options[:require_master] == true
              if is_master?
                return_val = true
              else
                @errors << "client does not have the required permissions"
              end
            else
              return_val = true
            end
          else
            @errors << "signature is invalid"
          end
        else
          @errors << "request is outside the required time window of #{@@time_window.to_s} minutes"
        end
      else
        @errors << "one or more required headers is missing"
      end
      if return_val == false && @errors.count == 0
        @errors << "authentication failed"
      end
      return_val
    end
Checks if the current request passes authorization