Class: Hadley::Middleware

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Authz
Defined in:
lib/hadley/middleware.rb

Overview

This class provides the rack middleware that builds on top of warden to provide the necessary endpoints for a rack application to function as an AFID protected resource.

Instance Method Summary collapse

Methods included from Authz

#warden

Constructor Details

#initialize(app = nil, options = {}) {|@config| ... } ⇒ Middleware

Initializes the middleware with the provided application and options

Parameters:

  • app (Rack::Application) (defaults to: nil)

    The rack application that this middleware is participating in

  • options (Hash) (defaults to: {})

    The Hash of keyword arguments

  • options.store (Hadley::TokenStore)

    The token store to be used for persisting tokens provisioned by the AFID authorization server

Yields:

  • (@config)


13
14
15
16
17
18
19
# File 'lib/hadley/middleware.rb', line 13

def initialize(app=nil, options={})
  super(app)
  @config ||= Hadley::Config.new(options)
  yield @config if block_given?
  @tokens = @config.token_store
  self
end