class FinAppsCore::Middleware::NoEncodingBasicAuthentication
Adds a custom header for basic authorization. If the value for this header already exists, it is not overriden.
Constants
- KEY
Public Class Methods
new(app, token)
click to toggle source
Calls superclass method
# File lib/finapps_core/middleware/request/no_encoding_basic_authentication.rb 10 def initialize(app, token) 11 super(app) 12 sanitized = token.to_s.strip.delete("\n") 13 @header_value = "Bearer #{sanitized}" 14 end
Public Instance Methods
call(env)
click to toggle source
# File lib/finapps_core/middleware/request/no_encoding_basic_authentication.rb 16 def call(env) 17 env[:request_headers][KEY] ||= @header_value 18 @app.call(env) 19 end