class UnauthorizedController
Special controller handling requests routed from Warden. Responds with HTTP 401 and, optionally, with a Keystone URI in the WWW-Authenticate header.
Public Class Methods
call(env)
click to toggle source
# File app/controllers/unauthorized_controller.rb, line 7 def self.call(env) @respond ||= action(:respond) @respond.call(env) end
default_url_options(*args)
click to toggle source
# File app/controllers/unauthorized_controller.rb, line 18 def self.default_url_options(*args) defined?(ApplicationController) ? ApplicationController.default_url_options(*args) : {} end
Public Instance Methods
respond()
click to toggle source
# File app/controllers/unauthorized_controller.rb, line 12 def respond Rails.logger.warn "[AuthN] [#{self.class}] Authentication failed: #{warden_message}" set_unauth Rails.logger.warn "[AuthN] [#{self.class}] Responding with #{status} #{headers.inspect}" end
Protected Instance Methods
attempted_path()
click to toggle source
# File app/controllers/unauthorized_controller.rb, line 47 def attempted_path warden_options[:attempted_path] end
scope()
click to toggle source
# File app/controllers/unauthorized_controller.rb, line 43 def scope @scope ||= warden_options[:scope] end
set_unauth()
click to toggle source
# File app/controllers/unauthorized_controller.rb, line 24 def set_unauth self.status = 401 self.content_type = 'text/plain' self.response_body = warden_message end
warden()
click to toggle source
# File app/controllers/unauthorized_controller.rb, line 30 def warden request.env['warden'] end
warden_message()
click to toggle source
# File app/controllers/unauthorized_controller.rb, line 38 def warden_message @message ||= warden.message || warden_options[:message] || "Authentication failed!" " The following strategies are supported #{ROCCI_SERVER_CONFIG.common.authn_strategies.join(', ').inspect}!" end
warden_options()
click to toggle source
# File app/controllers/unauthorized_controller.rb, line 34 def warden_options request.env['warden.options'] end