module Grape::Middleware::Auth::DSL::ClassMethods
def auth(type = nil, options = {}, &block)
Add an authentication type to the API. Currently
def auth(type = nil, options = {}, &block) if type namespace_inheritable(:auth, options.reverse_merge(type: type.to_sym, proc: block)) use Grape::Middleware::Auth::Base, namespace_inheritable(:auth) else namespace_inheritable(:auth) end end
def http_basic(options = {}, &block)
(**options)
-
:realm
(String
) -- "API Authorization" The HTTP Basic realm.
Parameters:
-
options
(Hash
) -- A hash of options.
def http_basic(options = {}, &block) options[:realm] ||= 'API Authorization' auth :http_basic, options, &block end
def http_digest(options = {}, &block)
def http_digest(options = {}, &block) options[:realm] ||= 'API Authorization' if options[:realm].respond_to?(:values_at) options[:realm][:opaque] ||= 'secret' else options[:opaque] ||= 'secret' end auth :http_digest, options, &block end