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

Instance Method Details

#access_tokenObject



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_userObject



18
19
20
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 18

def current_user
  @current_user ||= user_fetcher.current_user
end

#requestObject



30
31
32
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 30

def request
  Rack::Request.new(env)
end

#token_dataObject



14
15
16
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 14

def token_data
  @token_data ||= token_info.token_data
end

#wardenObject



26
27
28
# File 'lib/g5_authenticatable_api/helpers/grape.rb', line 26

def warden
  env['warden']
end