From 98c1475c6ae30e3ea70e962370b5264debd9d8de Mon Sep 17 00:00:00 2001 From: sameerag Date: Mon, 24 Feb 2020 16:57:21 -0800 Subject: [PATCH 01/10] Base msal-node scaffolding --- lerna.json | 2 +- lib/.DS_Store | Bin 0 -> 6148 bytes lib/msal-node/.babelrc | 16 + lib/msal-node/.eslintrc.json | 37 + lib/msal-node/.gitignore | 264 ++ lib/msal-node/.huskyrc | 5 + lib/msal-node/.mocharc.json | 4 + lib/msal-node/.npmignore | 264 ++ lib/msal-node/.nycrc | 16 + lib/msal-node/package-lock.json | 4096 +++++++++++++++++ lib/msal-node/package.json | 86 + .../client/ConfidentialClientApplication.ts | 0 .../src/client/PublicClientApplication.ts | 0 .../ConfidentialClientApplication.spec.ts | 0 .../src/test/PublicClientApplication.spec.ts | 0 lib/msal-node/tsconfig.base.json | 12 + lib/msal-node/tsconfig.json | 28 + 17 files changed, 4829 insertions(+), 1 deletion(-) create mode 100644 lib/.DS_Store create mode 100644 lib/msal-node/.babelrc create mode 100644 lib/msal-node/.eslintrc.json create mode 100644 lib/msal-node/.gitignore create mode 100644 lib/msal-node/.huskyrc create mode 100644 lib/msal-node/.mocharc.json create mode 100644 lib/msal-node/.npmignore create mode 100644 lib/msal-node/.nycrc create mode 100644 lib/msal-node/package-lock.json create mode 100644 lib/msal-node/package.json create mode 100644 lib/msal-node/src/client/ConfidentialClientApplication.ts create mode 100644 lib/msal-node/src/client/PublicClientApplication.ts create mode 100644 lib/msal-node/src/test/ConfidentialClientApplication.spec.ts create mode 100644 lib/msal-node/src/test/PublicClientApplication.spec.ts create mode 100644 lib/msal-node/tsconfig.base.json create mode 100644 lib/msal-node/tsconfig.json diff --git a/lerna.json b/lerna.json index 7b9e341ec8..d021f1aaf7 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "lerna": "3.16.4", "command": { "run": { - "scope": ["msal", "@azure/msal-common", "@azure/msal-browser"] + "scope": ["msal", "@azure/msal-common", "@azure/msal-browser", "@azure/msal-node"] } }, "packages": [ diff --git a/lib/.DS_Store b/lib/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0= 2.1.2 < 3" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "inquirer": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.4.tgz", + "integrity": "sha512-Bu5Td5+j11sCkqfqmUTiwv+tWisMtP0L7Q8WrqA2C/BbBhy1YTdFrvjjlrKq8oagA/tLQBski2Gcx/Sqyi2qSQ==", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^2.4.2", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.2.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + } + }, + "interpret": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", + "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", + "dev": true + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true + }, + "is-callable": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", + "dev": true + }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-regex": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-2.0.7.tgz", + "integrity": "sha512-vrRztU9VRRFDyC+aklfLoeXyNdTfga2EI3udDGn4cZ6fpSXpHLV9X6CHvfoMCPtggg8zvDDmC4b9xfu0z6/llA==", + "dev": true, + "requires": { + "append-transform": "^1.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", + "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", + "dev": true, + "requires": { + "@babel/generator": "^7.4.0", + "@babel/parser": "^7.4.3", + "@babel/template": "^7.4.0", + "@babel/traverse": "^7.4.3", + "@babel/types": "^7.4.0", + "istanbul-lib-coverage": "^2.0.5", + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "istanbul-lib-report": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", + "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", + "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "rimraf": "^2.6.3", + "source-map": "^0.6.1" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz", + "integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json5": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", + "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "just-extend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz", + "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==", + "dev": true + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, + "levenary": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/levenary/-/levenary-1.1.1.tgz", + "integrity": "sha512-mkAdOIt79FD6irqjYSs4rdbnlT5vRonMEvBVPVb3XmevfS8kgRXwfes0dhPdEtzTWD/1eNE/Bm/G1iRt6DcnQQ==", + "dev": true, + "requires": { + "leven": "^3.1.0" + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "dev": true + }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, + "lolex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", + "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", + "dev": true + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "merge-source-map": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz", + "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", + "dev": true, + "requires": { + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "mocha": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.2.tgz", + "integrity": "sha512-FgDS9Re79yU1xz5d+C4rv1G7QagNGHZ+iXF81hO8zY35YZZcLEsJVfFolfsqKFWunATEvNzMK0r/CwWd/szO9A==", + "dev": true, + "requires": { + "ansi-colors": "3.2.3", + "browser-stdout": "1.3.1", + "debug": "3.2.6", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "find-up": "3.0.0", + "glob": "7.1.3", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "2.2.0", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "ms": "2.1.1", + "node-environment-flags": "1.0.5", + "object.assign": "4.1.0", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", + "wide-align": "1.1.3", + "yargs": "13.3.0", + "yargs-parser": "13.1.1", + "yargs-unparser": "1.6.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "nested-error-stacks": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz", + "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "nise": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", + "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==", + "dev": true, + "requires": { + "@sinonjs/formatio": "^3.2.1", + "@sinonjs/text-encoding": "^0.7.1", + "just-extend": "^4.0.2", + "lolex": "^5.0.1", + "path-to-regexp": "^1.7.0" + }, + "dependencies": { + "lolex": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", + "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } + } + } + }, + "node-environment-flags": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", + "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", + "dev": true, + "requires": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + } + }, + "node-modules-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", + "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", + "dev": true + }, + "node-releases": { + "version": "1.1.50", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.50.tgz", + "integrity": "sha512-lgAmPv9eYZ0bGwUYAKlr8MG6K4CvWliWqnkcT2P8mMAgVrH3lqfBPorFlxiG1pHQnqmavJZ9vbMXUTNyMLbrgQ==", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "nyc": { + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-14.1.1.tgz", + "integrity": "sha512-OI0vm6ZGUnoGZv/tLdZ2esSVzDwUC88SNs+6JoSOMVxA+gKMB8Tk7jBwgemLx4O40lhhvZCVw1C+OYLOBOPXWw==", + "dev": true, + "requires": { + "archy": "^1.0.0", + "caching-transform": "^3.0.2", + "convert-source-map": "^1.6.0", + "cp-file": "^6.2.0", + "find-cache-dir": "^2.1.0", + "find-up": "^3.0.0", + "foreground-child": "^1.5.6", + "glob": "^7.1.3", + "istanbul-lib-coverage": "^2.0.5", + "istanbul-lib-hook": "^2.0.7", + "istanbul-lib-instrument": "^3.3.0", + "istanbul-lib-report": "^2.0.8", + "istanbul-lib-source-maps": "^3.0.6", + "istanbul-reports": "^2.2.4", + "js-yaml": "^3.13.1", + "make-dir": "^2.1.0", + "merge-source-map": "^1.1.0", + "resolve-from": "^4.0.0", + "rimraf": "^2.6.3", + "signal-exit": "^3.0.2", + "spawn-wrap": "^1.4.2", + "test-exclude": "^5.2.3", + "uuid": "^3.3.2", + "yargs": "^13.2.2", + "yargs-parser": "^13.0.0" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "opencollective-postinstall": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", + "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==", + "dev": true + }, + "optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "package-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-3.0.0.tgz", + "integrity": "sha512-lOtmukMDVvtkL84rJHI7dpTYq+0rli8N2wlnqUcBuDWCfVhRUfOmnR9SsoHFMLpACvEV60dX7rd0rFaYDZI+FA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.15", + "hasha": "^3.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-to-regexp": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "dev": true, + "requires": { + "isarray": "0.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "pirates": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", + "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", + "dev": true, + "requires": { + "node-modules-regexp": "^1.0.0" + } + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "dev": true, + "requires": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz", + "integrity": "sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA==", + "dev": true, + "requires": { + "regenerate": "^1.4.0" + } + }, + "regenerator-runtime": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", + "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==", + "dev": true + }, + "regenerator-transform": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.1.tgz", + "integrity": "sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ==", + "dev": true, + "requires": { + "private": "^0.1.6" + } + }, + "regexpp": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", + "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", + "dev": true + }, + "regexpu-core": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.6.0.tgz", + "integrity": "sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg==", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.1.0", + "regjsgen": "^0.5.0", + "regjsparser": "^0.6.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.1.0" + } + }, + "regjsgen": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.1.tgz", + "integrity": "sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg==", + "dev": true + }, + "regjsparser": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.3.tgz", + "integrity": "sha512-8uZvYbnfAtEm9Ab8NTb3hdLwL4g/LQzEYP7Xs27T96abJCCE2d6r3cPZPQEsLKy0vRSGVNG+/zVGtLr86HQduA==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", + "dev": true, + "requires": { + "es6-error": "^4.0.1" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "resolve": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", + "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "run-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/run-node/-/run-node-1.0.0.tgz", + "integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==", + "dev": true + }, + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shelljs": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", + "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "shx": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.2.tgz", + "integrity": "sha512-aS0mWtW3T2sHAenrSrip2XGv39O9dXIFUqxAEWHEOS1ePtGIBavdPJY1kE2IHl14V/4iCbUiNDPGdyYTtmhSoA==", + "dev": true, + "requires": { + "es6-object-assign": "^1.0.3", + "minimist": "^1.2.0", + "shelljs": "^0.8.1" + } + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "sinon": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz", + "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.4.0", + "@sinonjs/formatio": "^3.2.1", + "@sinonjs/samsam": "^3.3.3", + "diff": "^3.5.0", + "lolex": "^4.2.0", + "nise": "^1.5.2", + "supports-color": "^5.5.0" + } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-support": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", + "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "spawn-wrap": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.4.3.tgz", + "integrity": "sha512-IgB8md0QW/+tWqcavuFgKYR/qIRvJkRLPJDFaoXtLLUaVcCDK0+HeFTkmQHj3eprcYhc+gOl0aEA1w7qZlYezw==", + "dev": true, + "requires": { + "foreground-child": "^1.5.6", + "mkdirp": "^0.5.0", + "os-homedir": "^1.0.1", + "rimraf": "^2.6.2", + "signal-exit": "^3.0.2", + "which": "^1.3.0" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "string.prototype.trimleft": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz", + "integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string.prototype.trimright": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz", + "integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + } + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "test-exclude": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", + "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "dev": true, + "requires": { + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "read-pkg-up": "^4.0.0", + "require-main-filename": "^2.0.0" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "tslib": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.0.tgz", + "integrity": "sha512-BmndXUtiTn/VDDrJzQE7Mm22Ix3PxgLltW9bSNLoeCY31gnG2OPx0QqJnuc9oMIKioYrz487i6K9o4Pdn0j+Kg==", + "dev": true + }, + "tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, + "typescript": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.2.tgz", + "integrity": "sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==", + "dev": true + }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz", + "integrity": "sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g==", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz", + "integrity": "sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw==", + "dev": true + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, + "v8-compile-cache": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, + "write-file-atomic": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.1" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yargs-unparser": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", + "dev": true, + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.15", + "yargs": "^13.3.0" + } + } + } +} diff --git a/lib/msal-node/package.json b/lib/msal-node/package.json new file mode 100644 index 0000000000..0d9b0575b8 --- /dev/null +++ b/lib/msal-node/package.json @@ -0,0 +1,86 @@ +{ + "name": "@azure/msal-node", + "author": { + "name": "Microsoft", + "email": "nugetaad@microsoft.com", + "url": "https://www.microsoft.com" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git" + }, + "version": "0.1.0", + "description": "Microsoft library for Authentication with Node", + "keywords": [ + "device code", + "authorization code", + "PKCE", + "typescript", + "node", + "js", + "AAD", + "msal", + "oauth" + ], + "main": "./dist/index.js", + "module": "./dist/index.es.js", + "types": "./dist/src/index.d.ts", + "engines": { + "node": ">=0.8.0" + }, + "directories": { + "test": "test" + }, + "files": [ + "dist" + ], + "scripts": { + "clean": "shx rm -rf dist lib", + "clean:coverage": "rimraf ../../.nyc_output/*", + "lint": "eslint src --ext .ts", + "pretest": "npm link @azure/msal-common", + "test": "mocha", + "test:coverage": "nyc --reporter=text mocha", + "test:coverage:only": "npm run clean:coverage && npm run test:coverage", + "build:all": "npm run build:common && npm run build", + "build:common": "cd ../msal-common && npm run build", + "build:modules": "tsc", + "build:modules:watch": "tsc -w", + "build": "npm run clean && npm run lint && npm run build:modules", + "prepack": "npm run build" + }, + "devDependencies": { + "@babel/core": "^7.7.2", + "@babel/plugin-proposal-class-properties": "^7.7.0", + "@babel/plugin-proposal-object-rest-spread": "^7.6.2", + "@babel/polyfill": "^7.7.0", + "@babel/preset-env": "^7.7.1", + "@babel/preset-typescript": "^7.7.2", + "@babel/register": "^7.7.0", + "@istanbuljs/nyc-config-babel": "^2.1.1", + "@types/chai": "^4.2.5", + "@types/chai-as-promised": "^7.1.2", + "@types/mocha": "^5.2.7", + "@types/sinon": "^7.5.0", + "@typescript-eslint/eslint-plugin": "^2.4.0", + "@typescript-eslint/eslint-plugin-tslint": "^2.4.0", + "@typescript-eslint/parser": "^2.4.0", + "babel-plugin-istanbul": "^5.2.0", + "chai": "^4.2.0", + "chai-as-promised": "^7.1.1", + "eslint": "^6.5.1", + "husky": "^3.0.9", + "mocha": "^6.2.2", + "nyc": "^14.1.1", + "rimraf": "^3.0.0", + "shx": "^0.3.2", + "sinon": "^7.5.0", + "tslib": "^1.10.0", + "tslint": "^5.20.0", + "typescript": "^3.6.4" + }, + "dependencies": { + "@azure/msal-common": "1.0.0-alpha.0" + } +} diff --git a/lib/msal-node/src/client/ConfidentialClientApplication.ts b/lib/msal-node/src/client/ConfidentialClientApplication.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/msal-node/src/client/PublicClientApplication.ts b/lib/msal-node/src/client/PublicClientApplication.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/msal-node/src/test/ConfidentialClientApplication.spec.ts b/lib/msal-node/src/test/ConfidentialClientApplication.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/msal-node/src/test/PublicClientApplication.spec.ts b/lib/msal-node/src/test/PublicClientApplication.spec.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/msal-node/tsconfig.base.json b/lib/msal-node/tsconfig.base.json new file mode 100644 index 0000000000..d519609f49 --- /dev/null +++ b/lib/msal-node/tsconfig.base.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "suppressImplicitAnyIndexErrors": true, + "sourceMap": true, + "declaration": true, + "experimentalDecorators": true, + "importHelpers": true, + "noImplicitAny": true + }, + "compileOnSave": false, + "buildOnSave": false +} diff --git a/lib/msal-node/tsconfig.json b/lib/msal-node/tsconfig.json new file mode 100644 index 0000000000..9d1a20d55f --- /dev/null +++ b/lib/msal-node/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "moduleResolution": "node", + "module": "es6", + "target": "es5", + "lib": [ + "es2015", + "dom", + "es2015.promise" + ], + "outDir": "./dist", + "allowUnusedLabels": false, + "noImplicitReturns": true, + "esModuleInterop": true, + "resolveJsonModule": true + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules" + ], + "types": [ + "node", + "mocha" + ] +} From b2a7b204d70335c432bca234449671e67e5b7544 Mon Sep 17 00:00:00 2001 From: sameerag Date: Fri, 28 Feb 2020 13:28:10 -0800 Subject: [PATCH 02/10] First PR for msal-node, moved around some code to fit the new project scaffolding --- .../ClientApplication.ts} | 62 ++++++------ .../PublicClientApplication.ts} | 96 +++++++++---------- .../Configuration.ts} | 16 ++-- .../PublicClientConfiguration.ts} | 10 +- lib/msal-common/src/index.ts | 6 +- lib/msal-common/src/logger/Logger.ts | 2 +- 6 files changed, 96 insertions(+), 96 deletions(-) rename lib/msal-common/src/{app/module/AuthModule.ts => client/ClientApplication.ts} (77%) rename lib/msal-common/src/{app/module/AuthorizationCodeModule.ts => client/PublicClientApplication.ts} (89%) rename lib/msal-common/src/{app/config/ModuleConfiguration.ts => config/Configuration.ts} (89%) rename lib/msal-common/src/{app/config/PublicClientSPAConfiguration.ts => config/PublicClientConfiguration.ts} (79%) diff --git a/lib/msal-common/src/app/module/AuthModule.ts b/lib/msal-common/src/client/ClientApplication.ts similarity index 77% rename from lib/msal-common/src/app/module/AuthModule.ts rename to lib/msal-common/src/client/ClientApplication.ts index 75e3245300..83c298f443 100644 --- a/lib/msal-common/src/app/module/AuthModule.ts +++ b/lib/msal-common/src/client/ClientApplication.ts @@ -2,22 +2,22 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { ModuleConfiguration, buildModuleConfiguration } from "../config/ModuleConfiguration"; -import { AuthenticationParameters } from "../../request/AuthenticationParameters"; -import { TokenRenewParameters } from "../../request/TokenRenewParameters"; -import { CodeResponse } from "../../response/CodeResponse"; -import { TokenResponse } from "../../response/TokenResponse"; -import { ICacheStorage } from "../../cache/ICacheStorage"; -import { CacheHelpers } from "../../cache/CacheHelpers"; -import { INetworkModule } from "../../network/INetworkModule"; -import { ICrypto } from "../../crypto/ICrypto"; -import { Account } from "../../auth/Account"; -import { Authority } from "../../auth/authority/Authority"; -import { IdToken } from "../../auth/IdToken"; -import { buildClientInfo } from "../../auth/ClientInfo"; -import { StringUtils } from "../../utils/StringUtils"; -import { Logger } from "../../logger/Logger"; -import { PersistentCacheKeys } from "../../utils/Constants"; +import { Configuration, buildConfiguration } from "../config/Configuration"; +import { AuthenticationParameters } from "../request/AuthenticationParameters"; +import { TokenRenewParameters } from "../request/TokenRenewParameters"; +import { CodeResponse } from "../response/CodeResponse"; +import { TokenResponse } from "../response/TokenResponse"; +import { ICacheStorage } from "../cache/ICacheStorage"; +import { CacheHelpers } from "../cache/CacheHelpers"; +import { INetworkModule } from "../network/INetworkModule"; +import { ICrypto } from "../crypto/ICrypto"; +import { Account } from "../auth/Account"; +import { Authority } from "../auth/authority/Authority"; +import { IdToken } from "../auth/IdToken"; +import { buildClientInfo } from "../auth/ClientInfo"; +import { StringUtils } from "../utils/StringUtils"; +import { Logger } from "../logger/Logger"; +import { PersistentCacheKeys } from "../utils/Constants"; /** * @hidden @@ -31,18 +31,18 @@ export type ResponseStateInfo = { /** * AuthModule class - * + * * Parent object instance which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow. - * + * */ -export abstract class AuthModule { +export abstract class ClientApplication { // Logger object public logger: Logger; // Application config - private config: ModuleConfiguration; - + private config: Configuration; + // Crypto Interface protected cryptoObj: ICrypto; @@ -61,9 +61,9 @@ export abstract class AuthModule { // Default authority object protected defaultAuthorityInstance: Authority; - constructor(configuration: ModuleConfiguration) { + constructor(configuration: Configuration) { // Set the configuration - this.config = buildModuleConfiguration(configuration); + this.config = buildConfiguration(configuration); // Initialize the logger this.logger = new Logger(this.config.loggerOptions); @@ -84,24 +84,24 @@ export abstract class AuthModule { // #region Abstract Functions /** - * Creates a url for logging in a user. This will by default append the client id to the list of scopes, + * Creates a url for logging in a user. This will by default append the client id to the list of scopes, * allowing you to retrieve an id token in the subsequent code exchange. Also performs validation of the request parameters. * Including any SSO parameters (account, sid, login_hint) will short circuit the authentication and allow you to retrieve a code without interaction. - * @param request + * @param request */ abstract async createLoginUrl(request: AuthenticationParameters): Promise; /** * Creates a url for logging in a user. Also performs validation of the request parameters. * Including any SSO parameters (account, sid, login_hint) will short circuit the authentication and allow you to retrieve a code without interaction. - * @param request + * @param request */ abstract async createAcquireTokenUrl(request: AuthenticationParameters): Promise; /** * Handles the hash fragment response from public client code request. Returns a code response used by * the client to exchange for a token in acquireToken. - * @param hashFragment + * @param hashFragment */ abstract handleFragmentResponse(hashFragment: string): CodeResponse; @@ -109,7 +109,7 @@ export abstract class AuthModule { * Given an authorization code, it will perform a token exchange using cached values from a previous call to * createLoginUrl() or createAcquireTokenUrl(). You must call this AFTER using one of those APIs first. You should * also use the handleFragmentResponse() API to pass the codeResponse to this function afterwards. - * @param codeResponse + * @param codeResponse */ abstract async acquireToken(codeResponse: CodeResponse): Promise; @@ -117,19 +117,19 @@ export abstract class AuthModule { * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew * the given token and returns the renewed token. Will throw an error if login is not completed (unless * id tokens are not being renewed). - * @param request + * @param request */ abstract async renewToken(request: TokenRenewParameters): Promise; /** * Use to log out the current user, and redirect the user to the postLogoutRedirectUri. * Default behaviour is to redirect the user to `window.location.href`. - * @param authorityUri + * @param authorityUri */ abstract async logout(authorityUri?: string): Promise; // #endregion - + // #region Getters and Setters /** diff --git a/lib/msal-common/src/app/module/AuthorizationCodeModule.ts b/lib/msal-common/src/client/PublicClientApplication.ts similarity index 89% rename from lib/msal-common/src/app/module/AuthorizationCodeModule.ts rename to lib/msal-common/src/client/PublicClientApplication.ts index b6464bbba7..701e04a500 100644 --- a/lib/msal-common/src/app/module/AuthorizationCodeModule.ts +++ b/lib/msal-common/src/client/PublicClientApplication.ts @@ -2,41 +2,41 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { AuthModule } from "./AuthModule"; -import { PublicClientSPAConfiguration, buildPublicClientSPAConfiguration } from "../config/PublicClientSPAConfiguration"; -import { AuthenticationParameters } from "../../request/AuthenticationParameters"; -import { TokenExchangeParameters } from "../../request/TokenExchangeParameters"; -import { TokenRenewParameters } from "../../request/TokenRenewParameters"; -import { ServerCodeRequestParameters } from "../../server/ServerCodeRequestParameters"; -import { ServerTokenRequestParameters } from "../../server/ServerTokenRequestParameters"; -import { CodeResponse } from "../../response/CodeResponse"; -import { TokenResponse } from "../../response/TokenResponse"; -import { ResponseHandler } from "../../response/ResponseHandler"; -import { ServerAuthorizationCodeResponse } from "../../server/ServerAuthorizationCodeResponse"; -import { ServerAuthorizationTokenResponse } from "../../server/ServerAuthorizationTokenResponse"; -import { ClientAuthError } from "../../error/ClientAuthError"; -import { ClientConfigurationError } from "../../error/ClientConfigurationError"; -import { AccessTokenCacheItem } from "../../cache/AccessTokenCacheItem"; -import { AuthorityFactory } from "../../auth/authority/AuthorityFactory"; -import { IdToken } from "../../auth/IdToken"; -import { ScopeSet } from "../../auth/ScopeSet"; -import { TemporaryCacheKeys, PersistentCacheKeys, AADServerParamKeys, Constants } from "../../utils/Constants"; -import { TimeUtils } from "../../utils/TimeUtils"; -import { StringUtils } from "../../utils/StringUtils"; -import { UrlString } from "../../url/UrlString"; +import { ClientApplication } from "./ClientApplication"; +import { PublicClientConfiguration, buildPublicClientConfiguration } from "../config/PublicClientConfiguration"; +import { AuthenticationParameters } from "../request/AuthenticationParameters"; +import { TokenExchangeParameters } from "../request/TokenExchangeParameters"; +import { TokenRenewParameters } from "../request/TokenRenewParameters"; +import { ServerCodeRequestParameters } from "../server/ServerCodeRequestParameters"; +import { ServerTokenRequestParameters } from "../server/ServerTokenRequestParameters"; +import { CodeResponse } from "../response/CodeResponse"; +import { TokenResponse } from "../response/TokenResponse"; +import { ResponseHandler } from "../response/ResponseHandler"; +import { ServerAuthorizationCodeResponse } from "../server/ServerAuthorizationCodeResponse"; +import { ServerAuthorizationTokenResponse } from "../server/ServerAuthorizationTokenResponse"; +import { ClientAuthError } from "../error/ClientAuthError"; +import { ClientConfigurationError } from "../error/ClientConfigurationError"; +import { AccessTokenCacheItem } from "../cache/AccessTokenCacheItem"; +import { AuthorityFactory } from "../auth/authority/AuthorityFactory"; +import { IdToken } from "../auth/IdToken"; +import { ScopeSet } from "../auth/ScopeSet"; +import { TemporaryCacheKeys, PersistentCacheKeys, AADServerParamKeys, Constants } from "../utils/Constants"; +import { TimeUtils } from "../utils/TimeUtils"; +import { StringUtils } from "../utils/StringUtils"; +import { UrlString } from "../url/UrlString"; /** * AuthorizationCodeModule class - * + * * Object instance which will construct requests to send to and handle responses - * from the Microsoft STS using the authorization code flow. + * from the Microsoft STS using the authorization code flow. */ -export class AuthorizationCodeModule extends AuthModule { +export class AuthorizationCodeModule extends ClientApplication { // Application config - private clientConfig: PublicClientSPAConfiguration; + private clientConfig: PublicClientConfiguration; - constructor(configuration: PublicClientSPAConfiguration) { + constructor(configuration: PublicClientConfiguration) { // Implement base module super({ systemOptions: configuration.systemOptions, @@ -46,7 +46,7 @@ export class AuthorizationCodeModule extends AuthModule { cryptoInterface: configuration.cryptoInterface }); // Implement defaults in config - this.clientConfig = buildPublicClientSPAConfiguration(configuration); + this.clientConfig = buildPublicClientConfiguration(configuration); if (this.clientConfig.auth.tmp_clientSecret) { this.logger.warning("Client secret is a temporary parameter that will not be carried forward in production versions of this library."); @@ -57,10 +57,10 @@ export class AuthorizationCodeModule extends AuthModule { } /** - * Creates a url for logging in a user. This will by default append the client id to the list of scopes, + * Creates a url for logging in a user. This will by default append the client id to the list of scopes, * allowing you to retrieve an id token in the subsequent code exchange. Also performs validation of the request parameters. * Including any SSO parameters (account, sid, login_hint) will short circuit the authentication and allow you to retrieve a code without interaction. - * @param request + * @param request */ async createLoginUrl(request: AuthenticationParameters): Promise { return this.createUrl(request, true); @@ -69,7 +69,7 @@ export class AuthorizationCodeModule extends AuthModule { /** * Creates a url for logging in a user. Also performs validation of the request parameters. * Including any SSO parameters (account, sid, login_hint) will short circuit the authentication and allow you to retrieve a code without interaction. - * @param request + * @param request */ async createAcquireTokenUrl(request: AuthenticationParameters): Promise { return this.createUrl(request, false); @@ -77,8 +77,8 @@ export class AuthorizationCodeModule extends AuthModule { /** * Helper function which creates URL. If isLoginCall is true, MSAL appends client id scope to retrieve id token from the service. - * @param request - * @param isLoginCall + * @param request + * @param isLoginCall */ private async createUrl(request: AuthenticationParameters, isLoginCall: boolean): Promise { // Initialize authority or use default, and perform discovery endpoint check. @@ -145,7 +145,7 @@ export class AuthorizationCodeModule extends AuthModule { * Given an authorization code, it will perform a token exchange using cached values from a previous call to * createLoginUrl() or createAcquireTokenUrl(). You must call this AFTER using one of those APIs first. You should * also use the handleFragmentResponse() API to pass the codeResponse to this function afterwards. - * @param codeResponse + * @param codeResponse */ async acquireToken(codeResponse: CodeResponse): Promise { try { @@ -193,7 +193,7 @@ export class AuthorizationCodeModule extends AuthModule { * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew * the given token and returns the renewed token. Will throw an error if login is not completed (unless * id tokens are not being renewed). - * @param request + * @param request */ async renewToken(request: TokenRenewParameters): Promise { try { @@ -244,7 +244,7 @@ export class AuthorizationCodeModule extends AuthModule { }; // Only populate id token if it exists in cache item. - return StringUtils.isEmpty(cachedTokenItem.value.idToken) ? defaultTokenResponse : + return StringUtils.isEmpty(cachedTokenItem.value.idToken) ? defaultTokenResponse : ResponseHandler.setResponseIdToken(defaultTokenResponse, new IdToken(cachedTokenItem.value.idToken, this.cryptoObj)); } else { // Renew the tokens. @@ -278,7 +278,7 @@ export class AuthorizationCodeModule extends AuthModule { /** * Use to log out the current user, and redirect the user to the postLogoutRedirectUri. * Default behaviour is to redirect the user to `window.location.href`. - * @param authorityUri + * @param authorityUri */ async logout(authorityUri?: string): Promise { const currentAccount = this.getAccount(); @@ -318,7 +318,7 @@ export class AuthorizationCodeModule extends AuthModule { /** * Handles the hash fragment response from public client code request. Returns a code response used by * the client to exchange for a token in acquireToken. - * @param hashFragment + * @param hashFragment */ public handleFragmentResponse(hashFragment: string): CodeResponse { // Handle responses. @@ -365,10 +365,10 @@ export class AuthorizationCodeModule extends AuthModule { /** * Gets all cached tokens based on the given criteria. - * @param requestScopes - * @param authorityUri - * @param resourceId - * @param homeAccountIdentifier + * @param requestScopes + * @param authorityUri + * @param resourceId + * @param homeAccountIdentifier */ private getCachedTokens(requestScopes: ScopeSet, authorityUri: string, resourceId: string, homeAccountIdentifier: string): AccessTokenCacheItem { // Get all access tokens with matching authority, resource id and home account ID @@ -396,10 +396,10 @@ export class AuthorizationCodeModule extends AuthModule { /** * Makes a request to the token endpoint with the given parameters and parses the response. - * @param tokenEndpoint - * @param tokenReqParams - * @param tokenRequest - * @param codeResponse + * @param tokenEndpoint + * @param tokenReqParams + * @param tokenRequest + * @param codeResponse */ private async getTokenResponse(tokenEndpoint: string, tokenReqParams: ServerTokenRequestParameters, tokenRequest: TokenExchangeParameters, codeResponse?: CodeResponse): Promise { // Perform token request. @@ -440,7 +440,7 @@ export class AuthorizationCodeModule extends AuthModule { } else if (!StringUtils.isEmpty(this.clientConfig.auth.redirectUri)) { return this.clientConfig.auth.redirectUri; } - } + } // This should never throw unless window.location.href is returning empty. throw ClientConfigurationError.createRedirectUriEmptyError(); } @@ -458,7 +458,7 @@ export class AuthorizationCodeModule extends AuthModule { } else if (!StringUtils.isEmpty(this.clientConfig.auth.postLogoutRedirectUri)) { return this.clientConfig.auth.postLogoutRedirectUri; } - } + } // This should never throw unless window.location.href is returning empty. throw ClientConfigurationError.createPostLogoutRedirectUriEmptyError(); } diff --git a/lib/msal-common/src/app/config/ModuleConfiguration.ts b/lib/msal-common/src/config/Configuration.ts similarity index 89% rename from lib/msal-common/src/app/config/ModuleConfiguration.ts rename to lib/msal-common/src/config/Configuration.ts index 11c53204b1..2f54cd22ca 100644 --- a/lib/msal-common/src/app/config/ModuleConfiguration.ts +++ b/lib/msal-common/src/config/Configuration.ts @@ -2,11 +2,11 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { ICacheStorage } from "../../cache/ICacheStorage"; -import { INetworkModule } from "../../network/INetworkModule"; -import { ICrypto, PkceCodes } from "../../crypto/ICrypto"; -import { AuthError } from "../../error/AuthError"; -import { ILoggerCallback, LogLevel } from "../../logger/Logger"; +import { ICacheStorage } from "../cache/ICacheStorage"; +import { INetworkModule } from "../network/INetworkModule"; +import { ICrypto, PkceCodes } from "../crypto/ICrypto"; +import { AuthError } from "../error/AuthError"; +import { ILoggerCallback, LogLevel } from "../logger/Logger"; // Token renewal offset default in seconds const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300; @@ -20,7 +20,7 @@ const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300; * - network: this is where you can configure network implementation. * - crypto: implementation of crypto functions */ -export type ModuleConfiguration = { +export type Configuration = { systemOptions?: SystemOptions, loggerOptions?: LoggerOptions, storageInterface?: ICacheStorage, @@ -145,8 +145,8 @@ const DEFAULT_CRYPTO_IMPLEMENTATION: ICrypto = { * * @returns MsalConfiguration object */ -export function buildModuleConfiguration({ systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation }: ModuleConfiguration): ModuleConfiguration { - const overlayedConfig: ModuleConfiguration = { +export function buildConfiguration({ systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation }: Configuration): Configuration { + const overlayedConfig: Configuration = { systemOptions: userSystemOptions || DEFAULT_SYSTEM_OPTIONS, loggerOptions: userLoggerOption || DEFAULT_LOGGER_IMPLEMENTATION, storageInterface: storageImplementation || DEFAULT_STORAGE_IMPLEMENTATION, diff --git a/lib/msal-common/src/app/config/PublicClientSPAConfiguration.ts b/lib/msal-common/src/config/PublicClientConfiguration.ts similarity index 79% rename from lib/msal-common/src/app/config/PublicClientSPAConfiguration.ts rename to lib/msal-common/src/config/PublicClientConfiguration.ts index 437c010297..9807c99618 100644 --- a/lib/msal-common/src/app/config/PublicClientSPAConfiguration.ts +++ b/lib/msal-common/src/config/PublicClientConfiguration.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { ModuleConfiguration, buildModuleConfiguration } from "./ModuleConfiguration"; +import { Configuration, buildConfiguration } from "./Configuration"; /** * @type AuthOptions: Use this to configure the auth options in the Configuration object @@ -27,7 +27,7 @@ export type AuthOptions = { * This object allows you to configure important elements of MSAL functionality: * - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform */ -export type PublicClientSPAConfiguration = ModuleConfiguration & { +export type PublicClientConfiguration = Configuration & { auth: AuthOptions }; @@ -50,9 +50,9 @@ const DEFAULT_AUTH_OPTIONS: AuthOptions = { * * @returns TConfiguration object */ -export function buildPublicClientSPAConfiguration({ auth, loggerOptions, storageInterface, networkInterface, cryptoInterface }: PublicClientSPAConfiguration): PublicClientSPAConfiguration { - const baseConfig = buildModuleConfiguration({loggerOptions, storageInterface, networkInterface, cryptoInterface}); - const overlayedConfig: PublicClientSPAConfiguration = { +export function buildPublicClientConfiguration({ auth, loggerOptions, storageInterface, networkInterface, cryptoInterface }: PublicClientConfiguration): PublicClientConfiguration { + const baseConfig = buildConfiguration({loggerOptions, storageInterface, networkInterface, cryptoInterface}); + const overlayedConfig: PublicClientConfiguration = { auth: { ...DEFAULT_AUTH_OPTIONS, ...auth }, ...baseConfig }; diff --git a/lib/msal-common/src/index.ts b/lib/msal-common/src/index.ts index 07a66c368f..5912302b68 100644 --- a/lib/msal-common/src/index.ts +++ b/lib/msal-common/src/index.ts @@ -1,7 +1,7 @@ // App Auth Modules and Configuration -export { AuthorizationCodeModule } from "./app/module/AuthorizationCodeModule"; -export { PublicClientSPAConfiguration, AuthOptions } from "./app/config/PublicClientSPAConfiguration"; -export { SystemOptions, LoggerOptions, TelemetryOptions } from "./app/config/ModuleConfiguration"; +export { AuthorizationCodeModule } from "./client/PublicClientApplication"; +export { PublicClientConfiguration, AuthOptions } from "./config/PublicClientConfiguration"; +export { SystemOptions, LoggerOptions, TelemetryOptions } from "./config/Configuration"; // Account export { Account } from "./auth/Account"; // Authority diff --git a/lib/msal-common/src/logger/Logger.ts b/lib/msal-common/src/logger/Logger.ts index b83f402d20..e8b9993bb5 100644 --- a/lib/msal-common/src/logger/Logger.ts +++ b/lib/msal-common/src/logger/Logger.ts @@ -4,7 +4,7 @@ */ import pkg from "../../package.json"; import { StringUtils } from "../utils/StringUtils"; -import { LoggerOptions } from "../app/config/ModuleConfiguration.js"; +import { LoggerOptions } from "../config/Configuration"; /** * Options for logger messages. From 7a9a53b8ca371828765cf6b2a0bf8ac4dc551460 Mon Sep 17 00:00:00 2001 From: sameerag Date: Fri, 28 Feb 2020 14:09:12 -0800 Subject: [PATCH 03/10] Name changes --- .../src/client/{ClientApplication.ts => Client.ts} | 2 +- .../client/{PublicClientApplication.ts => PublicClient.ts} | 4 ++-- lib/msal-common/src/index.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename lib/msal-common/src/client/{ClientApplication.ts => Client.ts} (99%) rename lib/msal-common/src/client/{PublicClientApplication.ts => PublicClient.ts} (99%) diff --git a/lib/msal-common/src/client/ClientApplication.ts b/lib/msal-common/src/client/Client.ts similarity index 99% rename from lib/msal-common/src/client/ClientApplication.ts rename to lib/msal-common/src/client/Client.ts index 83c298f443..7d7ba65576 100644 --- a/lib/msal-common/src/client/ClientApplication.ts +++ b/lib/msal-common/src/client/Client.ts @@ -35,7 +35,7 @@ export type ResponseStateInfo = { * Parent object instance which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow. * */ -export abstract class ClientApplication { +export abstract class Client { // Logger object public logger: Logger; diff --git a/lib/msal-common/src/client/PublicClientApplication.ts b/lib/msal-common/src/client/PublicClient.ts similarity index 99% rename from lib/msal-common/src/client/PublicClientApplication.ts rename to lib/msal-common/src/client/PublicClient.ts index 701e04a500..0cff75fe17 100644 --- a/lib/msal-common/src/client/PublicClientApplication.ts +++ b/lib/msal-common/src/client/PublicClient.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { ClientApplication } from "./ClientApplication"; +import { Client } from "./Client"; import { PublicClientConfiguration, buildPublicClientConfiguration } from "../config/PublicClientConfiguration"; import { AuthenticationParameters } from "../request/AuthenticationParameters"; import { TokenExchangeParameters } from "../request/TokenExchangeParameters"; @@ -31,7 +31,7 @@ import { UrlString } from "../url/UrlString"; * Object instance which will construct requests to send to and handle responses * from the Microsoft STS using the authorization code flow. */ -export class AuthorizationCodeModule extends ClientApplication { +export class PublicClient extends Client { // Application config private clientConfig: PublicClientConfiguration; diff --git a/lib/msal-common/src/index.ts b/lib/msal-common/src/index.ts index 5912302b68..ba1a9af13b 100644 --- a/lib/msal-common/src/index.ts +++ b/lib/msal-common/src/index.ts @@ -1,5 +1,5 @@ // App Auth Modules and Configuration -export { AuthorizationCodeModule } from "./client/PublicClientApplication"; +export { PublicClient } from "./client/PublicClient"; export { PublicClientConfiguration, AuthOptions } from "./config/PublicClientConfiguration"; export { SystemOptions, LoggerOptions, TelemetryOptions } from "./config/Configuration"; // Account From a18519df4c68687f7bc5286a8ef9033fead40f17 Mon Sep 17 00:00:00 2001 From: sameerag Date: Mon, 2 Mar 2020 01:43:25 -0800 Subject: [PATCH 04/10] Moving to tsdx as the build environment --- lib/msal-node/.babelrc | 16 ---------------- lib/msal-node/.eslintrc.json | 37 ------------------------------------ lib/msal-node/.huskyrc | 5 ----- lib/msal-node/.mocharc.json | 4 ---- lib/msal-node/.nycrc | 16 ---------------- 5 files changed, 78 deletions(-) delete mode 100644 lib/msal-node/.babelrc delete mode 100644 lib/msal-node/.eslintrc.json delete mode 100644 lib/msal-node/.huskyrc delete mode 100644 lib/msal-node/.mocharc.json delete mode 100644 lib/msal-node/.nycrc diff --git a/lib/msal-node/.babelrc b/lib/msal-node/.babelrc deleted file mode 100644 index bb3be65fb5..0000000000 --- a/lib/msal-node/.babelrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - [ - "@babel/preset-env", - { - "modules": "commonjs" - } - ] - ], - "plugins": [ - "@babel/proposal-class-properties", - "@babel/proposal-object-rest-spread", - "istanbul" - ] -} diff --git a/lib/msal-node/.eslintrc.json b/lib/msal-node/.eslintrc.json deleted file mode 100644 index 275cb77b1a..0000000000 --- a/lib/msal-node/.eslintrc.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "parserOptions": { - "sourceType": "module", - "ecmaFeatures": { - "modules": true - } - }, - "plugins": [ - "@typescript-eslint/eslint-plugin-tslint" - ], - "extends": [ - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended" - ], - "rules": { - "@typescript-eslint/array-type": 0, - "@typescript-eslint/ban-types": 0, - "@typescript-eslint/camelcase": 0, - "@typescript-eslint/explicit-member-accessibility": 0, - "@typescript-eslint/indent": [2, 4, { "SwitchCase": 1 }], - "@typescript-eslint/interface-name-prefix": 0, - "@typescript-eslint/member-delimiter-style": 0, - "@typescript-eslint/no-angle-bracket-type-assertion": 0, - "@typescript-eslint/no-inferrable-types": 0, - "@typescript-eslint/no-object-literal-type-assertion": 0, - "@typescript-eslint/prefer-interface": 0, - "@typescript-eslint/semi": 2, - "@typescript-eslint/type-annotation-spacing": 0, - "eol-last": 2, - "no-multiple-empty-lines": [2, { "max": 1 }], - "no-var": 2, - "prefer-const": 2, - "quotes": [2, "double"], - "spaced-comment": 2 - } -} diff --git a/lib/msal-node/.huskyrc b/lib/msal-node/.huskyrc deleted file mode 100644 index 09f03a4f6f..0000000000 --- a/lib/msal-node/.huskyrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "hooks": { - "pre-commit": "npm run lint" - } -} diff --git a/lib/msal-node/.mocharc.json b/lib/msal-node/.mocharc.json deleted file mode 100644 index 24a27da3e3..0000000000 --- a/lib/msal-node/.mocharc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "require": ["./test/mochaSetup.js", "@babel/polyfill"], - "spec": ["./test/**/*.spec.ts"] -} diff --git a/lib/msal-node/.nycrc b/lib/msal-node/.nycrc deleted file mode 100644 index 3fe4884b3c..0000000000 --- a/lib/msal-node/.nycrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "@istanbuljs/nyc-config-babel", - "extension": [ - ".ts" - ], - "include": [ - "src" - ], - "exclude": [ - "**/*.d.ts" - ], - "all": true, - "temp-dir": "../../.nyc_output", - "clean": false, - "reporter": "text-lcov" -} From 7b018ad10a4cf583cb8ea7938dc1ef33e679dcf2 Mon Sep 17 00:00:00 2001 From: sameerag Date: Mon, 2 Mar 2020 01:52:29 -0800 Subject: [PATCH 05/10] reset folders --- lib/msal-node/src/PublicClientApplication.ts | 1 - lib/msal-node/src/client/ConfidentialClientApplication.ts | 1 + lib/msal-node/src/client/PublicClientApplication.ts | 1 + lib/msal-node/src/index.ts | 3 ++- .../src/test/ConfidentialClientApplication.spec.ts | 0 lib/msal-node/src/test/PublicClientApplication.spec.ts | 0 lib/msal-node/test/ConfidentialClientApplication.spec.ts | 8 ++++++++ 7 files changed, 12 insertions(+), 2 deletions(-) delete mode 100644 lib/msal-node/src/PublicClientApplication.ts delete mode 100644 lib/msal-node/src/test/ConfidentialClientApplication.spec.ts delete mode 100644 lib/msal-node/src/test/PublicClientApplication.spec.ts create mode 100644 lib/msal-node/test/ConfidentialClientApplication.spec.ts diff --git a/lib/msal-node/src/PublicClientApplication.ts b/lib/msal-node/src/PublicClientApplication.ts deleted file mode 100644 index 3aa621df0b..0000000000 --- a/lib/msal-node/src/PublicClientApplication.ts +++ /dev/null @@ -1 +0,0 @@ -export class PublicClientApplication {} diff --git a/lib/msal-node/src/client/ConfidentialClientApplication.ts b/lib/msal-node/src/client/ConfidentialClientApplication.ts index e69de29bb2..e309f3a106 100644 --- a/lib/msal-node/src/client/ConfidentialClientApplication.ts +++ b/lib/msal-node/src/client/ConfidentialClientApplication.ts @@ -0,0 +1 @@ +export class ConfidentialClientApplication {} diff --git a/lib/msal-node/src/client/PublicClientApplication.ts b/lib/msal-node/src/client/PublicClientApplication.ts index e69de29bb2..3aa621df0b 100644 --- a/lib/msal-node/src/client/PublicClientApplication.ts +++ b/lib/msal-node/src/client/PublicClientApplication.ts @@ -0,0 +1 @@ +export class PublicClientApplication {} diff --git a/lib/msal-node/src/index.ts b/lib/msal-node/src/index.ts index 4443484e97..9040225316 100644 --- a/lib/msal-node/src/index.ts +++ b/lib/msal-node/src/index.ts @@ -1 +1,2 @@ -export { PublicClientApplication } from './PublicClientApplication'; +export { PublicClientApplication } from './client/PublicClientApplication'; +export { ConfidentialClientApplication } from './client/ConfidentialClientApplication'; diff --git a/lib/msal-node/src/test/ConfidentialClientApplication.spec.ts b/lib/msal-node/src/test/ConfidentialClientApplication.spec.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/msal-node/src/test/PublicClientApplication.spec.ts b/lib/msal-node/src/test/PublicClientApplication.spec.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/msal-node/test/ConfidentialClientApplication.spec.ts b/lib/msal-node/test/ConfidentialClientApplication.spec.ts new file mode 100644 index 0000000000..1b1d176fb2 --- /dev/null +++ b/lib/msal-node/test/ConfidentialClientApplication.spec.ts @@ -0,0 +1,8 @@ +const { ConfidentialClientApplication } = require('./../dist/'); + +describe('ConfidentialClientApplication', () => { + test('exports a class', () => { + const authApp = new ConfidentialClientApplication(); + expect(authApp).toBeInstanceOf(ConfidentialClientApplication); + }); +}); From f223fb06dde2e709e4c060be55cc619df78d2c5f Mon Sep 17 00:00:00 2001 From: sameerag Date: Mon, 2 Mar 2020 02:08:44 -0800 Subject: [PATCH 06/10] Create `account` and `authority` folders in source --- .../src/{auth => account}/Account.ts | 0 .../src/{auth => account}/ClientInfo.ts | 0 .../src/{auth => account}/DecodedJwt.ts | 0 .../src/{auth => account}/IdToken.ts | 0 .../src/{auth => account}/IdTokenClaims.ts | 0 .../src/{auth => }/authority/AadAuthority.ts | 4 +- .../src/{auth => }/authority/Authority.ts | 12 ++-- .../{auth => }/authority/AuthorityFactory.ts | 10 +-- .../src/{auth => }/authority/AuthorityType.ts | 0 .../authority/OpenIdConfigResponse.ts | 0 .../authority/TenantDiscoveryResponse.ts | 0 lib/msal-common/src/cache/CacheHelpers.ts | 8 +-- lib/msal-common/src/client/Client.ts | 8 +-- lib/msal-common/src/client/PublicClient.ts | 6 +- lib/msal-common/src/error/ClientAuthError.ts | 52 +++++++-------- lib/msal-common/src/index.ts | 6 +- .../src/request/AuthenticationParameters.ts | 6 +- .../src/{auth => request}/ScopeSet.ts | 0 .../src/request/TokenRenewParameters.ts | 2 +- .../src/response/ResponseHandler.ts | 66 +++++++++---------- lib/msal-common/src/response/TokenResponse.ts | 2 +- .../src/server/ServerCodeRequestParameters.ts | 18 ++--- .../server/ServerTokenRequestParameters.ts | 6 +- lib/msal-common/src/utils/StringUtils.ts | 6 +- 24 files changed, 106 insertions(+), 106 deletions(-) rename lib/msal-common/src/{auth => account}/Account.ts (100%) rename lib/msal-common/src/{auth => account}/ClientInfo.ts (100%) rename lib/msal-common/src/{auth => account}/DecodedJwt.ts (100%) rename lib/msal-common/src/{auth => account}/IdToken.ts (100%) rename lib/msal-common/src/{auth => account}/IdTokenClaims.ts (100%) rename lib/msal-common/src/{auth => }/authority/AadAuthority.ts (93%) rename lib/msal-common/src/{auth => }/authority/Authority.ts (94%) rename lib/msal-common/src/{auth => }/authority/AuthorityFactory.ts (85%) rename lib/msal-common/src/{auth => }/authority/AuthorityType.ts (100%) rename lib/msal-common/src/{auth => }/authority/OpenIdConfigResponse.ts (100%) rename lib/msal-common/src/{auth => }/authority/TenantDiscoveryResponse.ts (100%) rename lib/msal-common/src/{auth => request}/ScopeSet.ts (100%) diff --git a/lib/msal-common/src/auth/Account.ts b/lib/msal-common/src/account/Account.ts similarity index 100% rename from lib/msal-common/src/auth/Account.ts rename to lib/msal-common/src/account/Account.ts diff --git a/lib/msal-common/src/auth/ClientInfo.ts b/lib/msal-common/src/account/ClientInfo.ts similarity index 100% rename from lib/msal-common/src/auth/ClientInfo.ts rename to lib/msal-common/src/account/ClientInfo.ts diff --git a/lib/msal-common/src/auth/DecodedJwt.ts b/lib/msal-common/src/account/DecodedJwt.ts similarity index 100% rename from lib/msal-common/src/auth/DecodedJwt.ts rename to lib/msal-common/src/account/DecodedJwt.ts diff --git a/lib/msal-common/src/auth/IdToken.ts b/lib/msal-common/src/account/IdToken.ts similarity index 100% rename from lib/msal-common/src/auth/IdToken.ts rename to lib/msal-common/src/account/IdToken.ts diff --git a/lib/msal-common/src/auth/IdTokenClaims.ts b/lib/msal-common/src/account/IdTokenClaims.ts similarity index 100% rename from lib/msal-common/src/auth/IdTokenClaims.ts rename to lib/msal-common/src/account/IdTokenClaims.ts diff --git a/lib/msal-common/src/auth/authority/AadAuthority.ts b/lib/msal-common/src/authority/AadAuthority.ts similarity index 93% rename from lib/msal-common/src/auth/authority/AadAuthority.ts rename to lib/msal-common/src/authority/AadAuthority.ts index 4189200b52..f7c18f60cb 100644 --- a/lib/msal-common/src/auth/authority/AadAuthority.ts +++ b/lib/msal-common/src/authority/AadAuthority.ts @@ -5,8 +5,8 @@ import { Authority } from "./Authority"; import { OpenIdConfigResponse } from "./OpenIdConfigResponse"; import { AuthorityType } from "./AuthorityType"; -import { AADTrustedHostList, Constants } from "../../utils/Constants"; -import { INetworkModule } from "../../network/INetworkModule"; +import { AADTrustedHostList, Constants } from "./../utils/Constants"; +import { INetworkModule } from "./../network/INetworkModule"; /** * The AadAuthority class extends the Authority class and adds functionality specific to the Azure AD OAuth Authority. diff --git a/lib/msal-common/src/auth/authority/Authority.ts b/lib/msal-common/src/authority/Authority.ts similarity index 94% rename from lib/msal-common/src/auth/authority/Authority.ts rename to lib/msal-common/src/authority/Authority.ts index d33c1e7001..2cb416ff39 100644 --- a/lib/msal-common/src/auth/authority/Authority.ts +++ b/lib/msal-common/src/authority/Authority.ts @@ -4,10 +4,10 @@ */ import { AuthorityType } from "./AuthorityType"; import { TenantDiscoveryResponse } from "./TenantDiscoveryResponse"; -import { UrlString } from "../../url/UrlString"; -import { IUri } from "../../url/IUri"; -import { ClientAuthError } from "../../error/ClientAuthError"; -import { INetworkModule } from "../../network/INetworkModule"; +import { UrlString } from "./../url/UrlString"; +import { IUri } from "./../url/IUri"; +import { ClientAuthError } from "./../error/ClientAuthError"; +import { INetworkModule } from "./../network/INetworkModule"; /** * The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the @@ -107,7 +107,7 @@ export abstract class Authority { /** * Replaces tenant in url path with current tenant. Defaults to common. - * @param urlString + * @param urlString */ private replaceTenant(urlString: string): string { return urlString.replace("{tenant}", this.tenant); @@ -136,7 +136,7 @@ export abstract class Authority { /** * Gets OAuth endpoints from the given OpenID configuration endpoint. - * @param openIdConfigurationEndpoint + * @param openIdConfigurationEndpoint */ private async discoverEndpoints(openIdConfigurationEndpoint: string): Promise { return this.networkInterface.sendGetRequestAsync(openIdConfigurationEndpoint); diff --git a/lib/msal-common/src/auth/authority/AuthorityFactory.ts b/lib/msal-common/src/authority/AuthorityFactory.ts similarity index 85% rename from lib/msal-common/src/auth/authority/AuthorityFactory.ts rename to lib/msal-common/src/authority/AuthorityFactory.ts index 141000c503..ced2aa4a90 100644 --- a/lib/msal-common/src/auth/authority/AuthorityFactory.ts +++ b/lib/msal-common/src/authority/AuthorityFactory.ts @@ -5,11 +5,11 @@ import { Authority } from "./Authority"; import { AadAuthority } from "./AadAuthority"; import { AuthorityType } from "./AuthorityType"; -import { ClientConfigurationError } from "../../error/ClientConfigurationError"; -import { ClientAuthError } from "../../error/ClientAuthError"; -import { INetworkModule } from "../../network/INetworkModule"; -import { StringUtils } from "../../utils/StringUtils"; -import { UrlString } from "../../url/UrlString"; +import { ClientConfigurationError } from "../error/ClientConfigurationError"; +import { ClientAuthError } from "./../error/ClientAuthError"; +import { INetworkModule } from "./../network/INetworkModule"; +import { StringUtils } from "./../utils/StringUtils"; +import { UrlString } from "./../url/UrlString"; export class AuthorityFactory { diff --git a/lib/msal-common/src/auth/authority/AuthorityType.ts b/lib/msal-common/src/authority/AuthorityType.ts similarity index 100% rename from lib/msal-common/src/auth/authority/AuthorityType.ts rename to lib/msal-common/src/authority/AuthorityType.ts diff --git a/lib/msal-common/src/auth/authority/OpenIdConfigResponse.ts b/lib/msal-common/src/authority/OpenIdConfigResponse.ts similarity index 100% rename from lib/msal-common/src/auth/authority/OpenIdConfigResponse.ts rename to lib/msal-common/src/authority/OpenIdConfigResponse.ts diff --git a/lib/msal-common/src/auth/authority/TenantDiscoveryResponse.ts b/lib/msal-common/src/authority/TenantDiscoveryResponse.ts similarity index 100% rename from lib/msal-common/src/auth/authority/TenantDiscoveryResponse.ts rename to lib/msal-common/src/authority/TenantDiscoveryResponse.ts diff --git a/lib/msal-common/src/cache/CacheHelpers.ts b/lib/msal-common/src/cache/CacheHelpers.ts index 77b026397f..12795655a7 100644 --- a/lib/msal-common/src/cache/CacheHelpers.ts +++ b/lib/msal-common/src/cache/CacheHelpers.ts @@ -6,8 +6,8 @@ import { AccessTokenCacheItem } from "./AccessTokenCacheItem"; import { AccessTokenKey } from "./AccessTokenKey"; import { AccessTokenValue } from "./AccessTokenValue"; import { ICacheStorage } from "./ICacheStorage"; -import { Account } from "../auth/Account"; -import { Authority } from "../auth/authority/Authority"; +import { Account } from "../account/Account"; +import { Authority } from "../authority/Authority"; import { ServerCodeRequestParameters } from "../server/ServerCodeRequestParameters"; import { ClientAuthError } from "../error/ClientAuthError"; import { StringUtils } from "../utils/StringUtils"; @@ -44,7 +44,7 @@ export class CacheHelpers { /** * Create Nonce key to cache nonce - * @param state + * @param state */ generateNonceKey(state: string): string { return `${TemporaryCacheKeys.NONCE_IDTOKEN}${Constants.RESOURCE_DELIM}${state}`; @@ -97,7 +97,7 @@ export class CacheHelpers { /** * Reset all temporary cache items - * @param state + * @param state */ resetTempCacheItems(state?: string): void { // check state and remove associated cache items diff --git a/lib/msal-common/src/client/Client.ts b/lib/msal-common/src/client/Client.ts index 7d7ba65576..0dc0c2709a 100644 --- a/lib/msal-common/src/client/Client.ts +++ b/lib/msal-common/src/client/Client.ts @@ -11,10 +11,10 @@ import { ICacheStorage } from "../cache/ICacheStorage"; import { CacheHelpers } from "../cache/CacheHelpers"; import { INetworkModule } from "../network/INetworkModule"; import { ICrypto } from "../crypto/ICrypto"; -import { Account } from "../auth/Account"; -import { Authority } from "../auth/authority/Authority"; -import { IdToken } from "../auth/IdToken"; -import { buildClientInfo } from "../auth/ClientInfo"; +import { Account } from "../account/Account"; +import { Authority } from "../authority/Authority"; +import { IdToken } from "../account/IdToken"; +import { buildClientInfo } from "../account/ClientInfo"; import { StringUtils } from "../utils/StringUtils"; import { Logger } from "../logger/Logger"; import { PersistentCacheKeys } from "../utils/Constants"; diff --git a/lib/msal-common/src/client/PublicClient.ts b/lib/msal-common/src/client/PublicClient.ts index 0cff75fe17..62e04b9e01 100644 --- a/lib/msal-common/src/client/PublicClient.ts +++ b/lib/msal-common/src/client/PublicClient.ts @@ -17,9 +17,9 @@ import { ServerAuthorizationTokenResponse } from "../server/ServerAuthorizationT import { ClientAuthError } from "../error/ClientAuthError"; import { ClientConfigurationError } from "../error/ClientConfigurationError"; import { AccessTokenCacheItem } from "../cache/AccessTokenCacheItem"; -import { AuthorityFactory } from "../auth/authority/AuthorityFactory"; -import { IdToken } from "../auth/IdToken"; -import { ScopeSet } from "../auth/ScopeSet"; +import { AuthorityFactory } from "../authority/AuthorityFactory"; +import { IdToken } from "../account/IdToken"; +import { ScopeSet } from "../request/ScopeSet"; import { TemporaryCacheKeys, PersistentCacheKeys, AADServerParamKeys, Constants } from "../utils/Constants"; import { TimeUtils } from "../utils/TimeUtils"; import { StringUtils } from "../utils/StringUtils"; diff --git a/lib/msal-common/src/error/ClientAuthError.ts b/lib/msal-common/src/error/ClientAuthError.ts index 2b9abbc2cb..de9c901408 100644 --- a/lib/msal-common/src/error/ClientAuthError.ts +++ b/lib/msal-common/src/error/ClientAuthError.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. */ import { AuthError } from "./AuthError"; -import { IdToken } from "../auth/IdToken"; -import { ScopeSet } from "../auth/ScopeSet"; +import { IdToken } from "../account/IdToken"; +import { ScopeSet } from "../request/ScopeSet"; /** * ClientAuthErrorMessage class containing string constants used by error codes and messages. @@ -105,7 +105,7 @@ export const ClientAuthErrorMessage = { * Error thrown when there is an error in the client code running on the browser. */ export class ClientAuthError extends AuthError { - + constructor(errorCode: string, errorMessage?: string) { super(errorCode, errorMessage); this.name = "ClientAuthError"; @@ -115,7 +115,7 @@ export class ClientAuthError extends AuthError { /** * Creates an error thrown when client info object doesn't decode correctly. - * @param caughtError + * @param caughtError */ static createClientInfoDecodingError(caughtError: string): ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.clientInfoDecodingError.code, @@ -124,7 +124,7 @@ export class ClientAuthError extends AuthError { /** * Creates an error thrown if the client info is empty. - * @param rawClientInfo + * @param rawClientInfo */ static createClientInfoEmptyError(rawClientInfo: string): ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.clientInfoEmptyError.code, @@ -133,7 +133,7 @@ export class ClientAuthError extends AuthError { /** * Creates an error thrown when the id token extraction errors out. - * @param err + * @param err */ static createIdTokenParsingError(caughtExtractionError: string): ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.idTokenParsingError.code, @@ -142,7 +142,7 @@ export class ClientAuthError extends AuthError { /** * Creates an error thrown when the id token string is null or empty. - * @param invalidRawTokenString + * @param invalidRawTokenString */ static createIdTokenNullOrEmptyError(invalidRawTokenString: string) : ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.nullOrEmptyIdToken.code, @@ -151,10 +151,10 @@ export class ClientAuthError extends AuthError { /** * Creates an error thrown when the token request could not be retrieved from the cache - * @param errDetail + * @param errDetail */ static createTokenRequestCacheError(errDetail: string): ClientAuthError { - return new ClientAuthError(ClientAuthErrorMessage.tokenRequestCacheError.code, + return new ClientAuthError(ClientAuthErrorMessage.tokenRequestCacheError.code, `${ClientAuthErrorMessage.tokenRequestCacheError.desc} Error Detail: ${errDetail}`); } @@ -162,25 +162,25 @@ export class ClientAuthError extends AuthError { * Creates an error thrown when the endpoint discovery doesn't complete correctly. */ static createEndpointDiscoveryIncompleteError(errDetail: string): ClientAuthError { - return new ClientAuthError(ClientAuthErrorMessage.endpointResolutionError.code, + return new ClientAuthError(ClientAuthErrorMessage.endpointResolutionError.code, `${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${errDetail}`); } /** * Creates an error thrown if authority type is not valid. - * @param invalidAuthorityError + * @param invalidAuthorityError */ static createInvalidAuthorityTypeError(givenUrl: string): ClientAuthError { - return new ClientAuthError(ClientAuthErrorMessage.invalidAuthorityType.code, + return new ClientAuthError(ClientAuthErrorMessage.invalidAuthorityType.code, `${ClientAuthErrorMessage.invalidAuthorityType.desc} Given Url: ${givenUrl}`); } /** * Creates an error thrown when the hash cannot be deserialized. - * @param invalidAuthorityError + * @param invalidAuthorityError */ static createHashNotDeserializedError(hashParamObj: string): ClientAuthError { - return new ClientAuthError(ClientAuthErrorMessage.hashNotDeserialized.code, + return new ClientAuthError(ClientAuthErrorMessage.hashNotDeserialized.code, `${ClientAuthErrorMessage.hashNotDeserialized.desc} Given Object: ${hashParamObj}`); } @@ -188,7 +188,7 @@ export class ClientAuthError extends AuthError { * Creates an error thrown when two states do not match. */ static createStateMismatchError(): ClientAuthError { - return new ClientAuthError(ClientAuthErrorMessage.stateMismatchError.code, + return new ClientAuthError(ClientAuthErrorMessage.stateMismatchError.code, ClientAuthErrorMessage.stateMismatchError.desc); } @@ -196,21 +196,21 @@ export class ClientAuthError extends AuthError { * Creates an error thrown when the nonce does not match. */ static createNonceMismatchError(): ClientAuthError { - return new ClientAuthError(ClientAuthErrorMessage.nonceMismatchError.code, + return new ClientAuthError(ClientAuthErrorMessage.nonceMismatchError.code, ClientAuthErrorMessage.nonceMismatchError.desc); } - /** + /** * Creates an error thrown when the cached account and response account do not match. */ static createAccountMismatchError(): ClientAuthError { - return new ClientAuthError(ClientAuthErrorMessage.accountMismatchError.code, + return new ClientAuthError(ClientAuthErrorMessage.accountMismatchError.code, ClientAuthErrorMessage.accountMismatchError.desc); } /** * Throws error if idToken is not correctly formed - * @param idToken + * @param idToken */ static createInvalidIdTokenError(idToken: IdToken) : ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.invalidIdToken.code, @@ -221,7 +221,7 @@ export class ClientAuthError extends AuthError { * Creates an error thrown when the authorization code required for a token request is null or empty. */ static createNoTokensFoundError(scopes: string): ClientAuthError { - return new ClientAuthError(ClientAuthErrorMessage.noTokensFoundError.code, + return new ClientAuthError(ClientAuthErrorMessage.noTokensFoundError.code, `${ClientAuthErrorMessage.noTokensFoundError.desc} Scopes: ${scopes}`); } @@ -229,7 +229,7 @@ export class ClientAuthError extends AuthError { * Creates an error in cache parsing. */ static createCacheParseError(cacheKey: string): ClientAuthError { - return new ClientAuthError(ClientAuthErrorMessage.cacheParseError.code, + return new ClientAuthError(ClientAuthErrorMessage.cacheParseError.code, `${ClientAuthErrorMessage.cacheParseError.desc} Cache key: ${cacheKey}`); } @@ -243,7 +243,7 @@ export class ClientAuthError extends AuthError { /** * Throws error when multiple tokens are in cache for the given scope. - * @param scope + * @param scope */ static createMultipleMatchingTokensInCacheError(scope: string): ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingTokens.code, @@ -259,7 +259,7 @@ export class ClientAuthError extends AuthError { /** * Throws error when attempting to append a null, undefined or empty scope to a set - * @param givenScope + * @param givenScope */ static createAppendEmptyScopeToSetError(givenScope: string): ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.appendEmptyScopeError.code, `${ClientAuthErrorMessage.appendEmptyScopeError.desc} Given Scope: ${givenScope}`); @@ -267,7 +267,7 @@ export class ClientAuthError extends AuthError { /** * Throws error when attempting to append a null, undefined or empty scope to a set - * @param givenScope + * @param givenScope */ static createRemoveEmptyScopeFromSetError(givenScope: string): ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.removeEmptyScopeError.code, `${ClientAuthErrorMessage.removeEmptyScopeError.desc} Given Scope: ${givenScope}`); @@ -275,7 +275,7 @@ export class ClientAuthError extends AuthError { /** * Throws error when attempting to append null or empty ScopeSet. - * @param appendError + * @param appendError */ static createAppendScopeSetError(appendError: string): ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.appendScopeSetError.code, `${ClientAuthErrorMessage.appendScopeSetError.desc} Detail Error: ${appendError}`); @@ -283,7 +283,7 @@ export class ClientAuthError extends AuthError { /** * Throws error if ScopeSet is null or undefined. - * @param givenScopeSet + * @param givenScopeSet */ static createEmptyInputScopeSetError(givenScopeSet: ScopeSet): ClientAuthError { return new ClientAuthError(ClientAuthErrorMessage.emptyInputScopeSetError.code, `${ClientAuthErrorMessage.emptyInputScopeSetError.desc} Given ScopeSet: ${givenScopeSet}`); diff --git a/lib/msal-common/src/index.ts b/lib/msal-common/src/index.ts index ba1a9af13b..e7195a67d9 100644 --- a/lib/msal-common/src/index.ts +++ b/lib/msal-common/src/index.ts @@ -3,10 +3,10 @@ export { PublicClient } from "./client/PublicClient"; export { PublicClientConfiguration, AuthOptions } from "./config/PublicClientConfiguration"; export { SystemOptions, LoggerOptions, TelemetryOptions } from "./config/Configuration"; // Account -export { Account } from "./auth/Account"; +export { Account } from "./account/Account"; // Authority -export { Authority } from "./auth/authority/Authority"; -export { AuthorityFactory } from "./auth/authority/AuthorityFactory"; +export { Authority } from "./authority/Authority"; +export { AuthorityFactory } from "./authority/AuthorityFactory"; // Cache export { ICacheStorage } from "./cache/ICacheStorage"; // Network Interface diff --git a/lib/msal-common/src/request/AuthenticationParameters.ts b/lib/msal-common/src/request/AuthenticationParameters.ts index 36b972c137..32799f6cff 100644 --- a/lib/msal-common/src/request/AuthenticationParameters.ts +++ b/lib/msal-common/src/request/AuthenticationParameters.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. */ import { ClientRequestParameters } from "./ClientRequestParameters"; -import { Account } from "../auth/Account"; +import { Account } from "../account/Account"; import { ClientConfigurationError } from "../error/ClientConfigurationError"; /** * AuthenticationParameters passed by user to retrieve a token from the server. * - scopes: requested token scopes * - resource: requested resource uri - * - extraScopesToConsent: additional scopes to consent + * - extraScopesToConsent: additional scopes to consent * - prompt: the value of the OAuth prompt parameter * - extraQueryParameters: string to string map of custom query parameters * - claimsRequest: stringified claims object to request additional claims in a token @@ -33,7 +33,7 @@ export type AuthenticationParameters = ClientRequestParameters & { /** * Function which validates claims request passed in by the user. - * @param request + * @param request */ export function validateClaimsRequest(request: AuthenticationParameters): void { if (!request.claimsRequest) { diff --git a/lib/msal-common/src/auth/ScopeSet.ts b/lib/msal-common/src/request/ScopeSet.ts similarity index 100% rename from lib/msal-common/src/auth/ScopeSet.ts rename to lib/msal-common/src/request/ScopeSet.ts diff --git a/lib/msal-common/src/request/TokenRenewParameters.ts b/lib/msal-common/src/request/TokenRenewParameters.ts index 7a17b0dde9..2e87ce5fa8 100644 --- a/lib/msal-common/src/request/TokenRenewParameters.ts +++ b/lib/msal-common/src/request/TokenRenewParameters.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ import { ClientRequestParameters } from "./ClientRequestParameters"; -import { Account } from "../auth/Account"; +import { Account } from "../account/Account"; /** * AuthenticationParameters passed by user to retrieve a token from the server. diff --git a/lib/msal-common/src/response/ResponseHandler.ts b/lib/msal-common/src/response/ResponseHandler.ts index b73e102ae2..6d22114aa5 100644 --- a/lib/msal-common/src/response/ResponseHandler.ts +++ b/lib/msal-common/src/response/ResponseHandler.ts @@ -2,12 +2,12 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { IdToken } from "../auth/IdToken"; +import { IdToken } from "../account/IdToken"; import { CacheHelpers } from "../cache/CacheHelpers"; import { ServerAuthorizationTokenResponse } from "../server/ServerAuthorizationTokenResponse"; -import { ScopeSet } from "../auth/ScopeSet"; -import { buildClientInfo, ClientInfo } from "../auth/ClientInfo"; -import { Account } from "../auth/Account"; +import { ScopeSet } from "../request/ScopeSet"; +import { buildClientInfo, ClientInfo } from "../account/ClientInfo"; +import { Account } from "../account/Account"; import { ProtocolUtils } from "../utils/ProtocolUtils"; import { ICrypto } from "../crypto/ICrypto"; import { ICacheStorage } from "../cache/ICacheStorage"; @@ -47,8 +47,8 @@ export class ResponseHandler { * - id token claims * - unique id (oid or sub claim of token) * - tenant id (tid claim of token) - * @param originalResponse - * @param idTokenObj + * @param originalResponse + * @param idTokenObj */ static setResponseIdToken(originalResponse: TokenResponse, idTokenObj: IdToken) : TokenResponse { if (!originalResponse) { @@ -56,12 +56,12 @@ export class ResponseHandler { } else if (!idTokenObj) { return originalResponse; } - + const expiresSeconds = Number(idTokenObj.claims.exp); if (expiresSeconds && !originalResponse.expiresOn) { originalResponse.expiresOn = new Date(expiresSeconds * 1000); } - + return { ...originalResponse, idToken: idTokenObj.rawIdToken, @@ -73,7 +73,7 @@ export class ResponseHandler { /** * Validates and handles a response from the server, and returns a constructed object with the authorization code and state. - * @param serverParams + * @param serverParams */ public handleServerCodeResponse(serverParams: ServerAuthorizationCodeResponse): CodeResponse { try { @@ -100,20 +100,20 @@ export class ResponseHandler { /** * Function which validates server authorization code response. - * @param serverResponseHash - * @param cachedState - * @param cryptoObj + * @param serverResponseHash + * @param cachedState + * @param cryptoObj */ private validateServerAuthorizationCodeResponse(serverResponseHash: ServerAuthorizationCodeResponse, cachedState: string, cryptoObj: ICrypto): void { if (serverResponseHash.state !== cachedState) { throw ClientAuthError.createStateMismatchError(); } - + // Check for error if (serverResponseHash.error || serverResponseHash.error_description) { throw new ServerError(serverResponseHash.error, serverResponseHash.error_description); } - + if (serverResponseHash.client_info) { buildClientInfo(serverResponseHash.client_info, cryptoObj); } @@ -121,7 +121,7 @@ export class ResponseHandler { /** * Function which validates server authorization token response. - * @param serverResponse + * @param serverResponse */ public validateServerAuthorizationTokenResponse(serverResponse: ServerAuthorizationTokenResponse): void { // Check for error @@ -133,11 +133,11 @@ export class ResponseHandler { /** * Helper function which saves or updates the token in the cache and constructs the final token response to send back to the user. - * @param originalTokenResponse - * @param authority - * @param resource - * @param serverTokenResponse - * @param clientInfo + * @param originalTokenResponse + * @param authority + * @param resource + * @param serverTokenResponse + * @param clientInfo */ private saveToken(originalTokenResponse: TokenResponse, authority: string, resource: string, serverTokenResponse: ServerAuthorizationTokenResponse, clientInfo: ClientInfo): TokenResponse { // Set consented scopes in response @@ -163,12 +163,12 @@ export class ResponseHandler { if (accessTokenCacheItems.length < 1) { this.logger.info("No tokens found, creating new item."); const newTokenKey = new AccessTokenKey( - authority, - this.clientId, - serverTokenResponse.scope, - resource, - clientInfo && clientInfo.uid, - clientInfo && clientInfo.utid, + authority, + this.clientId, + serverTokenResponse.scope, + resource, + clientInfo && clientInfo.uid, + clientInfo && clientInfo.utid, this.cryptoObj ); this.cacheStorage.setItem(JSON.stringify(newTokenKey), JSON.stringify(newAccessTokenValue)); @@ -201,7 +201,7 @@ export class ResponseHandler { /** * Gets account cached with given key. Returns null if parsing could not be completed. - * @param accountKey + * @param accountKey */ private getCachedAccount(accountKey: string): Account { try { @@ -214,10 +214,10 @@ export class ResponseHandler { /** * Returns a constructed token response based on given string. Also manages the cache updates and cleanups. - * @param serverTokenResponse - * @param authorityString - * @param resource - * @param state + * @param serverTokenResponse + * @param authorityString + * @param resource + * @param state */ public createTokenResponse(serverTokenResponse: ServerAuthorizationTokenResponse, authorityString: string, resource: string, state?: string): TokenResponse { let tokenResponse: TokenResponse = { @@ -253,7 +253,7 @@ export class ResponseHandler { // If state is empty, refresh token is being used if (!StringUtils.isEmpty(state)) { this.logger.info("State was detected - nonce should be available."); - // check nonce integrity if refresh token is not used - throw an error if not matched + // check nonce integrity if refresh token is not used - throw an error if not matched if (StringUtils.isEmpty(idTokenObj.claims.nonce)) { throw ClientAuthError.createInvalidIdTokenError(idTokenObj); } @@ -272,7 +272,7 @@ export class ResponseHandler { // Save the access token if it exists const accountKey = this.cacheManager.generateAcquireTokenAccountKey(tokenResponse.account.homeAccountIdentifier); - + // Get cached account cachedAccount = this.getCachedAccount(accountKey); } diff --git a/lib/msal-common/src/response/TokenResponse.ts b/lib/msal-common/src/response/TokenResponse.ts index 02d6d9d9f2..7e988d55da 100644 --- a/lib/msal-common/src/response/TokenResponse.ts +++ b/lib/msal-common/src/response/TokenResponse.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ import { AuthResponse } from "./AuthResponse"; -import { Account } from "../auth/Account"; +import { Account } from "../account/Account"; import { StringDict } from "../utils/MsalTypes"; /** diff --git a/lib/msal-common/src/server/ServerCodeRequestParameters.ts b/lib/msal-common/src/server/ServerCodeRequestParameters.ts index 99224c873c..15005b69ef 100644 --- a/lib/msal-common/src/server/ServerCodeRequestParameters.ts +++ b/lib/msal-common/src/server/ServerCodeRequestParameters.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. */ import pkg from "../../package.json"; -import { Authority } from "../auth/authority/Authority"; -import { Account } from "../auth/Account"; +import { Authority } from "../authority/Authority"; +import { Account } from "../account/Account"; import { ICrypto, PkceCodes } from "../crypto/ICrypto"; -import { ScopeSet } from "../auth/ScopeSet"; -import { IdToken } from "../auth/IdToken"; +import { ScopeSet } from "../request/ScopeSet"; +import { IdToken } from "../account/IdToken"; import { AuthenticationParameters, validateClaimsRequest } from "../request/AuthenticationParameters"; import { ClientConfigurationError } from "../error/ClientConfigurationError"; import { StringUtils } from "../utils/StringUtils"; @@ -21,7 +21,7 @@ import { StringDict } from "../utils/MsalTypes"; export class ServerCodeRequestParameters { // Crypto functions - private cryptoObj: ICrypto; + private cryptoObj: ICrypto; // Telemetry Info xClientVer: string; @@ -40,7 +40,7 @@ export class ServerCodeRequestParameters { // Generated Params generatedPkce: PkceCodes; - + // Validity checks state: string; nonce: string; @@ -64,8 +64,8 @@ export class ServerCodeRequestParameters { // Set scopes, append extra scopes if there is a login call. this.scopes = new ScopeSet( - (this.userRequest && this.userRequest.scopes) || [], - this.clientId, + (this.userRequest && this.userRequest.scopes) || [], + this.clientId, !isLoginCall ); if (isLoginCall) { @@ -150,7 +150,7 @@ export class ServerCodeRequestParameters { /** * Utility to populate QueryParameters and ExtraQueryParameters to ServerRequestParamerers - * @param adalIdTokenObject + * @param adalIdTokenObject */ populateQueryParams(adalIdTokenObject?: IdToken): void { let queryParameters: StringDict = {}; diff --git a/lib/msal-common/src/server/ServerTokenRequestParameters.ts b/lib/msal-common/src/server/ServerTokenRequestParameters.ts index 6d1929d228..6e7b6d64ee 100644 --- a/lib/msal-common/src/server/ServerTokenRequestParameters.ts +++ b/lib/msal-common/src/server/ServerTokenRequestParameters.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ import pkg from "../../package.json"; -import { ScopeSet } from "../auth/ScopeSet"; +import { ScopeSet } from "../request/ScopeSet"; import { TokenExchangeParameters } from "../request/TokenExchangeParameters"; import { CodeResponse } from "../response/CodeResponse"; import { ClientAuthError } from "../error/ClientAuthError"; @@ -49,8 +49,8 @@ export class ServerTokenRequestParameters { // Set scopes, always required for token request/exchange this.scopes = new ScopeSet( - (this.tokenRequest && this.tokenRequest.scopes) || [], - this.clientId, + (this.tokenRequest && this.tokenRequest.scopes) || [], + this.clientId, true ); diff --git a/lib/msal-common/src/utils/StringUtils.ts b/lib/msal-common/src/utils/StringUtils.ts index d97aabc7b4..f52dcfd5b2 100644 --- a/lib/msal-common/src/utils/StringUtils.ts +++ b/lib/msal-common/src/utils/StringUtils.ts @@ -2,14 +2,14 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { DecodedJwt } from "../auth/DecodedJwt"; +import { DecodedJwt } from "../account/DecodedJwt"; import { ClientAuthError } from "../error/ClientAuthError"; /** * @hidden */ export class StringUtils { - + /** * decode a JWT * @@ -71,7 +71,7 @@ export class StringUtils { /** * Removes empty strings from array - * @param arr + * @param arr */ static removeEmptyStringsFromArray(arr: Array): Array { return arr.filter(entry => { From feae5e2ce902f2db45e2040f1225ade73c7be3a6 Mon Sep 17 00:00:00 2001 From: sameerag Date: Mon, 2 Mar 2020 11:20:20 -0800 Subject: [PATCH 07/10] Adding tests --- .../Client.spec.ts} | 60 ++--- .../PublicClient.spec.ts} | 212 +++++++++--------- .../Configuration.spec.ts} | 14 +- .../PublicClientConfiguration.spec.ts} | 16 +- 4 files changed, 151 insertions(+), 151 deletions(-) rename lib/msal-common/test/{app/module/AuthModule.spec.ts => client/Client.spec.ts} (76%) rename lib/msal-common/test/{app/module/AuthorizationCodeModule.spec.ts => client/PublicClient.spec.ts} (83%) rename lib/msal-common/test/{app/config/ModuleConfiguration.spec.ts => config/Configuration.spec.ts} (94%) rename lib/msal-common/test/{app/config/PublicClientSPAConfiguration.spec.ts => config/PublicClientConfiguration.spec.ts} (94%) diff --git a/lib/msal-common/test/app/module/AuthModule.spec.ts b/lib/msal-common/test/client/Client.spec.ts similarity index 76% rename from lib/msal-common/test/app/module/AuthModule.spec.ts rename to lib/msal-common/test/client/Client.spec.ts index e59437308b..4d095401f2 100644 --- a/lib/msal-common/test/app/module/AuthModule.spec.ts +++ b/lib/msal-common/test/client/Client.spec.ts @@ -3,22 +3,22 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; const expect = chai.expect; chai.use(chaiAsPromised); -import { AuthModule } from "../../../src/app/module/AuthModule"; -import { ModuleConfiguration } from "../../../src/app/config/ModuleConfiguration"; -import { AuthenticationParameters } from "../../../src/request/AuthenticationParameters"; -import { TokenResponse } from "../../../src/response/TokenResponse"; -import { CodeResponse } from "../../../src/response/CodeResponse"; -import { TokenRenewParameters } from "../../../src/request/TokenRenewParameters"; +import { Client } from "../../src/client/Client"; +import { Configuration } from "../../src/config/Configuration"; +import { AuthenticationParameters } from "../../src/request/AuthenticationParameters"; +import { TokenResponse } from "../../src/response/TokenResponse"; +import { CodeResponse } from "../../src/response/CodeResponse"; +import { TokenRenewParameters } from "../../src/request/TokenRenewParameters"; import sinon from "sinon"; -import { Account, PkceCodes, PersistentCacheKeys, ICrypto } from "../../../src"; -import { TEST_TOKENS, TEST_DATA_CLIENT_INFO, TEST_CONFIG, RANDOM_TEST_GUID } from "../../utils/StringConstants"; -import { buildClientInfo, ClientInfo } from "../../../src/auth/ClientInfo"; -import { IdToken } from "../../../src/auth/IdToken"; -import { IdTokenClaims } from "../../../src/auth/IdTokenClaims"; - -class TestAuthModule extends AuthModule { - - constructor(config: ModuleConfiguration, testAccount: Account) { +import { Account, PkceCodes, PersistentCacheKeys, ICrypto } from "../../src"; +import { TEST_TOKENS, TEST_DATA_CLIENT_INFO, TEST_CONFIG, RANDOM_TEST_GUID } from "../utils/StringConstants"; +import { buildClientInfo, ClientInfo } from "../../src/auth/ClientInfo"; +import { IdToken } from "../../src/auth/IdToken"; +import { IdTokenClaims } from "../../src/auth/IdTokenClaims"; + +class TestClient extends Client { + + constructor(config: Configuration, testAccount: Account) { super(config); this.account = testAccount } @@ -29,8 +29,8 @@ class TestAuthModule extends AuthModule { createLoginUrl(request: AuthenticationParameters): Promise { throw new Error("Method not implemented."); - } - + } + createAcquireTokenUrl(request: AuthenticationParameters): Promise { throw new Error("Method not implemented."); } @@ -52,23 +52,23 @@ describe("AuthModule.ts Class Unit Tests", () => { describe("Constructor", () => { it("Creates a valid AuthModule object", () => { - let config: ModuleConfiguration = { + let config: Configuration = { systemOptions: null, cryptoInterface: null, networkInterface: null, storageInterface: null, loggerOptions: null }; - let authModule = new TestAuthModule(config, null); - expect(authModule).to.be.not.null; - expect(authModule instanceof AuthModule).to.be.true; + let client = new TestClient(config, null); + expect(client).to.be.not.null; + expect(client instanceof Client).to.be.true; }); }); describe("getAccount()", () => { let store; - let config: ModuleConfiguration; - let authModule: TestAuthModule; + let config: Configuration; + let client: TestClient; let idToken: IdToken; let clientInfo: ClientInfo; let testAccount: Account; @@ -146,20 +146,20 @@ describe("AuthModule.ts Class Unit Tests", () => { }); it("returns null if nothing is in the cache", () => { - authModule = new TestAuthModule(config, null); - expect(authModule.getAccount()).to.be.null; + client = new TestClient(config, null); + expect(client.getAccount()).to.be.null; }); it("returns the current account if it exists", () => { - authModule = new TestAuthModule(config, testAccount); - expect(Account.compareAccounts(authModule.getAccount(), testAccount)).to.be.true; + client = new TestClient(config, testAccount); + expect(Account.compareAccounts(client.getAccount(), testAccount)).to.be.true; }); - + it("Creates account object from cached id token and client info", () => { store[PersistentCacheKeys.ID_TOKEN] = idToken; store[PersistentCacheKeys.CLIENT_INFO] = clientInfo; - authModule = new TestAuthModule(config, null); - expect(Account.compareAccounts(authModule.getAccount(), testAccount)).to.be.true; + client = new TestClient(config, null); + expect(Account.compareAccounts(client.getAccount(), testAccount)).to.be.true; }); }); }); diff --git a/lib/msal-common/test/app/module/AuthorizationCodeModule.spec.ts b/lib/msal-common/test/client/PublicClient.spec.ts similarity index 83% rename from lib/msal-common/test/app/module/AuthorizationCodeModule.spec.ts rename to lib/msal-common/test/client/PublicClient.spec.ts index ce6464e33e..8332c4fe20 100644 --- a/lib/msal-common/test/app/module/AuthorizationCodeModule.spec.ts +++ b/lib/msal-common/test/client/PublicClient.spec.ts @@ -3,32 +3,32 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; const expect = chai.expect; chai.use(chaiAsPromised); -import { AuthorizationCodeModule } from "../../../src/app/module/AuthorizationCodeModule"; -import { TEST_CONFIG, TEST_URIS, RANDOM_TEST_GUID, DEFAULT_OPENID_CONFIG_RESPONSE, TEST_TOKENS, ALTERNATE_OPENID_CONFIG_RESPONSE, TEST_DATA_CLIENT_INFO, TEST_TOKEN_LIFETIMES } from "../../utils/StringConstants"; -import { AuthModule } from "../../../src/app/module/AuthModule"; -import { AuthenticationParameters } from "../../../src/request/AuthenticationParameters"; -import { ClientConfigurationError, ClientConfigurationErrorMessage } from "../../../src/error/ClientConfigurationError"; +import { PublicClient } from "../../src/client/PublicClient"; +import { TEST_CONFIG, TEST_URIS, RANDOM_TEST_GUID, DEFAULT_OPENID_CONFIG_RESPONSE, TEST_TOKENS, ALTERNATE_OPENID_CONFIG_RESPONSE, TEST_DATA_CLIENT_INFO, TEST_TOKEN_LIFETIMES } from "../utils/StringConstants"; +import { Client } from "../../src/client/Client"; +import { AuthenticationParameters } from "../../src/request/AuthenticationParameters"; +import { ClientConfigurationError, ClientConfigurationErrorMessage } from "../../src/error/ClientConfigurationError"; import sinon from "sinon"; -import { AADServerParamKeys, TemporaryCacheKeys, PersistentCacheKeys, Constants } from "../../../src/utils/Constants"; -import { ServerCodeRequestParameters } from "../../../src/server/ServerCodeRequestParameters"; -import { IdTokenClaims } from "../../../src/auth/IdTokenClaims"; -import { IdToken } from "../../../src/auth/IdToken"; -import { LogLevel } from "../../../src/logger/Logger"; -import { PublicClientSPAConfiguration } from "../../../src/app/config/PublicClientSPAConfiguration"; -import { NetworkRequestOptions } from "../../../src/network/INetworkModule"; -import { Authority } from "../../../src/auth/authority/Authority"; -import { PkceCodes } from "../../../src/crypto/ICrypto"; -import { TokenExchangeParameters } from "../../../src/request/TokenExchangeParameters"; -import { ClientAuthErrorMessage } from "../../../src/error/ClientAuthError"; -import { AuthError } from "../../../src/error/AuthError"; -import { CodeResponse } from "../../../src/response/CodeResponse"; -import { TokenResponse, Account, AuthorityFactory, TokenRenewParameters } from "../../../src"; -import { buildClientInfo } from "../../../src/auth/ClientInfo"; -import { TimeUtils } from "../../../src/utils/TimeUtils"; -import { AccessTokenKey } from "../../../src/cache/AccessTokenKey"; -import { AccessTokenValue } from "../../../src/cache/AccessTokenValue"; - -describe("AuthorizationCodeModule.ts Class Unit Tests", () => { +import { AADServerParamKeys, TemporaryCacheKeys, PersistentCacheKeys, Constants } from "../../src/utils/Constants"; +import { ServerCodeRequestParameters } from "../../src/server/ServerCodeRequestParameters"; +import { IdTokenClaims } from "../../src/auth/IdTokenClaims"; +import { IdToken } from "../../src/auth/IdToken"; +import { LogLevel } from "../../src/logger/Logger"; +import { PublicClientConfiguration } from "../../src/config/PublicClientConfiguration"; +import { NetworkRequestOptions } from "../../src/network/INetworkModule"; +import { Authority } from "../../src/auth/authority/Authority"; +import { PkceCodes } from "../../src/crypto/ICrypto"; +import { TokenExchangeParameters } from "../../src/request/TokenExchangeParameters"; +import { ClientAuthErrorMessage } from "../../src/error/ClientAuthError"; +import { AuthError } from "../../src/error/AuthError"; +import { CodeResponse } from "../../src/response/CodeResponse"; +import { TokenResponse, Account, AuthorityFactory, TokenRenewParameters } from "../../src"; +import { buildClientInfo } from "../../src/auth/ClientInfo"; +import { TimeUtils } from "../../src/utils/TimeUtils"; +import { AccessTokenKey } from "../../src/cache/AccessTokenKey"; +import { AccessTokenValue } from "../../src/cache/AccessTokenValue"; + +describe("PublicClient.ts Class Unit Tests", () => { const testLoggerCallback = (level: LogLevel, message: string, containsPii: boolean): void => { if (containsPii) { @@ -37,7 +37,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { } let store = {}; - let defaultAuthConfig: PublicClientSPAConfiguration; + let defaultAuthConfig: PublicClientConfiguration; beforeEach(() => { defaultAuthConfig = { @@ -101,30 +101,30 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { describe("Constructor", () => { - it("creates an AuthorizationCodeModule that extends the AuthModule", () => { - const authModule = new AuthorizationCodeModule(defaultAuthConfig); - expect(authModule).to.be.not.null; - expect(authModule instanceof AuthorizationCodeModule).to.be.true; - expect(authModule instanceof AuthModule).to.be.true; + it("creates an PublicClient that extends the Client", () => { + const client = new PublicClient(defaultAuthConfig); + expect(client).to.be.not.null; + expect(client instanceof PublicClient).to.be.true; + expect(client instanceof Client).to.be.true; }); }); describe("Login Url Creation", () => { - let authModule: AuthorizationCodeModule; + let Client: PublicClient; beforeEach(() => { sinon.stub(Authority.prototype, "discoverEndpoints").resolves(DEFAULT_OPENID_CONFIG_RESPONSE); - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); }); afterEach(() => { sinon.restore(); store = {}; }); - + it("Creates a login URL with default scopes", async () => { const emptyRequest: AuthenticationParameters = {}; - const loginUrl = await authModule.createLoginUrl(emptyRequest); + const loginUrl = await Client.createLoginUrl(emptyRequest); expect(loginUrl).to.contain(Constants.DEFAULT_AUTHORITY); expect(loginUrl).to.contain(DEFAULT_OPENID_CONFIG_RESPONSE.authorization_endpoint.replace("{tenant}", "common")); expect(loginUrl).to.contain(`${AADServerParamKeys.SCOPE}=${Constants.OPENID_SCOPE}%20${Constants.PROFILE_SCOPE}%20${Constants.OFFLINE_ACCESS_SCOPE}`); @@ -139,13 +139,13 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const loginRequest: AuthenticationParameters = { scopes: [testScope1, testScope2] }; - const loginUrl = await authModule.createLoginUrl(loginRequest); + const loginUrl = await Client.createLoginUrl(loginRequest); expect(loginUrl).to.contain(`${AADServerParamKeys.SCOPE}=${encodeURIComponent(`${testScope1} ${testScope2} ${Constants.OPENID_SCOPE} ${Constants.PROFILE_SCOPE} ${Constants.OFFLINE_ACCESS_SCOPE}`)}`); }); it("Updates cache entries correctly", async () => { const emptyRequest: AuthenticationParameters = {}; - await authModule.createLoginUrl(emptyRequest); + await Client.createLoginUrl(emptyRequest); expect(defaultAuthConfig.storageInterface.getItem(TemporaryCacheKeys.REQUEST_STATE)).to.be.deep.eq(RANDOM_TEST_GUID); expect(defaultAuthConfig.storageInterface.getItem(`${TemporaryCacheKeys.NONCE_IDTOKEN}|${RANDOM_TEST_GUID}`)).to.be.eq(RANDOM_TEST_GUID); expect(defaultAuthConfig.storageInterface.getItem(`${TemporaryCacheKeys.AUTHORITY}|${RANDOM_TEST_GUID}`)).to.be.eq(`${Constants.DEFAULT_AUTHORITY}/`); @@ -153,7 +153,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { it("Caches token request correctly", async () => { const emptyRequest: AuthenticationParameters = {}; - await authModule.createLoginUrl(emptyRequest); + await Client.createLoginUrl(emptyRequest); const cachedRequest: TokenExchangeParameters = JSON.parse(defaultAuthConfig.storageInterface.getItem(TemporaryCacheKeys.REQUEST_PARAMS)); expect(cachedRequest.scopes).to.be.deep.eq([TEST_CONFIG.MSAL_CLIENT_ID]); expect(cachedRequest.codeVerifier).to.be.deep.eq(TEST_CONFIG.TEST_VERIFIER); @@ -169,7 +169,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const loginRequest: AuthenticationParameters = { authority: `${TEST_URIS.ALTERNATE_INSTANCE}/common` }; - const loginUrl = await authModule.createLoginUrl(loginRequest); + const loginUrl = await Client.createLoginUrl(loginRequest); expect(loginUrl).to.contain(TEST_URIS.ALTERNATE_INSTANCE); expect(loginUrl).to.contain(ALTERNATE_OPENID_CONFIG_RESPONSE.authorization_endpoint); expect(loginUrl).to.contain(`${AADServerParamKeys.SCOPE}=${encodeURIComponent(`${Constants.OPENID_SCOPE} ${Constants.PROFILE_SCOPE} ${Constants.OFFLINE_ACCESS_SCOPE}`)}`); @@ -183,7 +183,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const exceptionString = "Could not make a network request." sinon.stub(Authority.prototype, "resolveEndpointsAsync").throwsException(exceptionString); const emptyRequest: AuthenticationParameters = {}; - await expect(authModule.createLoginUrl(emptyRequest)).to.be.rejectedWith(`${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${exceptionString}`); + await expect(Client.createLoginUrl(emptyRequest)).to.be.rejectedWith(`${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${exceptionString}`); }); it("Cleans cache before error is thrown", async () => { @@ -192,8 +192,8 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { defaultAuthConfig.cryptoInterface.createNewGuid = (): string => { throw AuthError.createUnexpectedError(guidCreationErr); }; - authModule = new AuthorizationCodeModule(defaultAuthConfig); - await expect(authModule.createLoginUrl(emptyRequest)).to.be.rejectedWith(guidCreationErr); + Client = new PublicClient(defaultAuthConfig); + await expect(Client.createLoginUrl(emptyRequest)).to.be.rejectedWith(guidCreationErr); expect(defaultAuthConfig.storageInterface.getKeys()).to.be.empty; }); @@ -212,9 +212,9 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { defaultAuthConfig.storageInterface.setItem(PersistentCacheKeys.ADAL_ID_TOKEN, TEST_TOKENS.IDTOKEN_V1); const testToken = new IdToken(TEST_TOKENS.IDTOKEN_V1, defaultAuthConfig.cryptoInterface); const queryParamSpy = sinon.spy(ServerCodeRequestParameters.prototype, "populateQueryParams"); - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); const emptyRequest: AuthenticationParameters = {}; - await authModule.createLoginUrl(emptyRequest); + await Client.createLoginUrl(emptyRequest); expect(queryParamSpy.calledWith(testToken)).to.be.true; }); @@ -233,35 +233,35 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { defaultAuthConfig.storageInterface.setItem(PersistentCacheKeys.ADAL_ID_TOKEN, TEST_TOKENS.IDTOKEN_V1); const testToken = new IdToken(TEST_TOKENS.IDTOKEN_V1, defaultAuthConfig.cryptoInterface); const queryParamSpy = sinon.spy(ServerCodeRequestParameters.prototype, "populateQueryParams"); - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); const loginRequest: AuthenticationParameters = { loginHint: "AbeLi@microsoft.com" }; - await authModule.createLoginUrl(loginRequest); + await Client.createLoginUrl(loginRequest); expect(queryParamSpy.calledWith(testToken)).to.be.false; expect(queryParamSpy.calledWith(null)).to.be.true; }); }); describe("Acquire Token Url Creation", () => { - let authModule: AuthorizationCodeModule; + let Client: PublicClient; beforeEach(() => { sinon.stub(Authority.prototype, "discoverEndpoints").resolves(DEFAULT_OPENID_CONFIG_RESPONSE); - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); }); afterEach(() => { sinon.restore(); store = {}; }); - + it("Creates a acquire token URL with scopes from given token request", async () => { const testScope1 = "testscope1"; const testScope2 = "testscope2"; const tokenRequest: AuthenticationParameters = { scopes: [testScope1, testScope2] }; - const acquireTokenUrl = await authModule.createAcquireTokenUrl(tokenRequest); + const acquireTokenUrl = await Client.createAcquireTokenUrl(tokenRequest); expect(acquireTokenUrl).to.contain(Constants.DEFAULT_AUTHORITY); expect(acquireTokenUrl).to.contain(DEFAULT_OPENID_CONFIG_RESPONSE.authorization_endpoint.replace("{tenant}", "common")); expect(acquireTokenUrl).to.contain(`${AADServerParamKeys.SCOPE}=${encodeURIComponent(`${testScope1} ${testScope2} ${Constants.OFFLINE_ACCESS_SCOPE}`)}`); @@ -274,7 +274,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const tokenRequest: AuthenticationParameters = { scopes: [TEST_CONFIG.MSAL_CLIENT_ID] }; - const acquireTokenUrl = await authModule.createAcquireTokenUrl(tokenRequest); + const acquireTokenUrl = await Client.createAcquireTokenUrl(tokenRequest); expect(acquireTokenUrl).to.contain(Constants.DEFAULT_AUTHORITY); expect(acquireTokenUrl).to.contain(DEFAULT_OPENID_CONFIG_RESPONSE.authorization_endpoint.replace("{tenant}", "common")); expect(acquireTokenUrl).to.contain(`${AADServerParamKeys.SCOPE}=${encodeURIComponent(`${Constants.OPENID_SCOPE} ${Constants.PROFILE_SCOPE} ${Constants.OFFLINE_ACCESS_SCOPE}`)}`); @@ -285,14 +285,14 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { it("Throws error if no scopes are passed to createAcquireTokenUrl", async () => { const emptyRequest: AuthenticationParameters = {}; - await expect(authModule.createAcquireTokenUrl(emptyRequest)).to.be.rejectedWith(ClientConfigurationErrorMessage.emptyScopesError.desc); + await expect(Client.createAcquireTokenUrl(emptyRequest)).to.be.rejectedWith(ClientConfigurationErrorMessage.emptyScopesError.desc); }); it("Throws error if empty scopes are passed to createAcquireTokenUrl", async () => { const emptyRequest: AuthenticationParameters = { scopes: [] }; - await expect(authModule.createAcquireTokenUrl(emptyRequest)).to.be.rejectedWith(ClientConfigurationErrorMessage.emptyScopesError.desc); + await expect(Client.createAcquireTokenUrl(emptyRequest)).to.be.rejectedWith(ClientConfigurationErrorMessage.emptyScopesError.desc); }); it("Updates cache entries correctly", async () => { @@ -300,7 +300,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const tokenRequest: AuthenticationParameters = { scopes: [testScope] }; - await authModule.createAcquireTokenUrl(tokenRequest); + await Client.createAcquireTokenUrl(tokenRequest); expect(defaultAuthConfig.storageInterface.getItem(TemporaryCacheKeys.REQUEST_STATE)).to.be.deep.eq(RANDOM_TEST_GUID); expect(defaultAuthConfig.storageInterface.getItem(`${TemporaryCacheKeys.NONCE_IDTOKEN}|${RANDOM_TEST_GUID}`)).to.be.eq(RANDOM_TEST_GUID); expect(defaultAuthConfig.storageInterface.getItem(`${TemporaryCacheKeys.AUTHORITY}|${RANDOM_TEST_GUID}`)).to.be.eq(`${Constants.DEFAULT_AUTHORITY}/`); @@ -311,7 +311,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const tokenRequest: AuthenticationParameters = { scopes: [testScope] }; - await authModule.createAcquireTokenUrl(tokenRequest); + await Client.createAcquireTokenUrl(tokenRequest); const cachedRequest: TokenExchangeParameters = JSON.parse(defaultAuthConfig.storageInterface.getItem(TemporaryCacheKeys.REQUEST_PARAMS)); expect(cachedRequest.scopes).to.be.deep.eq([testScope]); expect(cachedRequest.codeVerifier).to.be.deep.eq(TEST_CONFIG.TEST_VERIFIER); @@ -328,7 +328,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { authority: `${TEST_URIS.ALTERNATE_INSTANCE}/common`, scopes: [TEST_CONFIG.MSAL_CLIENT_ID] }; - const acquireTokenUrl = await authModule.createAcquireTokenUrl(tokenRequest); + const acquireTokenUrl = await Client.createAcquireTokenUrl(tokenRequest); expect(acquireTokenUrl).to.contain(TEST_URIS.ALTERNATE_INSTANCE); expect(acquireTokenUrl).to.contain(ALTERNATE_OPENID_CONFIG_RESPONSE.authorization_endpoint); expect(acquireTokenUrl).to.contain(`${AADServerParamKeys.SCOPE}=${encodeURIComponent(`${Constants.OPENID_SCOPE} ${Constants.PROFILE_SCOPE} ${Constants.OFFLINE_ACCESS_SCOPE}`)}`); @@ -342,9 +342,9 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const exceptionString = "Could not make a network request." sinon.stub(Authority.prototype, "resolveEndpointsAsync").throwsException(exceptionString); const tokenRequest: AuthenticationParameters = { - scopes: [TEST_CONFIG.MSAL_CLIENT_ID] + scopes: [TEST_CONFIG.MSAL_CLIENT_ID] }; - await expect(authModule.createAcquireTokenUrl(tokenRequest)).to.be.rejectedWith(`${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${exceptionString}`); + await expect(Client.createAcquireTokenUrl(tokenRequest)).to.be.rejectedWith(`${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${exceptionString}`); }); it("Cleans cache before error is thrown", async () => { @@ -355,8 +355,8 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { defaultAuthConfig.cryptoInterface.createNewGuid = (): string => { throw AuthError.createUnexpectedError(guidCreationErr); }; - authModule = new AuthorizationCodeModule(defaultAuthConfig); - await expect(authModule.createAcquireTokenUrl(tokenRequest)).to.be.rejectedWith(guidCreationErr); + Client = new PublicClient(defaultAuthConfig); + await expect(Client.createAcquireTokenUrl(tokenRequest)).to.be.rejectedWith(guidCreationErr); expect(defaultAuthConfig.storageInterface.getKeys()).to.be.empty; }); @@ -375,11 +375,11 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { defaultAuthConfig.storageInterface.setItem(PersistentCacheKeys.ADAL_ID_TOKEN, TEST_TOKENS.IDTOKEN_V1); const testToken = new IdToken(TEST_TOKENS.IDTOKEN_V1, defaultAuthConfig.cryptoInterface); const queryParamSpy = sinon.spy(ServerCodeRequestParameters.prototype, "populateQueryParams"); - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); const tokenRequest: AuthenticationParameters = { scopes: [TEST_CONFIG.MSAL_CLIENT_ID] }; - await authModule.createAcquireTokenUrl(tokenRequest); + await Client.createAcquireTokenUrl(tokenRequest); expect(queryParamSpy.calledWith(testToken)).to.be.true; }); @@ -398,12 +398,12 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { defaultAuthConfig.storageInterface.setItem(PersistentCacheKeys.ADAL_ID_TOKEN, TEST_TOKENS.IDTOKEN_V1); const testToken = new IdToken(TEST_TOKENS.IDTOKEN_V1, defaultAuthConfig.cryptoInterface); const queryParamSpy = sinon.spy(ServerCodeRequestParameters.prototype, "populateQueryParams"); - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); const tokenRequest: AuthenticationParameters = { scopes: [TEST_CONFIG.MSAL_CLIENT_ID], loginHint: "AbeLi@microsoft.com" }; - await authModule.createAcquireTokenUrl(tokenRequest); + await Client.createAcquireTokenUrl(tokenRequest); expect(queryParamSpy.calledWith(testToken)).to.be.false; expect(queryParamSpy.calledWith(null)).to.be.true; }); @@ -412,9 +412,9 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { describe("Token Acquisition", () => { describe("Exchange code for token with acquireToken()", () => { - let authModule: AuthorizationCodeModule; + let Client: PublicClient; beforeEach(() => { - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); }); afterEach(() => { @@ -425,7 +425,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { describe("Error Cases", () => { it("Throws error if null code response is passed", async () => { - await expect(authModule.acquireToken(null)).to.be.rejectedWith(ClientAuthErrorMessage.tokenRequestCannotBeMade.desc); + await expect(Client.acquireToken(null)).to.be.rejectedWith(ClientAuthErrorMessage.tokenRequestCannotBeMade.desc); expect(defaultAuthConfig.storageInterface.getKeys()).to.be.empty; }); @@ -434,7 +434,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { code: null, userRequestState: RANDOM_TEST_GUID }; - await expect(authModule.acquireToken(codeResponse)).to.be.rejectedWith(ClientAuthErrorMessage.tokenRequestCannotBeMade.desc); + await expect(Client.acquireToken(codeResponse)).to.be.rejectedWith(ClientAuthErrorMessage.tokenRequestCannotBeMade.desc); expect(defaultAuthConfig.storageInterface.getKeys()).to.be.empty; }); @@ -443,7 +443,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { code: "This is an auth code", userRequestState: RANDOM_TEST_GUID }; - await expect(authModule.acquireToken(codeResponse)).to.be.rejectedWith(ClientAuthErrorMessage.tokenRequestCacheError.desc); + await expect(Client.acquireToken(codeResponse)).to.be.rejectedWith(ClientAuthErrorMessage.tokenRequestCacheError.desc); expect(defaultAuthConfig.storageInterface.getKeys()).to.be.empty; }); @@ -460,7 +460,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { code: "This is an auth code", userRequestState: RANDOM_TEST_GUID }; - await expect(authModule.acquireToken(codeResponse)).to.be.rejectedWith(ClientAuthErrorMessage.tokenRequestCacheError.desc); + await expect(Client.acquireToken(codeResponse)).to.be.rejectedWith(ClientAuthErrorMessage.tokenRequestCacheError.desc); expect(defaultAuthConfig.storageInterface.getKeys()).to.be.empty; }); @@ -471,7 +471,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { }; const exceptionString = "Could not make a network request." sinon.stub(Authority.prototype, "resolveEndpointsAsync").throwsException(exceptionString); - + const cachedRequest: TokenExchangeParameters = { authority: Constants.DEFAULT_AUTHORITY, codeVerifier: TEST_CONFIG.TEST_VERIFIER, @@ -480,10 +480,10 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { }; const stringifiedRequest = JSON.stringify(cachedRequest); defaultAuthConfig.storageInterface.setItem(TemporaryCacheKeys.REQUEST_PARAMS, stringifiedRequest); - await expect(authModule.acquireToken(codeResponse)).to.be.rejectedWith(`${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${exceptionString}`); + await expect(Client.acquireToken(codeResponse)).to.be.rejectedWith(`${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${exceptionString}`); }); }); - + describe("Success Cases", () => { let codeResponse: CodeResponse; @@ -519,7 +519,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { return input; } }; - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); testState = "{stateObject}"; codeResponse = { @@ -547,12 +547,12 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { // Set up cache defaultAuthConfig.storageInterface.setItem(`${TemporaryCacheKeys.NONCE_IDTOKEN}|${codeResponse.userRequestState}`, "123523"); defaultAuthConfig.storageInterface.setItem(PersistentCacheKeys.CLIENT_INFO, TEST_DATA_CLIENT_INFO.TEST_RAW_CLIENT_INFO); - + // Build Test account const idToken = new IdToken(TEST_TOKENS.IDTOKEN_V2, defaultAuthConfig.cryptoInterface); const clientInfo = buildClientInfo(TEST_DATA_CLIENT_INFO.TEST_RAW_CLIENT_INFO, defaultAuthConfig.cryptoInterface); - const testAccount = Account.createAccount(idToken, clientInfo, defaultAuthConfig.cryptoInterface); - + const testAccount = Account.createAccount(idToken, clientInfo, defaultAuthConfig.cryptoInterface); + const cachedRequest: TokenExchangeParameters = { authority: Constants.DEFAULT_AUTHORITY, codeVerifier: TEST_CONFIG.TEST_VERIFIER, @@ -562,9 +562,9 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const stringifiedRequest = JSON.stringify(cachedRequest); defaultAuthConfig.storageInterface.setItem(TemporaryCacheKeys.REQUEST_PARAMS, stringifiedRequest); defaultAuthConfig.storageInterface.setItem(`${TemporaryCacheKeys.AUTHORITY}${Constants.RESOURCE_DELIM}${RANDOM_TEST_GUID}`, `${TEST_URIS.DEFAULT_INSTANCE}/common/`); - + // Perform test - const tokenResponse: TokenResponse = await authModule.acquireToken(codeResponse); + const tokenResponse: TokenResponse = await Client.acquireToken(codeResponse); expect(tokenResponse.uniqueId).to.be.deep.eq(idTokenClaims.oid); expect(tokenResponse.tenantId).to.be.deep.eq(idTokenClaims.tid); expect(tokenResponse.tokenType).to.be.deep.eq(TEST_CONFIG.TOKEN_TYPE_BEARER); @@ -576,7 +576,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { expect(tokenResponse.expiresOn.getTime() / 1000 <= TimeUtils.nowSeconds() + TEST_TOKEN_LIFETIMES.DEFAULT_EXPIRES_IN).to.be.true; expect(tokenResponse.scopes).to.be.deep.eq(TEST_CONFIG.DEFAULT_SCOPES); expect(tokenResponse.userRequestState).to.be.deep.eq(testState); - expect(Account.compareAccounts(authModule.getAccount(), testAccount)).to.be.true; + expect(Account.compareAccounts(Client.getAccount(), testAccount)).to.be.true; }); it("Uses authority from cache if not present in cached request", async () => { @@ -608,9 +608,9 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const stringifiedRequest = JSON.stringify(cachedRequest); defaultAuthConfig.storageInterface.setItem(TemporaryCacheKeys.REQUEST_PARAMS, stringifiedRequest); defaultAuthConfig.storageInterface.setItem(`${TemporaryCacheKeys.AUTHORITY}${Constants.RESOURCE_DELIM}${codeResponse.userRequestState}`, `${TEST_URIS.ALTERNATE_INSTANCE}/common/`); - + // Perform test - await authModule.acquireToken(codeResponse); + await Client.acquireToken(codeResponse); expect(authoritySpy.calledOnceWith(`${TEST_URIS.ALTERNATE_INSTANCE}/common/`, defaultAuthConfig.networkInterface)).to.be.true; }); }); @@ -618,9 +618,9 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { describe("Renew token", () => { - let authModule: AuthorizationCodeModule; + let Client: PublicClient; beforeEach(() => { - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); }); afterEach(() => { @@ -631,26 +631,26 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { describe("Error cases", () => { it("Throws error if request object is null or undefined", async () => { - await expect(authModule.renewToken(null)).to.be.rejectedWith(ClientConfigurationErrorMessage.tokenRequestEmptyError.desc); - await expect(authModule.renewToken(undefined)).to.be.rejectedWith(ClientConfigurationErrorMessage.tokenRequestEmptyError.desc); + await expect(Client.renewToken(null)).to.be.rejectedWith(ClientConfigurationErrorMessage.tokenRequestEmptyError.desc); + await expect(Client.renewToken(undefined)).to.be.rejectedWith(ClientConfigurationErrorMessage.tokenRequestEmptyError.desc); }); it("Throws error if scopes are not included in request object", async () => { - await expect(authModule.renewToken({})).to.be.rejectedWith(ClientConfigurationErrorMessage.emptyScopesError.desc); + await expect(Client.renewToken({})).to.be.rejectedWith(ClientConfigurationErrorMessage.emptyScopesError.desc); }); it("Throws error if scopes are empty in request object", async () => { const tokenRequest: TokenRenewParameters = { scopes: [] }; - await expect(authModule.renewToken(tokenRequest)).to.be.rejectedWith(ClientConfigurationErrorMessage.emptyScopesError.desc); + await expect(Client.renewToken(tokenRequest)).to.be.rejectedWith(ClientConfigurationErrorMessage.emptyScopesError.desc); }); it("Throws error if login hasn't been completed and client id is passed as scope", async () => { const tokenRequest: TokenRenewParameters = { scopes: [TEST_CONFIG.MSAL_CLIENT_ID] }; - await expect(authModule.renewToken(tokenRequest)).to.be.rejectedWith(ClientAuthErrorMessage.userLoginRequiredError.desc); + await expect(Client.renewToken(tokenRequest)).to.be.rejectedWith(ClientAuthErrorMessage.userLoginRequiredError.desc); }); it("Throws error if endpoint discovery could not be completed", async () => { @@ -660,7 +660,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const tokenRequest: TokenRenewParameters = { scopes: ["scope1"] }; - await expect(authModule.renewToken(tokenRequest)).to.be.rejectedWith(`${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${exceptionString}`); + await expect(Client.renewToken(tokenRequest)).to.be.rejectedWith(`${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${exceptionString}`); }); it("Throws error if it does not find token in empty cache", async () => { @@ -668,7 +668,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const tokenRequest: TokenRenewParameters = { scopes: ["scope1"] }; - await expect(authModule.renewToken(tokenRequest)).to.be.rejectedWith(ClientAuthErrorMessage.noTokensFoundError.desc); + await expect(Client.renewToken(tokenRequest)).to.be.rejectedWith(ClientAuthErrorMessage.noTokensFoundError.desc); }); it("Throws error if it does not find token in non-empty cache", async () => { @@ -694,7 +694,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const tokenRequest: TokenRenewParameters = { scopes: [testScope2] }; - await expect(authModule.renewToken(tokenRequest)).to.be.rejectedWith(ClientAuthErrorMessage.noTokensFoundError.desc); + await expect(Client.renewToken(tokenRequest)).to.be.rejectedWith(ClientAuthErrorMessage.noTokensFoundError.desc); }); it("Throws error if it finds too many tokens in cache for the same scope and client id but no authority, resource or account is given", async () => { @@ -727,7 +727,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const tokenRequest: TokenRenewParameters = { scopes: [testScope] }; - await expect(authModule.renewToken(tokenRequest)).to.be.rejectedWith(ClientAuthErrorMessage.multipleMatchingTokens.desc); + await expect(Client.renewToken(tokenRequest)).to.be.rejectedWith(ClientAuthErrorMessage.multipleMatchingTokens.desc); }); }); @@ -755,7 +755,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const tokenRequest: TokenRenewParameters = { scopes: [testScope1] }; - const tokenResponse = await authModule.renewToken(tokenRequest); + const tokenResponse = await Client.renewToken(tokenRequest); expect(tokenResponse.uniqueId).to.be.empty; expect(tokenResponse.tenantId).to.be.empty; expect(tokenResponse.scopes).to.be.deep.eq([testScope1, Constants.OFFLINE_ACCESS_SCOPE]); @@ -788,7 +788,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { return input; } }; - authModule = new AuthorizationCodeModule(defaultAuthConfig); + Client = new PublicClient(defaultAuthConfig); const idTokenClaims = { "ver": "2.0", "iss": `${TEST_URIS.DEFAULT_INSTANCE}9188040d-6c67-4c5b-b112-36a304b66dad/v2.0`, @@ -824,7 +824,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { const tokenRequest: TokenRenewParameters = { scopes: [testScopes[0]] }; - const tokenResponse = await authModule.renewToken(tokenRequest); + const tokenResponse = await Client.renewToken(tokenRequest); // Build Test account const idToken = new IdToken(TEST_TOKENS.IDTOKEN_V2, defaultAuthConfig.cryptoInterface); @@ -857,7 +857,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { return TEST_URIS.TEST_LOGOUT_URI; }; - let authModule_functionRedirectUris = new AuthorizationCodeModule({ + let Client_functionRedirectUris = new PublicClient({ auth: { clientId: TEST_CONFIG.MSAL_CLIENT_ID, tmp_clientSecret: TEST_CONFIG.MSAL_CLIENT_SECRET, @@ -873,7 +873,7 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { } }); - let authModule_noRedirectUris = new AuthorizationCodeModule({ + let Client_noRedirectUris = new PublicClient({ auth: { clientId: TEST_CONFIG.MSAL_CLIENT_ID, tmp_clientSecret: TEST_CONFIG.MSAL_CLIENT_SECRET, @@ -888,29 +888,29 @@ describe("AuthorizationCodeModule.ts Class Unit Tests", () => { }); it("gets configured redirect uri", () => { - const authModule = new AuthorizationCodeModule(defaultAuthConfig); - expect(authModule.getRedirectUri()).to.be.deep.eq(TEST_URIS.TEST_REDIR_URI); + const Client = new PublicClient(defaultAuthConfig); + expect(Client.getRedirectUri()).to.be.deep.eq(TEST_URIS.TEST_REDIR_URI); }); it("gets configured redirect uri if uri is a function", () => { - expect(authModule_functionRedirectUris.getRedirectUri()).to.be.deep.eq(TEST_URIS.TEST_REDIR_URI); + expect(Client_functionRedirectUris.getRedirectUri()).to.be.deep.eq(TEST_URIS.TEST_REDIR_URI); }); it("throws error if redirect uri is null/empty", () => { - expect(() => authModule_noRedirectUris.getRedirectUri()).to.throw(ClientConfigurationError.createRedirectUriEmptyError().message); + expect(() => Client_noRedirectUris.getRedirectUri()).to.throw(ClientConfigurationError.createRedirectUriEmptyError().message); }); it("gets configured post logout redirect uri", () => { - const authModule = new AuthorizationCodeModule(defaultAuthConfig); - expect(authModule.getPostLogoutRedirectUri()).to.be.deep.eq(TEST_URIS.TEST_LOGOUT_URI); + const Client = new PublicClient(defaultAuthConfig); + expect(Client.getPostLogoutRedirectUri()).to.be.deep.eq(TEST_URIS.TEST_LOGOUT_URI); }); it("gets configured post logout redirect uri if uri is a function", () => { - expect(authModule_functionRedirectUris.getPostLogoutRedirectUri()).to.be.deep.eq(TEST_URIS.TEST_LOGOUT_URI); + expect(Client_functionRedirectUris.getPostLogoutRedirectUri()).to.be.deep.eq(TEST_URIS.TEST_LOGOUT_URI); }); it("throws error if post logout redirect uri is null/empty", () => { - expect(() => authModule_noRedirectUris.getPostLogoutRedirectUri()).to.throw(ClientConfigurationError.createPostLogoutRedirectUriEmptyError().message); + expect(() => Client_noRedirectUris.getPostLogoutRedirectUri()).to.throw(ClientConfigurationError.createPostLogoutRedirectUriEmptyError().message); }); }); }); diff --git a/lib/msal-common/test/app/config/ModuleConfiguration.spec.ts b/lib/msal-common/test/config/Configuration.spec.ts similarity index 94% rename from lib/msal-common/test/app/config/ModuleConfiguration.spec.ts rename to lib/msal-common/test/config/Configuration.spec.ts index f81dd287ca..8ae1c42629 100644 --- a/lib/msal-common/test/app/config/ModuleConfiguration.spec.ts +++ b/lib/msal-common/test/config/Configuration.spec.ts @@ -1,18 +1,18 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; import sinon from "sinon"; -import { ModuleConfiguration, buildModuleConfiguration } from "../../../src/app/config/ModuleConfiguration"; -import { PkceCodes } from "../../../src/crypto/ICrypto"; -import { AuthError } from "../../../src/error/AuthError"; -import { NetworkRequestOptions } from "../../../src/network/INetworkModule"; -import { LogLevel } from "../../../src/logger/Logger"; +import { Configuration, buildConfiguration } from "../../src/config/Configuration"; +import { PkceCodes } from "../../src/crypto/ICrypto"; +import { AuthError } from "../../src/error/AuthError"; +import { NetworkRequestOptions } from "../../src/network/INetworkModule"; +import { LogLevel } from "../../src/logger/Logger"; const expect = chai.expect; chai.use(chaiAsPromised); describe("ModuleConfiguration.ts Class Unit Tests", () => { it("buildModuleConfiguration assigns default functions", async () => { - let emptyConfig: ModuleConfiguration = buildModuleConfiguration({}); + let emptyConfig: Configuration = buildConfiguration({}); // Crypto interface checks expect(emptyConfig.cryptoInterface).to.be.not.null; expect(emptyConfig.cryptoInterface.base64Decode).to.be.not.null; @@ -83,7 +83,7 @@ describe("ModuleConfiguration.ts Class Unit Tests", () => { const testKeySet = ["testKey1", "testKey2"]; it("buildConfiguration correctly assigns new values", () => { - let newConfig: ModuleConfiguration = buildModuleConfiguration({ + let newConfig: Configuration = buildConfiguration({ cryptoInterface: { createNewGuid: (): string => { return "newGuid"; diff --git a/lib/msal-common/test/app/config/PublicClientSPAConfiguration.spec.ts b/lib/msal-common/test/config/PublicClientConfiguration.spec.ts similarity index 94% rename from lib/msal-common/test/app/config/PublicClientSPAConfiguration.spec.ts rename to lib/msal-common/test/config/PublicClientConfiguration.spec.ts index 9e7b29c87e..e19cc1c229 100644 --- a/lib/msal-common/test/app/config/PublicClientSPAConfiguration.spec.ts +++ b/lib/msal-common/test/config/PublicClientConfiguration.spec.ts @@ -2,17 +2,17 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; const expect = chai.expect; chai.use(chaiAsPromised); -import { PublicClientSPAConfiguration, buildPublicClientSPAConfiguration } from "../../../src/app/config/PublicClientSPAConfiguration"; -import { PkceCodes } from "../../../src/crypto/ICrypto"; -import { TEST_CONFIG, TEST_URIS } from "../../utils/StringConstants"; -import { AuthError } from "../../../src/error/AuthError"; -import { NetworkRequestOptions } from "../../../src/network/INetworkModule"; -import { LogLevel } from "../../../src/logger/Logger"; +import { PublicClientConfiguration, buildPublicClientConfiguration } from "../../src/config/PublicClientConfiguration"; +import { PkceCodes } from "../../src/crypto/ICrypto"; +import { TEST_CONFIG, TEST_URIS } from "../utils/StringConstants"; +import { AuthError } from "../../src/error/AuthError"; +import { NetworkRequestOptions } from "../../src/network/INetworkModule"; +import { LogLevel } from "../../src/logger/Logger"; describe("PublicClientSPAConfiguration.ts Class Unit Tests", () => { it("buildPublicClientSPAConfiguration assigns default functions", async () => { - let emptyConfig: PublicClientSPAConfiguration = buildPublicClientSPAConfiguration({auth: null}); + let emptyConfig: PublicClientConfiguration = buildPublicClientConfiguration({auth: null}); // Auth config checks expect(emptyConfig.auth).to.be.not.null; expect(emptyConfig.auth.clientId).to.be.empty; @@ -86,7 +86,7 @@ describe("PublicClientSPAConfiguration.ts Class Unit Tests", () => { const testKeySet = ["testKey1", "testKey2"]; it("buildPublicClientSPAConfiguration correctly assigns new values", () => { - let newConfig: PublicClientSPAConfiguration = buildPublicClientSPAConfiguration({ + let newConfig: PublicClientConfiguration = buildPublicClientConfiguration({ auth: { clientId: TEST_CONFIG.MSAL_CLIENT_ID, tmp_clientSecret: TEST_CONFIG.MSAL_CLIENT_SECRET, From 47545379506849890eb7c095397cce065a28ef80 Mon Sep 17 00:00:00 2001 From: sameerag Date: Mon, 2 Mar 2020 15:41:31 -0800 Subject: [PATCH 08/10] Editing tests --- .../test/{auth => account}/Account.spec.ts | 16 +++++----- .../test/{auth => account}/ClientInfo.spec.ts | 6 ++-- .../test/{auth => account}/IdToken.spec.ts | 8 ++--- .../test/{auth => account}/ScopeSet.spec.ts | 18 +++++------ .../{auth => }/authority/AadAuthority.spec.ts | 16 +++++----- .../{auth => }/authority/Authority.spec.ts | 28 ++++++++-------- .../authority/AuthorityFactory.spec.ts | 10 +++--- .../test/cache/CacheHelpers.spec.ts | 32 +++++++++---------- lib/msal-common/test/client/Client.spec.ts | 6 ++-- .../test/client/PublicClient.spec.ts | 8 ++--- .../test/config/Configuration.spec.ts | 4 +-- .../config/PublicClientConfiguration.spec.ts | 4 +-- .../test/response/ResponseHandler.spec.ts | 14 ++++---- .../ServerCodeRequestParameters.spec.ts | 12 +++---- .../ServerTokenRequestParameters.spec.ts | 2 +- 15 files changed, 92 insertions(+), 92 deletions(-) rename lib/msal-common/test/{auth => account}/Account.spec.ts (98%) rename lib/msal-common/test/{auth => account}/ClientInfo.spec.ts (97%) rename lib/msal-common/test/{auth => account}/IdToken.spec.ts (98%) rename lib/msal-common/test/{auth => account}/ScopeSet.spec.ts (99%) rename lib/msal-common/test/{auth => }/authority/AadAuthority.spec.ts (89%) rename lib/msal-common/test/{auth => }/authority/Authority.spec.ts (94%) rename lib/msal-common/test/{auth => }/authority/AuthorityFactory.spec.ts (87%) diff --git a/lib/msal-common/test/auth/Account.spec.ts b/lib/msal-common/test/account/Account.spec.ts similarity index 98% rename from lib/msal-common/test/auth/Account.spec.ts rename to lib/msal-common/test/account/Account.spec.ts index ecd8e29d89..80442fd216 100644 --- a/lib/msal-common/test/auth/Account.spec.ts +++ b/lib/msal-common/test/account/Account.spec.ts @@ -1,14 +1,14 @@ import { expect } from "chai"; -import { IdTokenClaims } from "../../src/auth/IdTokenClaims"; +import { IdTokenClaims } from "../../src/account/IdTokenClaims"; import { TEST_URIS, TEST_DATA_CLIENT_INFO, TEST_TOKENS, RANDOM_TEST_GUID, TEST_CONFIG } from "../utils/StringConstants"; -import { Account } from "../../src/auth/Account"; +import { Account } from "../../src/account/Account"; import sinon from "sinon"; -import { IdToken } from "../../src/auth/IdToken"; +import { IdToken } from "../../src/account/IdToken"; import { ICrypto, PkceCodes } from "../../src"; -import { buildClientInfo } from "../../src/auth/ClientInfo"; +import { buildClientInfo } from "../../src/account/ClientInfo"; describe("Account.ts Class Unit Tests", () => { - + describe("Constructor", () => { it("creates an account with given parameters", () => { @@ -75,7 +75,7 @@ describe("Account.ts Class Unit Tests", () => { afterEach(() => { sinon.restore(); }); - + it("Returns a valid account with given idToken and client info object", () => { const idTokenClaims: IdTokenClaims = { "ver": "2.0", @@ -141,7 +141,7 @@ describe("Account.ts Class Unit Tests", () => { const idToken = new IdToken(TEST_TOKENS.IDTOKEN_V2, cryptoInterface); const clientInfo1 = buildClientInfo(TEST_DATA_CLIENT_INFO.TEST_RAW_CLIENT_INFO, cryptoInterface); const clientInfo2 = buildClientInfo(TEST_DATA_CLIENT_INFO.TEST_RAW_CLIENT_INFO, cryptoInterface); - + clientInfo1.uid = ""; clientInfo2.utid = ""; @@ -237,7 +237,7 @@ describe("Account.ts Class Unit Tests", () => { const clientInfo1 = buildClientInfo(TEST_DATA_CLIENT_INFO.TEST_RAW_CLIENT_INFO, cryptoInterface); const clientInfo2 = buildClientInfo(TEST_DATA_CLIENT_INFO.TEST_RAW_CLIENT_INFO, cryptoInterface); const clientInfo3 = buildClientInfo(TEST_DATA_CLIENT_INFO.TEST_RAW_CLIENT_INFO, cryptoInterface); - + clientInfo1.uid = ""; clientInfo2.utid = ""; diff --git a/lib/msal-common/test/auth/ClientInfo.spec.ts b/lib/msal-common/test/account/ClientInfo.spec.ts similarity index 97% rename from lib/msal-common/test/auth/ClientInfo.spec.ts rename to lib/msal-common/test/account/ClientInfo.spec.ts index 1762c20edb..4b0aa4d0fe 100644 --- a/lib/msal-common/test/auth/ClientInfo.spec.ts +++ b/lib/msal-common/test/account/ClientInfo.spec.ts @@ -1,12 +1,12 @@ import { expect } from "chai"; -import { buildClientInfo } from "../../src/auth/ClientInfo"; +import { buildClientInfo } from "../../src/account/ClientInfo"; import { TEST_CONFIG, TEST_DATA_CLIENT_INFO, RANDOM_TEST_GUID } from "../utils/StringConstants"; import { PkceCodes, ICrypto } from "../../src/crypto/ICrypto"; import sinon from "sinon"; import { ClientAuthError, ClientAuthErrorMessage } from "../../src"; describe("ClientInfo.ts Class Unit Tests", () => { - + describe("buildClientInfo()", () => { let cryptoInterface: ICrypto; beforeEach(() => { @@ -46,7 +46,7 @@ describe("ClientInfo.ts Class Unit Tests", () => { afterEach(() => { sinon.restore(); }); - + it("Throws error if clientInfo is null or empty", () => { expect(() => buildClientInfo(null, cryptoInterface)).to.throw(ClientAuthErrorMessage.clientInfoEmptyError.desc); expect(() => buildClientInfo(null, cryptoInterface)).to.throw(ClientAuthError); diff --git a/lib/msal-common/test/auth/IdToken.spec.ts b/lib/msal-common/test/account/IdToken.spec.ts similarity index 98% rename from lib/msal-common/test/auth/IdToken.spec.ts rename to lib/msal-common/test/account/IdToken.spec.ts index e92c428bdf..dd3ad47bef 100644 --- a/lib/msal-common/test/auth/IdToken.spec.ts +++ b/lib/msal-common/test/account/IdToken.spec.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; -import { IdToken } from "../../src/auth/IdToken"; +import { IdToken } from "../../src/account/IdToken"; import { TEST_CONFIG, TEST_DATA_CLIENT_INFO, RANDOM_TEST_GUID, TEST_TOKENS, TEST_URIS } from "../utils/StringConstants"; import { PkceCodes, ICrypto } from "../../src/crypto/ICrypto"; import sinon from "sinon"; import { ClientAuthErrorMessage, ClientAuthError, StringUtils } from "../../src"; -import { DecodedJwt } from "../../src/auth/DecodedJwt"; +import { DecodedJwt } from "../../src/account/DecodedJwt"; // Set up stubs const idTokenClaims = { @@ -63,9 +63,9 @@ describe("IdToken.ts Class Unit Tests", () => { afterEach(() => { sinon.restore(); }); - + describe("Constructor", () => { - + it("Throws error if rawIdToken is null or empty", () => { expect(() => new IdToken("", cryptoInterface)).to.throw(ClientAuthErrorMessage.nullOrEmptyIdToken.desc); expect(() => new IdToken("", cryptoInterface)).to.throw(ClientAuthError); diff --git a/lib/msal-common/test/auth/ScopeSet.spec.ts b/lib/msal-common/test/account/ScopeSet.spec.ts similarity index 99% rename from lib/msal-common/test/auth/ScopeSet.spec.ts rename to lib/msal-common/test/account/ScopeSet.spec.ts index 1ecf92c902..71e7994214 100644 --- a/lib/msal-common/test/auth/ScopeSet.spec.ts +++ b/lib/msal-common/test/account/ScopeSet.spec.ts @@ -1,11 +1,11 @@ import { expect } from "chai"; -import { ScopeSet } from "../../src/auth/ScopeSet"; +import { ScopeSet } from "../../src/request/ScopeSet"; import { TEST_CONFIG } from "../utils/StringConstants"; import { ClientConfigurationError, ClientConfigurationErrorMessage, Constants, ClientAuthError, ClientAuthErrorMessage } from "../../src"; import sinon from "sinon"; describe("ScopeSet.ts", () => { - + describe("Constructor and scope validation", () => { it("Throws error if scopes are null or empty and required", () => { @@ -195,16 +195,16 @@ describe("ScopeSet.ts", () => { const newScopeArr = nonRequiredScopeSet.asArray(); expect(newScopeArr).to.be.deep.eq(scopeArr); }); - + it("appendScope() does nothing if given scope is empty, null or undefined", () => { const setAddSpy = sinon.spy(Set.prototype, "add"); - + expect(() => nonRequiredScopeSet.appendScope("")).to.throw(ClientAuthErrorMessage.appendEmptyScopeError.desc); expect(setAddSpy.called).to.be.false; expect(() => nonRequiredScopeSet.appendScope(null)).to.throw(ClientAuthErrorMessage.appendEmptyScopeError.desc); expect(setAddSpy.called).to.be.false; - + expect(() => nonRequiredScopeSet.appendScope(undefined)).to.throw(ClientAuthErrorMessage.appendEmptyScopeError.desc); expect(setAddSpy.called).to.be.false; }); @@ -213,13 +213,13 @@ describe("ScopeSet.ts", () => { const setUnionSpy = sinon.spy(ScopeSet.prototype, "unionScopeSets"); expect(() => requiredScopeSet.appendScopes(null)).to.throw(ClientAuthErrorMessage.appendScopeSetError.desc); expect(setUnionSpy.called).to.be.false; - + expect(() => requiredScopeSet.appendScopes(undefined)).to.throw(ClientAuthErrorMessage.appendScopeSetError.desc); expect(setUnionSpy.called).to.be.false; expect(() => requiredScopeSet.appendScopes([])).to.throw(ClientAuthErrorMessage.appendScopeSetError.desc); expect(setUnionSpy.called).to.be.false; - + expect(() => nonRequiredScopeSet.appendScopes(null)).to.throw(ClientAuthErrorMessage.appendScopeSetError.desc); expect(setUnionSpy.called).to.be.false; @@ -283,7 +283,7 @@ describe("ScopeSet.ts", () => { const testScope3 = "testScope3"; const newScopeSet = new ScopeSet([testScope2, testScope3], TEST_CONFIG.MSAL_CLIENT_ID, true); newScopeSet.removeScope(Constants.OFFLINE_ACCESS_SCOPE); - + const unionSet = newScopeSet.unionScopeSets(requiredScopeSet); const unionArray = Array.from(unionSet); expect(unionSet instanceof Set).to.be.true; @@ -350,7 +350,7 @@ describe("ScopeSet.ts", () => { afterEach(() => { sinon.restore(); }); - + it("asArray() returns ScopeSet as an array", () => { const scopeArr = nonRequiredScopeSet.asArray(); expect(Array.isArray(scopeArr)).to.be.true; diff --git a/lib/msal-common/test/auth/authority/AadAuthority.spec.ts b/lib/msal-common/test/authority/AadAuthority.spec.ts similarity index 89% rename from lib/msal-common/test/auth/authority/AadAuthority.spec.ts rename to lib/msal-common/test/authority/AadAuthority.spec.ts index b1ab41b4c6..c5ac299bf7 100644 --- a/lib/msal-common/test/auth/authority/AadAuthority.spec.ts +++ b/lib/msal-common/test/authority/AadAuthority.spec.ts @@ -1,13 +1,13 @@ import { expect } from "chai"; -import { AadAuthority } from "../../../src/auth/authority/AadAuthority"; -import { Constants } from "../../../src/utils/Constants"; -import { INetworkModule, NetworkRequestOptions } from "../../../src/network/INetworkModule"; -import { Authority } from "../../../src/auth/authority/Authority"; -import { AuthorityType } from "../../../src/auth/authority/AuthorityType"; -import { TEST_HOST_LIST, TEST_TENANT_DISCOVERY_RESPONSE } from "../../utils/StringConstants"; +import { AadAuthority } from "../../src/authority/AadAuthority"; +import { Constants } from "../../src/utils/Constants"; +import { INetworkModule, NetworkRequestOptions } from "../../src/network/INetworkModule"; +import { Authority } from "../../src/authority/Authority"; +import { AuthorityType } from "../../src/authority/AuthorityType"; +import { TEST_HOST_LIST, TEST_TENANT_DISCOVERY_RESPONSE } from "../utils/StringConstants"; describe("AadAuthority.ts Class Unit Tests", () => { - + describe("Constructor", () => { let aadAuthority: AadAuthority; @@ -52,7 +52,7 @@ describe("AadAuthority.ts Class Unit Tests", () => { const hostUri = TEST_HOST_LIST[i]; const aadAuthority = new AadAuthority(`https://${hostUri}/common`, networkInterface); await expect(aadAuthority.getOpenIdConfigurationEndpointAsync()).to.eventually.eq(`https://${hostUri}/common/v2.0/.well-known/openid-configuration`); - } + } }); it("Makes a request to get OpenID endpoint if given authority is NOT in trusted host list", async () => { diff --git a/lib/msal-common/test/auth/authority/Authority.spec.ts b/lib/msal-common/test/authority/Authority.spec.ts similarity index 94% rename from lib/msal-common/test/auth/authority/Authority.spec.ts rename to lib/msal-common/test/authority/Authority.spec.ts index 9a9aa12e66..4a02a96ea6 100644 --- a/lib/msal-common/test/auth/authority/Authority.spec.ts +++ b/lib/msal-common/test/authority/Authority.spec.ts @@ -1,18 +1,18 @@ import { expect } from "chai"; -import { Authority } from "../../../src/auth/authority/Authority"; -import { INetworkModule, NetworkRequestOptions } from "../../../src/network/INetworkModule"; -import { Constants } from "../../../src/utils/Constants"; -import { AuthorityType } from "../../../src/auth/authority/AuthorityType"; -import { DEFAULT_TENANT_DISCOVERY_RESPONSE, TEST_URIS, RANDOM_TEST_GUID, TEST_TENANT_DISCOVERY_RESPONSE, DEFAULT_OPENID_CONFIG_RESPONSE } from "../../utils/StringConstants"; -import { ClientConfigurationErrorMessage } from "../../../src/error/ClientConfigurationError"; import sinon from "sinon"; -import { ClientAuthErrorMessage } from "../../../src"; +import { Authority } from "../../src/authority/Authority"; +import { INetworkModule, NetworkRequestOptions } from "../../src/network/INetworkModule"; +import { Constants } from "../../src/utils/Constants"; +import { AuthorityType } from "../../src/authority/AuthorityType"; +import { DEFAULT_TENANT_DISCOVERY_RESPONSE, TEST_URIS, RANDOM_TEST_GUID, TEST_TENANT_DISCOVERY_RESPONSE, DEFAULT_OPENID_CONFIG_RESPONSE } from "../utils/StringConstants"; +import { ClientConfigurationErrorMessage } from "../../src/error/ClientConfigurationError"; +import { ClientAuthErrorMessage } from "../../src"; class TestAuthority extends Authority { public get authorityType(): AuthorityType { return null; - } - + } + public async getOpenIdConfigurationEndpointAsync(): Promise { return DEFAULT_TENANT_DISCOVERY_RESPONSE.tenant_discovery_endpoint; } @@ -65,7 +65,7 @@ describe("Authority.ts Class Unit Tests", () => { beforeEach(() => { authority = new TestAuthority(Constants.DEFAULT_AUTHORITY, networkInterface); }); - + it("Gets canonical authority that ends in '/'", () => { expect(authority.canonicalAuthority.endsWith("/")).to.be.true; expect(authority.canonicalAuthority).to.be.eq(`${Constants.DEFAULT_AUTHORITY}/`); @@ -75,7 +75,7 @@ describe("Authority.ts Class Unit Tests", () => { expect(() => authority.canonicalAuthority = `http://login.microsoftonline.com/common`).to.throw(ClientConfigurationErrorMessage.authorityUriInsecure.desc); expect(() => authority.canonicalAuthority = `https://login.microsoftonline.com/`).to.throw(ClientConfigurationErrorMessage.urlParseError.desc); expect(() => authority.canonicalAuthority = "This is not a URI").to.throw(ClientConfigurationErrorMessage.urlParseError.desc); - + authority.canonicalAuthority = `${TEST_URIS.ALTERNATE_INSTANCE}/${RANDOM_TEST_GUID}` expect(authority.canonicalAuthority.endsWith("/")).to.be.true; expect(authority.canonicalAuthority).to.be.eq(`${TEST_URIS.ALTERNATE_INSTANCE}/${RANDOM_TEST_GUID}/`); @@ -105,7 +105,7 @@ describe("Authority.ts Class Unit Tests", () => { afterEach(() => { sinon.restore(); }); - + it ("Returns authorization_endpoint of tenantDiscoveryResponse", () => { expect(authority.authorizationEndpoint).to.be.eq(DEFAULT_OPENID_CONFIG_RESPONSE.authorization_endpoint.replace("{tenant}", "common")); }); @@ -146,7 +146,7 @@ describe("Authority.ts Class Unit Tests", () => { beforeEach(() => { authority = new TestAuthority(Constants.DEFAULT_AUTHORITY, networkInterface); }); - + it("discoveryComplete returns false if endpoint discovery has not been completed", () => { expect(authority.discoveryComplete()).to.be.false; }); @@ -156,7 +156,7 @@ describe("Authority.ts Class Unit Tests", () => { await authority.resolveEndpointsAsync(); expect(authority.discoveryComplete()).to.be.true; sinon.restore(); - }); + }); it("resolveEndpoints returns the openIdConfigurationEndpoint and then obtains the tenant discovery response from that endpoint", async () => { networkInterface.sendGetRequestAsync = (url: string, options?: NetworkRequestOptions): any => { diff --git a/lib/msal-common/test/auth/authority/AuthorityFactory.spec.ts b/lib/msal-common/test/authority/AuthorityFactory.spec.ts similarity index 87% rename from lib/msal-common/test/auth/authority/AuthorityFactory.spec.ts rename to lib/msal-common/test/authority/AuthorityFactory.spec.ts index 6b08d8d469..302aae0f3b 100644 --- a/lib/msal-common/test/auth/authority/AuthorityFactory.spec.ts +++ b/lib/msal-common/test/authority/AuthorityFactory.spec.ts @@ -1,8 +1,8 @@ import { expect } from "chai"; -import { AuthorityFactory } from "../../../src/auth/authority/AuthorityFactory"; -import { INetworkModule, NetworkRequestOptions } from "../../../src/network/INetworkModule"; -import { ClientConfigurationErrorMessage, ClientAuthErrorMessage, Constants, Authority } from "../../../src"; -import { AadAuthority } from "../../../src/auth/authority/AadAuthority"; +import { AuthorityFactory } from "../../src/authority/AuthorityFactory"; +import { INetworkModule, NetworkRequestOptions } from "../../src/network/INetworkModule"; +import { ClientConfigurationErrorMessage, ClientAuthErrorMessage, Constants, Authority } from "../../src"; +import { AadAuthority } from "../../src/authority/AadAuthority"; describe("AuthorityFactory.ts Class Unit Tests", () => { @@ -14,7 +14,7 @@ describe("AuthorityFactory.ts Class Unit Tests", () => { return null; } }; - + it("AuthorityFactory returns null if given url is null or empty", () => { expect(() => AuthorityFactory.createInstance("", networkInterface)).to.throw(ClientConfigurationErrorMessage.urlEmptyError.desc); expect(() => AuthorityFactory.createInstance(null, networkInterface)).to.throw(ClientConfigurationErrorMessage.urlEmptyError.desc); diff --git a/lib/msal-common/test/cache/CacheHelpers.spec.ts b/lib/msal-common/test/cache/CacheHelpers.spec.ts index b0f6cf6e65..43ce317770 100644 --- a/lib/msal-common/test/cache/CacheHelpers.spec.ts +++ b/lib/msal-common/test/cache/CacheHelpers.spec.ts @@ -5,11 +5,11 @@ import sinon from "sinon"; import { ICacheStorage } from "../../src/cache/ICacheStorage"; import { TemporaryCacheKeys, Constants } from "../../src/utils/Constants"; import { INetworkModule, NetworkRequestOptions } from "../../src/network/INetworkModule"; -import { AadAuthority } from "../../src/auth/authority/AadAuthority"; -import { IdTokenClaims } from "../../src/auth/IdTokenClaims"; -import { IdToken } from "../../src/auth/IdToken"; -import { buildClientInfo, ClientInfo } from "../../src/auth/ClientInfo"; -import { Account } from "../../src/auth/Account"; +import { AadAuthority } from "../../src/authority/AadAuthority"; +import { IdTokenClaims } from "../../src/account/IdTokenClaims"; +import { IdToken } from "../../src/account/IdToken"; +import { buildClientInfo, ClientInfo } from "../../src/account/ClientInfo"; +import { Account } from "../../src/account/Account"; import { ICrypto, PkceCodes } from "../../src/crypto/ICrypto"; import { ServerCodeRequestParameters } from "../../src/server/ServerCodeRequestParameters"; import { AuthenticationParameters } from "../../src/request/AuthenticationParameters"; @@ -54,7 +54,7 @@ describe("CacheHelpers.ts Tests", () => { }); describe("Generator functions", () => { - + let cacheHelpers: CacheHelpers; beforeEach(() => { const cacheStorage: ICacheStorage = { @@ -82,9 +82,9 @@ describe("CacheHelpers.ts Tests", () => { }); afterEach(() => { - store = {}; + store = {}; }); - + it("generateAcquireTokenAccountKey() creates a valid cache key for account object", () => { const accountKey = cacheHelpers.generateAcquireTokenAccountKey(TEST_DATA_CLIENT_INFO.TEST_HOME_ACCOUNT_ID); expect(accountKey).to.be.eq(`${TemporaryCacheKeys.ACQUIRE_TOKEN_ACCOUNT}${Constants.RESOURCE_DELIM}${TEST_DATA_CLIENT_INFO.TEST_HOME_ACCOUNT_ID}`); @@ -364,7 +364,7 @@ describe("CacheHelpers.ts Tests", () => { cacheHelpers.updateCacheEntries(serverAuthParams, testAccount); cacheStorage.setItem(TemporaryCacheKeys.REQUEST_PARAMS, "TestRequestParams"); cacheStorage.setItem(TemporaryCacheKeys.ORIGIN_URI, TEST_URIS.TEST_REDIR_URI); - + cacheHelpers.resetTempCacheItems(RANDOM_TEST_GUID); const accountKey = cacheHelpers.generateAcquireTokenAccountKey(testAccount.homeAccountIdentifier); const nonceKey = cacheHelpers.generateNonceKey(RANDOM_TEST_GUID); @@ -444,17 +444,17 @@ describe("CacheHelpers.ts Tests", () => { refreshToken: TEST_TOKENS.REFRESH_TOKEN, tokenType: TEST_CONFIG.TOKEN_TYPE_BEARER, expiresOnSec: `${TEST_TOKEN_LIFETIMES.TEST_ACCESS_TOKEN_EXP}`, - extExpiresOnSec: `${TEST_TOKEN_LIFETIMES.TEST_ACCESS_TOKEN_EXP + TEST_TOKEN_LIFETIMES.DEFAULT_EXPIRES_IN}` + extExpiresOnSec: `${TEST_TOKEN_LIFETIMES.TEST_ACCESS_TOKEN_EXP + TEST_TOKEN_LIFETIMES.DEFAULT_EXPIRES_IN}` }; cacheStorage.setItem(JSON.stringify(atKey), JSON.stringify(atValue1)); const atKey2 = new AccessTokenKey( - Constants.DEFAULT_AUTHORITY, - TEST_CONFIG.MSAL_CLIENT_ID, - scopeString, - testResource2, - TEST_DATA_CLIENT_INFO.TEST_UID, - TEST_DATA_CLIENT_INFO.TEST_UTID, + Constants.DEFAULT_AUTHORITY, + TEST_CONFIG.MSAL_CLIENT_ID, + scopeString, + testResource2, + TEST_DATA_CLIENT_INFO.TEST_UID, + TEST_DATA_CLIENT_INFO.TEST_UTID, cryptoInterface ); const atValue2: AccessTokenValue = { diff --git a/lib/msal-common/test/client/Client.spec.ts b/lib/msal-common/test/client/Client.spec.ts index 4d095401f2..19edec2029 100644 --- a/lib/msal-common/test/client/Client.spec.ts +++ b/lib/msal-common/test/client/Client.spec.ts @@ -12,9 +12,9 @@ import { TokenRenewParameters } from "../../src/request/TokenRenewParameters"; import sinon from "sinon"; import { Account, PkceCodes, PersistentCacheKeys, ICrypto } from "../../src"; import { TEST_TOKENS, TEST_DATA_CLIENT_INFO, TEST_CONFIG, RANDOM_TEST_GUID } from "../utils/StringConstants"; -import { buildClientInfo, ClientInfo } from "../../src/auth/ClientInfo"; -import { IdToken } from "../../src/auth/IdToken"; -import { IdTokenClaims } from "../../src/auth/IdTokenClaims"; +import { buildClientInfo, ClientInfo } from "../../src/account/ClientInfo"; +import { IdToken } from "../../src/account/IdToken"; +import { IdTokenClaims } from "../../src/account/IdTokenClaims"; class TestClient extends Client { diff --git a/lib/msal-common/test/client/PublicClient.spec.ts b/lib/msal-common/test/client/PublicClient.spec.ts index 8332c4fe20..eda266354a 100644 --- a/lib/msal-common/test/client/PublicClient.spec.ts +++ b/lib/msal-common/test/client/PublicClient.spec.ts @@ -11,19 +11,19 @@ import { ClientConfigurationError, ClientConfigurationErrorMessage } from "../.. import sinon from "sinon"; import { AADServerParamKeys, TemporaryCacheKeys, PersistentCacheKeys, Constants } from "../../src/utils/Constants"; import { ServerCodeRequestParameters } from "../../src/server/ServerCodeRequestParameters"; -import { IdTokenClaims } from "../../src/auth/IdTokenClaims"; -import { IdToken } from "../../src/auth/IdToken"; +import { IdTokenClaims } from "../../src/account/IdTokenClaims"; +import { IdToken } from "../../src/account/IdToken"; import { LogLevel } from "../../src/logger/Logger"; import { PublicClientConfiguration } from "../../src/config/PublicClientConfiguration"; import { NetworkRequestOptions } from "../../src/network/INetworkModule"; -import { Authority } from "../../src/auth/authority/Authority"; +import { Authority } from "../../src/authority/Authority"; import { PkceCodes } from "../../src/crypto/ICrypto"; import { TokenExchangeParameters } from "../../src/request/TokenExchangeParameters"; import { ClientAuthErrorMessage } from "../../src/error/ClientAuthError"; import { AuthError } from "../../src/error/AuthError"; import { CodeResponse } from "../../src/response/CodeResponse"; import { TokenResponse, Account, AuthorityFactory, TokenRenewParameters } from "../../src"; -import { buildClientInfo } from "../../src/auth/ClientInfo"; +import { buildClientInfo } from "../../src/account/ClientInfo"; import { TimeUtils } from "../../src/utils/TimeUtils"; import { AccessTokenKey } from "../../src/cache/AccessTokenKey"; import { AccessTokenValue } from "../../src/cache/AccessTokenValue"; diff --git a/lib/msal-common/test/config/Configuration.spec.ts b/lib/msal-common/test/config/Configuration.spec.ts index 8ae1c42629..0d38bd55ff 100644 --- a/lib/msal-common/test/config/Configuration.spec.ts +++ b/lib/msal-common/test/config/Configuration.spec.ts @@ -9,9 +9,9 @@ import { LogLevel } from "../../src/logger/Logger"; const expect = chai.expect; chai.use(chaiAsPromised); -describe("ModuleConfiguration.ts Class Unit Tests", () => { +describe("Configuration.ts Class Unit Tests", () => { - it("buildModuleConfiguration assigns default functions", async () => { + it("buildConfiguration assigns default functions", async () => { let emptyConfig: Configuration = buildConfiguration({}); // Crypto interface checks expect(emptyConfig.cryptoInterface).to.be.not.null; diff --git a/lib/msal-common/test/config/PublicClientConfiguration.spec.ts b/lib/msal-common/test/config/PublicClientConfiguration.spec.ts index e19cc1c229..36cb5dab08 100644 --- a/lib/msal-common/test/config/PublicClientConfiguration.spec.ts +++ b/lib/msal-common/test/config/PublicClientConfiguration.spec.ts @@ -9,9 +9,9 @@ import { AuthError } from "../../src/error/AuthError"; import { NetworkRequestOptions } from "../../src/network/INetworkModule"; import { LogLevel } from "../../src/logger/Logger"; -describe("PublicClientSPAConfiguration.ts Class Unit Tests", () => { +describe("PublicClientConfiguration.ts Class Unit Tests", () => { - it("buildPublicClientSPAConfiguration assigns default functions", async () => { + it("buildPublicClientConfiguration assigns default functions", async () => { let emptyConfig: PublicClientConfiguration = buildPublicClientConfiguration({auth: null}); // Auth config checks expect(emptyConfig.auth).to.be.not.null; diff --git a/lib/msal-common/test/response/ResponseHandler.spec.ts b/lib/msal-common/test/response/ResponseHandler.spec.ts index d733a9c9ea..0f08e9abd2 100644 --- a/lib/msal-common/test/response/ResponseHandler.spec.ts +++ b/lib/msal-common/test/response/ResponseHandler.spec.ts @@ -6,10 +6,10 @@ import { CacheHelpers } from "../../src/cache/CacheHelpers"; import { ICacheStorage } from "../../src/cache/ICacheStorage"; import { ICrypto, PkceCodes } from "../../src/crypto/ICrypto"; import { Logger, LogLevel } from "../../src/logger/Logger"; -import { IdTokenClaims } from "../../src/auth/IdTokenClaims"; -import { IdToken } from "../../src/auth/IdToken"; -import { LoggerOptions } from "../../src/app/config/ModuleConfiguration"; -import { Account } from "../../src/auth/Account"; +import { IdTokenClaims } from "../../src/account/IdTokenClaims"; +import { IdToken } from "../../src/account/IdToken"; +import { LoggerOptions } from "../../src/config/Configuration"; +import { Account } from "../../src/account/Account"; import { TokenResponse } from "../../src/response/TokenResponse"; import { ServerAuthorizationCodeResponse } from "../../src/server/ServerAuthorizationCodeResponse"; import { ClientAuthErrorMessage, ClientAuthError } from "../../src/error/ClientAuthError"; @@ -117,7 +117,7 @@ describe("ResponseHandler.ts Class Unit Tests", () => { const tokenResponse: TokenResponse = { uniqueId: "", tenantId: "", - scopes: ["openid", "profile"], + scopes: ["openid", "profile"], tokenType: TEST_CONFIG.TOKEN_TYPE_BEARER, idToken: "", idTokenClaims: null, @@ -147,7 +147,7 @@ describe("ResponseHandler.ts Class Unit Tests", () => { const tokenResponse: TokenResponse = { uniqueId: "", tenantId: "", - scopes: ["openid", "profile"], + scopes: ["openid", "profile"], tokenType: TEST_CONFIG.TOKEN_TYPE_BEARER, idToken: "", idTokenClaims: null, @@ -361,7 +361,7 @@ describe("ResponseHandler.ts Class Unit Tests", () => { const expectedTokenResponse: TokenResponse = { uniqueId: idToken.claims.oid, tenantId: idToken.claims.tid, - scopes: TEST_CONFIG.DEFAULT_SCOPES, + scopes: TEST_CONFIG.DEFAULT_SCOPES, tokenType: TEST_CONFIG.TOKEN_TYPE_BEARER, idToken: idToken.rawIdToken, idTokenClaims: idToken.claims, diff --git a/lib/msal-common/test/server/ServerCodeRequestParameters.spec.ts b/lib/msal-common/test/server/ServerCodeRequestParameters.spec.ts index b4885b0343..1416b3a4f6 100644 --- a/lib/msal-common/test/server/ServerCodeRequestParameters.spec.ts +++ b/lib/msal-common/test/server/ServerCodeRequestParameters.spec.ts @@ -1,16 +1,16 @@ import { expect } from "chai"; import sinon from "sinon"; import { ServerCodeRequestParameters } from "../../src/server/ServerCodeRequestParameters"; -import { AadAuthority } from "../../src/auth/authority/AadAuthority"; +import { AadAuthority } from "../../src/authority/AadAuthority"; import { Constants, SSOTypes, PromptValue, AADServerParamKeys } from "../../src/utils/Constants"; import { NetworkRequestOptions, INetworkModule } from "../../src/network/INetworkModule"; import { TEST_CONFIG, TEST_URIS, RANDOM_TEST_GUID, TEST_TOKENS, TEST_DATA_CLIENT_INFO, DEFAULT_OPENID_CONFIG_RESPONSE, DEFAULT_TENANT_DISCOVERY_RESPONSE } from "../utils/StringConstants"; import { AuthenticationParameters } from "../../src/request/AuthenticationParameters"; import { ICrypto, PkceCodes } from "../../src/crypto/ICrypto"; -import { IdTokenClaims } from "../../src/auth/IdTokenClaims"; -import { IdToken } from "../../src/auth/IdToken"; -import { buildClientInfo, ClientInfo } from "../../src/auth/ClientInfo"; -import { Account } from "../../src/auth/Account"; +import { IdTokenClaims } from "../../src/account/IdTokenClaims"; +import { IdToken } from "../../src/account/IdToken"; +import { buildClientInfo, ClientInfo } from "../../src/account/ClientInfo"; +import { Account } from "../../src/account/Account"; import { ClientConfigurationErrorMessage, ClientConfigurationError } from "../../src/error/ClientConfigurationError"; describe("ServerCodeRequestParameters.ts Class Unit Tests", () => { @@ -487,7 +487,7 @@ describe("ServerCodeRequestParameters.ts Class Unit Tests", () => { }; sinon.stub(IdToken, "extractIdToken").returns(adalTokenClaims); const adalToken = new IdToken(TEST_TOKENS.IDTOKEN_V1, cryptoInterface); - + const codeRequestParams = new ServerCodeRequestParameters( aadAuthority, TEST_CONFIG.MSAL_CLIENT_ID, diff --git a/lib/msal-common/test/server/ServerTokenRequestParameters.spec.ts b/lib/msal-common/test/server/ServerTokenRequestParameters.spec.ts index 7df72a2d57..752bce18ce 100644 --- a/lib/msal-common/test/server/ServerTokenRequestParameters.spec.ts +++ b/lib/msal-common/test/server/ServerTokenRequestParameters.spec.ts @@ -3,7 +3,7 @@ import sinon from "sinon"; import { TokenExchangeParameters } from "../../src/request/TokenExchangeParameters"; import { ServerTokenRequestParameters } from "../../src/server/ServerTokenRequestParameters"; import { TEST_CONFIG, TEST_URIS, TEST_DATA_CLIENT_INFO, RANDOM_TEST_GUID, TEST_TOKENS } from "../utils/StringConstants"; -import { AadAuthority } from "../../src/auth/authority/AadAuthority"; +import { AadAuthority } from "../../src/authority/AadAuthority"; import { PkceCodes, ICrypto } from "../../src/crypto/ICrypto"; import { NetworkRequestOptions, INetworkModule } from "../../src/network/INetworkModule"; import { Constants, HEADER_NAMES, AADServerParamKeys } from "../../src/utils/Constants"; From 9ea4587aff3633c67f5f5f25af9198d2e4349ec9 Mon Sep 17 00:00:00 2001 From: sameerag Date: Mon, 2 Mar 2020 15:47:51 -0800 Subject: [PATCH 09/10] Name change for `Client` to `BaseClient` and test updates --- lib/msal-common/src/client/{Client.ts => BaseClient.ts} | 2 +- lib/msal-common/src/client/PublicClient.ts | 4 ++-- .../test/client/{Client.spec.ts => BaseClient.spec.ts} | 6 +++--- lib/msal-common/test/client/PublicClient.spec.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) rename lib/msal-common/src/client/{Client.ts => BaseClient.ts} (99%) rename lib/msal-common/test/client/{Client.spec.ts => BaseClient.spec.ts} (97%) diff --git a/lib/msal-common/src/client/Client.ts b/lib/msal-common/src/client/BaseClient.ts similarity index 99% rename from lib/msal-common/src/client/Client.ts rename to lib/msal-common/src/client/BaseClient.ts index 7d7ba65576..862767ebbb 100644 --- a/lib/msal-common/src/client/Client.ts +++ b/lib/msal-common/src/client/BaseClient.ts @@ -35,7 +35,7 @@ export type ResponseStateInfo = { * Parent object instance which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow. * */ -export abstract class Client { +export abstract class BaseClient { // Logger object public logger: Logger; diff --git a/lib/msal-common/src/client/PublicClient.ts b/lib/msal-common/src/client/PublicClient.ts index 0cff75fe17..729910868a 100644 --- a/lib/msal-common/src/client/PublicClient.ts +++ b/lib/msal-common/src/client/PublicClient.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ -import { Client } from "./Client"; +import { BaseClient } from "./BaseClient"; import { PublicClientConfiguration, buildPublicClientConfiguration } from "../config/PublicClientConfiguration"; import { AuthenticationParameters } from "../request/AuthenticationParameters"; import { TokenExchangeParameters } from "../request/TokenExchangeParameters"; @@ -31,7 +31,7 @@ import { UrlString } from "../url/UrlString"; * Object instance which will construct requests to send to and handle responses * from the Microsoft STS using the authorization code flow. */ -export class PublicClient extends Client { +export class PublicClient extends BaseClient { // Application config private clientConfig: PublicClientConfiguration; diff --git a/lib/msal-common/test/client/Client.spec.ts b/lib/msal-common/test/client/BaseClient.spec.ts similarity index 97% rename from lib/msal-common/test/client/Client.spec.ts rename to lib/msal-common/test/client/BaseClient.spec.ts index 4d095401f2..781b1aa2f6 100644 --- a/lib/msal-common/test/client/Client.spec.ts +++ b/lib/msal-common/test/client/BaseClient.spec.ts @@ -3,7 +3,7 @@ import chai from "chai"; import chaiAsPromised from "chai-as-promised"; const expect = chai.expect; chai.use(chaiAsPromised); -import { Client } from "../../src/client/Client"; +import { BaseClient } from "../../src/client/BaseClient"; import { Configuration } from "../../src/config/Configuration"; import { AuthenticationParameters } from "../../src/request/AuthenticationParameters"; import { TokenResponse } from "../../src/response/TokenResponse"; @@ -16,7 +16,7 @@ import { buildClientInfo, ClientInfo } from "../../src/auth/ClientInfo"; import { IdToken } from "../../src/auth/IdToken"; import { IdTokenClaims } from "../../src/auth/IdTokenClaims"; -class TestClient extends Client { +class TestClient extends BaseClient { constructor(config: Configuration, testAccount: Account) { super(config); @@ -61,7 +61,7 @@ describe("AuthModule.ts Class Unit Tests", () => { }; let client = new TestClient(config, null); expect(client).to.be.not.null; - expect(client instanceof Client).to.be.true; + expect(client instanceof BaseClient).to.be.true; }); }); diff --git a/lib/msal-common/test/client/PublicClient.spec.ts b/lib/msal-common/test/client/PublicClient.spec.ts index 8332c4fe20..4b5b1210b2 100644 --- a/lib/msal-common/test/client/PublicClient.spec.ts +++ b/lib/msal-common/test/client/PublicClient.spec.ts @@ -5,7 +5,7 @@ const expect = chai.expect; chai.use(chaiAsPromised); import { PublicClient } from "../../src/client/PublicClient"; import { TEST_CONFIG, TEST_URIS, RANDOM_TEST_GUID, DEFAULT_OPENID_CONFIG_RESPONSE, TEST_TOKENS, ALTERNATE_OPENID_CONFIG_RESPONSE, TEST_DATA_CLIENT_INFO, TEST_TOKEN_LIFETIMES } from "../utils/StringConstants"; -import { Client } from "../../src/client/Client"; +import { BaseClient } from "../../src/client/BaseClient"; import { AuthenticationParameters } from "../../src/request/AuthenticationParameters"; import { ClientConfigurationError, ClientConfigurationErrorMessage } from "../../src/error/ClientConfigurationError"; import sinon from "sinon"; @@ -105,7 +105,7 @@ describe("PublicClient.ts Class Unit Tests", () => { const client = new PublicClient(defaultAuthConfig); expect(client).to.be.not.null; expect(client instanceof PublicClient).to.be.true; - expect(client instanceof Client).to.be.true; + expect(client instanceof BaseClient).to.be.true; }); }); From 21bdbb3042170099fde4dcaa2a46652368012152 Mon Sep 17 00:00:00 2001 From: sameerag Date: Mon, 2 Mar 2020 15:54:34 -0800 Subject: [PATCH 10/10] Updating names in comments --- lib/msal-common/src/client/BaseClient.ts | 2 +- lib/msal-common/test/client/BaseClient.spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msal-common/src/client/BaseClient.ts b/lib/msal-common/src/client/BaseClient.ts index 862767ebbb..8c0e8ed506 100644 --- a/lib/msal-common/src/client/BaseClient.ts +++ b/lib/msal-common/src/client/BaseClient.ts @@ -30,7 +30,7 @@ export type ResponseStateInfo = { }; /** - * AuthModule class + * BaseClient class * * Parent object instance which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow. * diff --git a/lib/msal-common/test/client/BaseClient.spec.ts b/lib/msal-common/test/client/BaseClient.spec.ts index 781b1aa2f6..ffd84d119d 100644 --- a/lib/msal-common/test/client/BaseClient.spec.ts +++ b/lib/msal-common/test/client/BaseClient.spec.ts @@ -48,10 +48,10 @@ class TestClient extends BaseClient { } } -describe("AuthModule.ts Class Unit Tests", () => { +describe("BaseClient.ts Class Unit Tests", () => { describe("Constructor", () => { - it("Creates a valid AuthModule object", () => { + it("Creates a valid BaseClient object", () => { let config: Configuration = { systemOptions: null, cryptoInterface: null,