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
24 25 26 27 28 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 24 def current_from_oauth_token(type) return unless oauth2_token? oauth2_token.__send__(type) end |
#current_subject ⇒ Object
12 13 14 15 16 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 12 def current_subject super || @current_subject ||= current_from_oauth_token(:client) end |
#current_user ⇒ Object
18 19 20 21 22 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 18 def current_user super || @current_user ||= current_from_oauth_token(:user) end |
#oauth2_token ⇒ Object
30 31 32 33 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 30 def oauth2_token @oauth2_token ||= request.env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN] end |
#oauth2_token? ⇒ Boolean
35 36 37 |
# File 'lib/social_stream/oauth2_server/controllers/helpers.rb', line 35 def oauth2_token? oauth2_token.present? end |