class Kemal::BasicAuth::Handler
- Kemal::BasicAuth::Handler
- Kemal::Handler
- Reference
- Object
Overview
This middleware adds HTTP Basic Auth support to your application. Returns 401 "Unauthorized" with wrong credentials.
basic_auth "username", "password"
# basic_auth {"username1" => "password2", "username2" => "password2"}
HTTP::Server::Context#authorized_username
is set when the user is
authorized.
Defined in:
kemal-basic-auth/handler.crConstant Summary
-
AUTH =
"Authorization"
-
AUTH_MESSAGE =
"Could not verify your access level for that URL.\nYou have to login with proper credentials"
-
BASIC =
"Basic"
-
HEADER_LOGIN_REQUIRED =
"Basic realm=\"Login Required\""
Constructors
-
.new(username : String, password : String)
backward compatibility
- .new(credentials : Credentials)
- .new(hash : Hash(String, String))