Class: Simple::OAuth2::Resource::Bearer

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_oauth2/resource/bearer.rb

Overview

OAuth2 middleware Protected Resource Endpoint

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Bearer

Returns a new instance of Bearer.



6
7
8
# File 'lib/simple_oauth2/resource/bearer.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
# File 'lib/simple_oauth2/resource/bearer.rb', line 11

def call(env)
  app = Rack::OAuth2::Server::Resource::Bearer.new(@app, Simple::OAuth2.config.realm) do |req|
    Simple::OAuth2.config.token_authenticator.call(req)
  end
  app.call(env)
end