oauth4webapi 2.10.0 → 2.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -44,7 +44,7 @@ import * as oauth2 from 'oauth4webapi'
44
44
  **`example`** Deno import
45
45
 
46
46
  ```js
47
- import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.10.0/mod.ts'
47
+ import * as oauth2 from 'https://deno.land/x/oauth4webapi@v2.10.1/mod.ts'
48
48
  ```
49
49
 
50
50
  - Authorization Code Flow - OpenID Connect [source](examples/code.ts), or plain OAuth 2 [source](examples/oauth.ts)
package/build/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  let USER_AGENT;
2
2
  if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
3
3
  const NAME = 'oauth4webapi';
4
- const VERSION = 'v2.10.0';
4
+ const VERSION = 'v2.10.1';
5
5
  USER_AGENT = `${NAME}/${VERSION}`;
6
6
  }
7
7
  function looseInstanceOf(input, expected) {
@@ -481,19 +481,41 @@ export async function issueRequestObject(as, client, parameters, privateKey) {
481
481
  resource.length > 1) {
482
482
  claims.resource = resource;
483
483
  }
484
- let value = parameters.get('claims');
485
- if (value) {
486
- if (value === '[object Object]') {
487
- throw new OPE('"claims" parameter must be passed as a UTF-8 encoded JSON');
488
- }
489
- try {
490
- claims.claims = JSON.parse(value);
484
+ {
485
+ let value = parameters.get('max_age');
486
+ if (value !== null) {
487
+ claims.max_age = parseInt(value, 10);
488
+ if (!Number.isFinite(claims.max_age)) {
489
+ throw new OPE('"max_age" parameter must be a number');
490
+ }
491
491
  }
492
- catch (cause) {
493
- throw new OPE('failed to parse the "claims" parameter as JSON', { cause });
492
+ }
493
+ {
494
+ let value = parameters.get('claims');
495
+ if (value !== null) {
496
+ try {
497
+ claims.claims = JSON.parse(value);
498
+ }
499
+ catch (cause) {
500
+ throw new OPE('failed to parse the "claims" parameter as JSON', { cause });
501
+ }
502
+ if (!isJsonObject(claims.claims)) {
503
+ throw new OPE('"claims" parameter must be a JSON with a top level object');
504
+ }
494
505
  }
495
- if (!isJsonObject(claims.claims)) {
496
- throw new OPE('"claims" parameter must be a top level object');
506
+ }
507
+ {
508
+ let value = parameters.get('authorization_details');
509
+ if (value !== null) {
510
+ try {
511
+ claims.authorization_details = JSON.parse(value);
512
+ }
513
+ catch (cause) {
514
+ throw new OPE('failed to parse the "authorization_details" parameter as JSON', { cause });
515
+ }
516
+ if (!Array.isArray(claims.authorization_details)) {
517
+ throw new OPE('"authorization_details" parameter must be a JSON with a top level array');
518
+ }
497
519
  }
498
520
  }
499
521
  return jwt({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oauth4webapi",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "OAuth 2 / OpenID Connect for JavaScript Runtimes",
5
5
  "keywords": [
6
6
  "access token",