Skip to content

A parser for RFC 7235 HTTP/1.1 Authentication headers

License

Notifications You must be signed in to change notification settings

raphinesse/rfc7235-parser

Repository files navigation

rfc7235-parser Build Status

A parser for RFC 7235 HTTP/1.1 Authentication headers

Install

$ npm install rfc7235-parser

Usage

const {
  parseAuthenticateHeader,
  parseAuthorizationHeader
} = require('rfc7235-parser');

const challenges = parseAuthenticateHeader(
  'Basic asdQWE==, Digest realm="foo@bar"'
);
console.log(challenges);
// [
//   {scheme: 'basic', params: {Encoded: 'asdQWE=='}},
//   {scheme: 'digest', params: {realm: 'foo@bar'}}
// ]

const credentials = parseAuthorizationHeader(
  'Digest realm="foo@bar", QoP="auth,auth-int"'
);
console.log(credentials);
// {
//   scheme: 'digest',
//   params: {
//     realm: 'foo@bar',
//     qop: 'auth,auth-int'
//   }
// }

Crafted with ♡ by raphinesse using the nearley parser toolkit.

About

A parser for RFC 7235 HTTP/1.1 Authentication headers

Resources

License

Stars

Watchers

Forks

Packages

No packages published