Module: ActionController::HttpAuthentication::Digest::ControllerMethods

Defined in:
lib/action_controller/metal/http_authentication.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_or_request_with_http_digest(realm = "Application", message = nil, &password_procedure) ⇒ Object

Authenticate using an HTTP Digest, or otherwise render an HTTP header requesting the client to send a Digest.

See ActionController::HttpAuthentication::Digest for example usage.



193
194
195
# File 'lib/action_controller/metal/http_authentication.rb', line 193

def authenticate_or_request_with_http_digest(realm = "Application", message = nil, &password_procedure)
  authenticate_with_http_digest(realm, &password_procedure) || request_http_digest_authentication(realm, message)
end

#authenticate_with_http_digest(realm = "Application", &password_procedure) ⇒ Object

Authenticate using an HTTP Digest. Returns true if authentication is successful, false otherwise.



199
200
201
# File 'lib/action_controller/metal/http_authentication.rb', line 199

def authenticate_with_http_digest(realm = "Application", &password_procedure)
  HttpAuthentication::Digest.authenticate(request, realm, &password_procedure)
end

#request_http_digest_authentication(realm = "Application", message = nil) ⇒ Object

Render an HTTP header requesting the client to send a Digest for authentication.



205
206
207
# File 'lib/action_controller/metal/http_authentication.rb', line 205

def request_http_digest_authentication(realm = "Application", message = nil)
  HttpAuthentication::Digest.authentication_request(self, realm, message)
end