module MasterApiKey::ApiGatekeeper
Public Instance Methods
api_group()
click to toggle source
# File lib/master_api_key/api_gatekeeper.rb, line 24 def api_group nil end
Protected Instance Methods
on_authentication_failure()
click to toggle source
# File lib/master_api_key/api_gatekeeper.rb, line 54 def on_authentication_failure head(:unauthorized) end
on_forbidden_request()
click to toggle source
# File lib/master_api_key/api_gatekeeper.rb, line 58 def on_forbidden_request head(:forbidden) end
Private Instance Methods
api_token()
click to toggle source
# File lib/master_api_key/api_gatekeeper.rb, line 94 def api_token header('X-API-TOKEN') end
header(header)
click to toggle source
# File lib/master_api_key/api_gatekeeper.rb, line 98 def header(header) request.headers[header] end
user_api_key()
click to toggle source
# File lib/master_api_key/api_gatekeeper.rb, line 90 def user_api_key @api_key.present? ? @api_key : (@api_key = MasterApiKey::ApiKey.find_by_api_token(api_token)) end
user_authenticated?()
click to toggle source
# File lib/master_api_key/api_gatekeeper.rb, line 86 def user_authenticated? api_token.present? and user_api_key.present? end