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