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

Included in:
Base
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.



197
198
199
# File 'lib/action_controller/metal/http_authentication.rb', line 197

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.



203
204
205
# File 'lib/action_controller/metal/http_authentication.rb', line 203

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.



209
210
211
# File 'lib/action_controller/metal/http_authentication.rb', line 209

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