@@ -5,15 +5,20 @@ Add basic auth to your [Kemal](http://github.com/kemalcr/kemal) application.
55> Basic Auth sends credentials Base64-encoded (not encrypted). Always serve your
66> application over HTTPS in production to avoid leaking credentials.
77
8- ## Installation
8+ ## Requirements
9+
10+ - Crystal ` >= 1.12.0 `
11+ - Kemal ` >= 1.0.0 `
912
13+ ## Installation
1014
1115Add this to your application's ` shard.yml ` :
1216
1317``` yaml
1418dependencies :
1519 kemal-basic-auth :
1620 github : kemalcr/kemal-basic-auth
21+ version : ~> 2.0
1722` ` `
1823
1924
@@ -127,6 +132,30 @@ get "/" do |env|
127132end
128133```
129134
135+ ## Upgrading from 1.x
136+
137+ Most applications upgrade with no source changes; the helper API
138+ (` basic_auth "user", "pass" ` , ` basic_auth({...}) ` ) and the public
139+ ` Kemal.config.auth_handler ` extension point are unchanged.
140+
141+ You may need to adjust if you:
142+
143+ - ** Subclassed ` Kemal::BasicAuth::Handler ` and accessed ` @credentials `
144+ directly.** The instance variable was renamed to ` @verifier ` because
145+ the handler now accepts any ` Kemal::BasicAuth::Verifier ` . Use the
146+ public ` Verifier ` API (or the ` getter ` if you add one) instead of
147+ reaching into the field.
148+ - ** Relied on ` Kemal::BasicAuth::VERSION ` .** This constant was removed.
149+ Read the version from ` shard.yml ` if you need it.
150+ - ** Depend on the exact failed-comparison timing of ` Credentials ` .**
151+ The internal algorithm now uses SHA-256 length equalization. The
152+ public ` authorize? ` contract is unchanged.
153+
154+ The custom-handler override pattern documented in 1.x continues to
155+ work as-is, so existing subclasses do not need to change.
156+
157+ See [ CHANGELOG.md] ( CHANGELOG.md ) for the full list of changes.
158+
130159## Contributing
131160
1321611 . Fork it ( https://github.com/kemalcr/kemal-basic-auth/fork )
0 commit comments