class Rswag::Ui::BasicAuth
Extend Rack HTTP Basic Authentication, as per RFC 2617. @api private
Public Instance Methods
call(env)
click to toggle source
Calls superclass method
# File lib/rswag/ui/basic_auth.rb, line 11 def call(env) return @app.call(env) unless env_matching_path(env) super(env) end
Private Instance Methods
base_path(url)
click to toggle source
# File lib/rswag/ui/basic_auth.rb, line 26 def base_path(url) url.downcase.split('/')[1] end
env_matching_path(env)
click to toggle source
# File lib/rswag/ui/basic_auth.rb, line 19 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