Sha256: fcf1fadec44da6cf5ef455191f4aebdc8f0dff497a9c0176ab235b7ec3476410
Contents?: true
Size: 532 Bytes
Versions: 32
Compression:
Stored size: 532 Bytes
Contents
# frozen_string_literal: true module FinAppsCore module Middleware # Adds a custom header for tenant level authorization. # If the value for this header already exists, it is not overriden. class TenantAuthentication < Faraday::Middleware KEY = 'X-Tenant-Token' unless defined? KEY def initialize(app, token) super(app) @header_value = token.to_s.strip end def call(env) env[:request_headers][KEY] ||= @header_value @app.call(env) end end end end
Version data entries
32 entries across 32 versions & 1 rubygems