diff --git a/README.md b/README.md index 5d12ba1..54f5886 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # basic-auth-connect -Connect's Basic Auth middleware in its own module. This module is considered deprecated. You should instead create your own middleware with [basic-auth](https://github.com/visionmedia/node-basic-auth). +Connect's Basic Auth middleware in its own module. You should consider to create your own middleware with [basic-auth](https://github.com/visionmedia/node-basic-auth). ## API @@ -8,8 +8,6 @@ Connect's Basic Auth middleware in its own module. This module is considered dep var basicAuth = require('basic-auth-connect'); ``` -Sorry, couldn't think of a more clever name. - Simple username and password ```js @@ -28,13 +26,17 @@ connect() Async callback verification, accepting `fn(err, user)`. -``` +```js connect() .use(basicAuth(function(user, pass, fn){ User.authenticate({ user: user, pass: pass }, fn); })) ``` +**Security Considerations** + +Important: When using the callback method, it is recommended to use a time-safe comparison function like [crypto.timingSafeEqual](https://nodejs.org/api/crypto.html#cryptotimingsafeequala-b) to prevent timing attacks. + ## License [MIT](./LICENSE)