Module: SocialStream::Oauth2Server::Controllers::Helpers
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/social_stream/oauth2_server/controllers/helpers.rb
Overview
Common methods added to ApplicationController
Instance Method Summary collapse
- #authenticate_user!(opts = {}) ⇒ Object
- #current_from_oauth_token(type) ⇒ Object
- #current_subject ⇒ Object
- #current_user ⇒ Object
- #oauth2_token ⇒ Object
- #oauth2_token? ⇒ Boolean
Instance Method Details
#authenticate_user!(opts = {}) ⇒ Object
8 9 10 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 8 def authenticate_user!(opts = {}) oauth2_token? || super end |
#current_from_oauth_token(type) ⇒ Object
22 23 24 25 26 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 22 def current_from_oauth_token(type) return unless oauth2_token? oauth2_token.__send__(type) end |
#current_subject ⇒ Object
12 13 14 15 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 12 def current_subject @current_subject ||= current_from_oauth_token(:client) || super end |
#current_user ⇒ Object
17 18 19 20 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 17 def current_user @current_user ||= current_from_oauth_token(:user) || super end |
#oauth2_token ⇒ Object
28 29 30 31 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 28 def oauth2_token @oauth2_token ||= request.env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN] end |
#oauth2_token? ⇒ Boolean
33 34 35 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 33 def oauth2_token? oauth2_token.present? end |