Sha256: 55afba8b50e2599c96267ca01b96e4311d3ee898e0cd9e5fe3cb49e46973ff62
Contents?: true
Size: 634 Bytes
Versions: 21
Compression:
Stored size: 634 Bytes
Contents
# frozen_string_literal: true require 'rack/auth/basic' module Rswag module Ui # Extend Rack HTTP Basic Authentication, as per RFC 2617. # @api private # class BasicAuth < ::Rack::Auth::Basic def call(env) return @app.call(env) unless env_matching_path(env) super(env) end private def env_matching_path(env) path = base_path(env['PATH_INFO']) Rswag::Ui.config.config_object[:urls].find do |endpoint| base_path(endpoint[:url]) == path end end def base_path(url) url.downcase.split('/')[1] end end end end
Version data entries
21 entries across 21 versions & 1 rubygems