Class/Module Index [+]

Quicksearch

Grape::Middleware::Auth::DSL

Public Instance Methods

auth(type = nil, options = {}, &block) click to toggle source

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
http_basic(options = {}, &block) click to toggle source

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
http_digest(options = {}, &block) click to toggle source
# File lib/grape/middleware/auth/dsl.rb, line 27
def http_digest(options = {}, &block)
  options[:realm] ||= "API Authorization"
  options[:opaque] ||= "secret"
  auth :http_digest, options, &block
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.