Sha256: 5abb4b2a096f3a511587ab5743f295b9bf6eb7fbb94d5106859fa13531ac3f48

Contents?: true

Size: 294 Bytes

Versions: 4

Compression:

Stored size: 294 Bytes

Contents

module Oa2c
  class Middleware < Rack::OAuth2::Server::Resource::Bearer
    def initialize(app, realm = nil, &block)
      block ||= proc { |req|
        Oa2c::AccessToken.valid.where(token: req.access_token).first || req.invalid_token!
      }
      super app, realm, &block
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oa2c-0.1.2 lib/oa2c/middleware.rb
oa2c-0.1.1 lib/oa2c/middleware.rb
oa2c-0.1.0 lib/oa2c/middleware.rb
oa2c-0.0.2 lib/oa2c/middleware.rb