Sha256: cf1aa1dfa7aa77dd9870209a7bb1014ca5a3433a63cdad1396f6b0587dc6d091
Contents?: true
Size: 546 Bytes
Versions: 13
Compression:
Stored size: 546 Bytes
Contents
module Shieldify class Middleware class Authentication attr_reader :app def initialize(app) @app = app end def call(env) env['warden'].authenticate!(:email, :jwt) status, headers, response = app.call(env) headers = headers_with_token(env, headers) [status, headers, response] end private def headers_with_token(env, headers) token = env["auth.jwt"] headers['Authorization'] = "Bearer #{token}" headers end end end end
Version data entries
13 entries across 13 versions & 1 rubygems