kemal-basic-auth

Basic auth for your Kemal application kemal basic-authentication
0.2.0 Latest release released
kemalcr/kemal-basic-auth
12 8 2
Kemal

kemal-basic-auth

Add basic auth to your Kemal application.

Installation

Add this to your application's shard.yml:

dependencies:
  kemal-basic-auth:
    github: kemalcr/kemal-basic-auth

Usage

require "kemal-basic-auth"

basic_auth "username", "password"
# basic_auth {"username1" => "password1", "username2" => "password2"}

kemal_authorized_username

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

Contributing

  1. Fork it ( https://github.com/kemalcr/kemal-basic-auth/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • sdogruyol Serdar Dogruyol - creator, maintainer
kemal-basic-auth:
  github: kemalcr/kemal-basic-auth
  version: ~> 0.2.0
License MIT
Crystal none

Authors

Dependencies 0

Development Dependencies 1

  • kemal master
    {'branch' => 'master', 'github' => 'sdogruyol/kemal'}
Last synced .
search fire star recently