Class: OAuth2::Provider::Rails::ControllerAuthentication::ClassMethods::AuthenticationFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/oauth2/provider/rails/controller_authentication.rb

Instance Method Summary collapse

Constructor Details

#initialize(scope = nil) ⇒ AuthenticationFilter

Returns a new instance of AuthenticationFilter.



12
13
14
# File 'lib/oauth2/provider/rails/controller_authentication.rb', line 12

def initialize(scope = nil)
  @scope = scope
end

Instance Method Details

#filter(controller, &block) ⇒ Object



16
17
18
# File 'lib/oauth2/provider/rails/controller_authentication.rb', line 16

def filter(controller, &block)
  controller.request.env['oauth2'].authenticate_request! :scope => @scope, &block
end