Sha256: 472c3af5e36bc69ea466d6840ffa6a1a241dac8d816889c8ffefa2ef528e052a
Contents?: true
Size: 574 Bytes
Versions: 4
Compression:
Stored size: 574 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-FinApps-Token' unless defined? KEY def initialize(app, identifier, token) super(app) @header_value = "#{identifier.to_s.strip}=#{token.to_s.strip}" end def call(env) env[:request_headers][KEY] ||= @header_value @app.call(env) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems