-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (26 loc) · 785 Bytes
/
index.js
File metadata and controls
30 lines (26 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// @ts-check
const Parser = require('./parser');
/**
* @typedef { import(".").Challenge } Challenge
* @typedef { import(".").Credentials } Credentials
*/
module.exports = {
/**
* Parse a WWW-Authenticate or Proxy-Authenticate header field
*
* @param {string} text - the text contents of the header field
* @return {Challenge[]} the list of challenges present in the header
*/
parseAuthenticateHeader(text) {
return new Parser('Authenticate').feed(text).result;
},
/**
* Parse a Authorization or Proxy-Authorization header field
*
* @param {string} text the text contents of the header field
* @return {Credentials} the credentials present in the header
*/
parseAuthorizationHeader(text) {
return new Parser('Authorization').feed(text).result;
}
};