Sha256: 688ed9077a7409ebb3dae08169ef3c73b7a25beb986af1b1523cf7e4c620a09e
Contents?: true
Size: 531 Bytes
Versions: 9
Compression:
Stored size: 531 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
9 entries across 9 versions & 1 rubygems