module Grape::Middleware::Auth::DSL
Public Instance Methods
Source
# File lib/grape/middleware/auth/dsl.rb, line 7 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
Source
# File lib/grape/middleware/auth/dsl.rb, line 20 def http_basic(options = {}, &block) options[:realm] ||= 'API Authorization' auth :http_basic, options, &block 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.
Source
# File lib/grape/middleware/auth/dsl.rb, line 25 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