Module: Rack::OAuth2::Rails::Helpers

Defined in:
lib/rack/oauth2/rails.rb

Overview

Helper methods available to controller instance and views.

Instance Method Summary collapse

Instance Method Details

#oauthServer::Helper

Returns the OAuth helper.

Returns:



53
54
55
# File 'lib/rack/oauth2/rails.rb', line 53

def oauth
  @oauth ||= Rack::OAuth2::Server::Helper.new(request, response)
end

#oauth_requiredObject

Filter that denies access if the request is not authenticated. If you do not specify a scope, the class method oauth_required will use this filter; you can set the filter in a parent class and skip it in child classes that need special handling.



61
62
63
# File 'lib/rack/oauth2/rails.rb', line 61

def oauth_required
  head oauth.no_access! unless oauth.authenticated?
end