Sha256: 83dabebbd57bc2d2845c82c5c19da139aa90526bcbe158e37f15e8816d4ce0bb
Contents?: true
Size: 821 Bytes
Versions: 6
Compression:
Stored size: 821 Bytes
Contents
# frozen_string_literal: true module Rails module Auth class Credentials # A middleware for injecting an arbitrary credentials hash into the Rack environment # This is intended for development and testing purposes where you would like to # simulate a given X.509 certificate being used in a request or user logged in. # The credentials argument should either be a hash or a proc that returns one. class InjectorMiddleware def initialize(app, credentials) @app = app @credentials = credentials end def call(env) credentials = @credentials.respond_to?(:call) ? @credentials.call(env) : @credentials env[Rails::Auth::Env::CREDENTIALS_ENV_KEY] = credentials @app.call(env) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems