Add an authentication type to the API. Currently only `:http_basic`, `:http_digest` are supported.
# File lib/grape/middleware/auth/dsl.rb, line 9 def auth(type = nil, options = {}, &block) if type set(:auth, { type: type.to_sym, proc: block }.merge(options)) use Grape::Middleware::Auth::Base, settings[:auth] else settings[:auth] end end
Add HTTP Basic authorization to the API.
@param [Hash] options A hash of options. @option options [String] :realm “API Authorization” The HTTP Basic realm.
# File lib/grape/middleware/auth/dsl.rb, line 22 def http_basic(options = {}, &block) options[:realm] ||= "API Authorization" auth :http_basic, options, &block end
Generated with the Darkfish Rdoc Generator 2.