instance method
authentication_request
Ruby on Rails 5.2.8.1
Since v3.0.20Signature
authentication_request(controller, realm, message = nil)
Sets a WWW-Authenticate header to let the client know a token is desired.
controller - ActionController::Base instance for the outgoing response. realm - String realm to use in the header.
Returns nothing.
Parameters
-
controllerreq -
realmreq -
messageopt = nil
Source
# File actionpack/lib/action_controller/metal/http_authentication.rb, line 512
def authentication_request(controller, realm, message = nil)
message ||= "HTTP Token: Access denied.\n"
controller.headers["WWW-Authenticate"] = %(Token realm="#{realm.tr('"'.freeze, "".freeze)}")
controller.__send__ :render, plain: message, status: :unauthorized
end
Defined in actionpack/lib/action_controller/metal/http_authentication.rb line 512
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::HttpAuthentication::Token