Module: G5AuthenticatableApi::Helpers::Grape
- Defined in:
- lib/g5_authenticatable_api/helpers/grape.rb
Overview
Helper methods for securing a Grape API
Instance Method Summary collapse
- #access_token ⇒ Object
- #authenticate_user! ⇒ Object
- #current_user ⇒ Object
- #request ⇒ Object
- #token_data ⇒ Object
- #warden ⇒ Object
Instance Method Details
#access_token ⇒ Object
22 23 24 |
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 22 def access_token @access_token ||= token_info.access_token end |
#authenticate_user! ⇒ Object
10 11 12 |
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 10 def authenticate_user! raise_auth_error unless token_validator.valid? end |
#current_user ⇒ Object
18 19 20 |
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 18 def current_user @current_user ||= user_fetcher.current_user end |
#request ⇒ Object
30 31 32 |
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 30 def request Rack::Request.new(env) end |
#token_data ⇒ Object
14 15 16 |
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 14 def token_data @token_data ||= token_info.token_data end |
#warden ⇒ Object
26 27 28 |
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 26 def warden env['warden'] end |