Add basic auth to your Kemal application.
Add this to your application's shard.yml
:
dependencies:
kemal-basic-auth:
github: kemalcr/kemal-basic-auth
require "kemal-basic-auth"
basic_auth "username", "password"
# basic_auth {"username1" => "password1", "username2" => "password2"}
HTTP::Server::Context#kemal_authorized_username?
is set when the user is authorized.
basic_auth {"guest" => "123", "admin" => "xyz"}
get "/" do |env|
"Hi, %s!" % env.kemal_authorized_username?
end
- Fork it ( https://github.com/kemalcr/kemal-basic-auth/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- sdogruyol Serdar Dogruyol - creator, maintainer