Sha256: eaa619c76353647b78575d1e53d75d88bd09ad15a032e515040e70aae227163a
Contents?: true
Size: 681 Bytes
Versions: 1
Compression:
Stored size: 681 Bytes
Contents
require 'g5_authenticatable_api/token_validator' module G5AuthenticatableApi module Helpers module Grape def authenticate_user! raise_auth_error if !(warden.try(:authenticated?) || token_validator.valid?) end def warden env['warden'] end private def token_validator request = Rack::Request.new(env) @token_validator ||= TokenValidator.new(request.params, headers) end def raise_auth_error throw :error, message: 'Unauthorized', status: 401, headers: {'WWW-Authenticate' => token_validator.auth_response_header} end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
g5_authenticatable_api-0.2.0 | lib/g5_authenticatable_api/helpers/grape.rb |