Class: Merb::AuthenticationMixin::BasicAuthentication

Class | Merb::AuthenticationMixin::BasicAuthentication
In: | lib/merb-core/controller/mixins/authentication.rb
Parent: | Object

### Methods

authenticate authenticate_or_request new password provided? request request! username

### Included Modules

Merb::ControllerExceptions

### Public Class methods

new(controller, realm = "Application", &authenticator)

:api: private

### Public Instance methods

authenticate(&authenticator)

Determines whether or not the user is authenticated using the criteria in the provided authenticator block.

#### Parameters

&authenticator: | A block that decides whether the provided username and password

      are valid.

#### Returns

Object: | False if basic auth is not provided, otherwise the return value of the authenticator block.

@overridable :api: public

password()

#### Returns

String: | The password provided in the request.

:api: public

provided?()

#### Returns

Boolean: | Whether there has been any basic authentication credentials provided

:api: public

request()

Request basic authentication and halt the filter chain. This is for use in a before filter.

#### Throws

:halt with an "HTTP Basic: Access denied." message with no layout, and sets the status to Unauthorized.

:api: public

request!()

Sets headers to request basic auth.

#### Returns

String: | Returns the empty string to provide a response body.

:api: public

username()

#### Returns

String: | The username provided in the request.

:api: public

### Protected Instance methods

authenticate_or_request(&authenticator)

:api: private

[Validate]