class

Pika::Auth::Strategies::Basic

Inherits Pika::Auth::Strategy < Reference < Object

HTTP Basic authentication. Reads credentials from the Authorization header: Authorization: Basic <base64(user:pass)> The validator block receives the username and password and must return true to allow the request.

Constructors

new(validator : Proc(String, String, Bool))
Source

Instance methods

authenticate!(env : HTTP::Server::Context) : Nil

Authenticate the request. Raises Pika::UnauthorizedError if auth fails.

Source
credentials(env : HTTP::Server::Context) : String | Nil

Extract the credential from the request (token, key, decoded basic string, etc.). Returns nil if the credential is absent.

Source