Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-auth

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-auth - npm Package Compare versions

Comparing version 2.4.2 to 2.4.3

gensrc/server/koa2.js

15

gensrc/auth/digest.js

@@ -152,3 +152,3 @@ "use strict";

if (this.validateNonce(co.nonce)) {
if (this.validateNonce(co.nonce, co.qop, co.nc)) {
(function () {

@@ -207,3 +207,3 @@ var ha2 = utils.md5(req.method + ':' + co.uri);

key: 'validateNonce',
value: function validateNonce(nonce) {
value: function validateNonce(nonce, qop, nc) {
var found = false;

@@ -221,3 +221,10 @@

if (serverNonce[0] === nonce) {
found = true;
if (qop) {
if (nc > serverNonce[2]) {
found = true;
++serverNonce[2];
}
} else {
found = true;
}
}

@@ -241,3 +248,3 @@ } else {

var nonce = utils.md5(_nodeUuid2.default.v4());
this.nonces.push([nonce, Date.now()]);
this.nonces.push([nonce, Date.now(), 0]);

@@ -244,0 +251,0 @@ return nonce;

{
"name": "http-auth",
"description": "Node.js package for HTTP basic and digest access authentication.",
"version": "2.4.2",
"version": "2.4.3",
"author": "Gevorg Harutyunyan (http://github.com/gevorg)",

@@ -6,0 +6,0 @@ "maintainers": [

@@ -92,2 +92,26 @@ # http-auth

For [koa@next](https://github.com/koajs/koa/tree/v2.x) you can use [http-auth-koa](https://github.com/http-auth/http-auth-koa)
```javascript
// Authentication module.
import auth from 'http-auth'
import koaAuth from 'http-auth-koa'
const basic = auth.basic({
realm: "Simon Area.",
file: __dirname + "/../data/users.htpasswd"
});
// Koa setup.
import Koa from 'koa'
const app = new Koa();
// Setup basic handler.
app.use(async (ctx, next) => {
await next();
ctx.body = `Welcome to koa ${ctx.req.user}!`;
});
// Setup auth.
app.use(koaAuth(basic));
```
## Protecting specific path

@@ -94,0 +118,0 @@ ```javascript

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc