@contember/engine-tenant-api 1.4.6 → 1.4.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contember/engine-tenant-api",
3
- "version": "1.4.6",
3
+ "version": "1.4.9",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/src/index.js",
6
6
  "typings": "dist/src/index.d.ts",
@@ -13,16 +13,16 @@
13
13
  "test": "vitest --dir ./tests/cases --no-threads"
14
14
  },
15
15
  "dependencies": {
16
- "@contember/authorization": "1.4.6",
17
- "@contember/config-loader": "1.4.6",
18
- "@contember/database": "1.4.6",
19
- "@contember/database-migrations": "1.4.6",
20
- "@contember/dic": "1.4.6",
21
- "@contember/graphql-utils": "1.4.6",
22
- "@contember/logger": "1.4.6",
23
- "@contember/schema": "1.4.6",
24
- "@contember/schema-utils": "1.4.6",
25
- "@contember/typesafe": "1.4.6",
16
+ "@contember/authorization": "1.4.9",
17
+ "@contember/config-loader": "1.4.9",
18
+ "@contember/database": "1.4.9",
19
+ "@contember/database-migrations": "1.4.9",
20
+ "@contember/dic": "1.4.9",
21
+ "@contember/graphql-utils": "1.4.9",
22
+ "@contember/logger": "1.4.9",
23
+ "@contember/schema": "1.4.9",
24
+ "@contember/schema-utils": "1.4.9",
25
+ "@contember/typesafe": "1.4.9",
26
26
  "@graphql-tools/utils": "^10.0.8",
27
27
  "graphql-tag": "^2.12.6",
28
28
  "jose": "^5.1.1",
@@ -32,7 +32,7 @@
32
32
  "otpauth": "^9.1.5"
33
33
  },
34
34
  "devDependencies": {
35
- "@contember/database-tester": "1.4.6",
35
+ "@contember/database-tester": "1.4.9",
36
36
  "@graphql-codegen/cli": "^5.0.0",
37
37
  "@graphql-codegen/typescript": "^4.0.1",
38
38
  "@graphql-codegen/typescript-operations": "^4.0.1",
@@ -4,10 +4,6 @@ import { IDPValidationError } from '../IDPValidationError'
4
4
  import { IDPResponseError } from '../IDPResponseError'
5
5
  import { IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'
6
6
 
7
- custom.setHttpOptionsDefaults({
8
- timeout: 5000,
9
- })
10
-
11
7
  export const initOIDCAuth = async (client: Client, { redirectUrl, claims, responseMode }: { redirectUrl: string; claims?: string; responseMode?: string }): Promise<InitIDPAuthResult> => {
12
8
  const nonce = generators.nonce()
13
9
  const state = generators.state()
@@ -1,4 +1,4 @@
1
- import { Client, Issuer } from 'openid-client'
1
+ import { Client, custom, Issuer } from 'openid-client'
2
2
  import { IdentityProviderHandler, IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'
3
3
  import { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError'
4
4
  import { catchTypesafe } from './helpers'
@@ -6,6 +6,7 @@ import { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes'
6
6
  import { handleOIDCResponse, initOIDCAuth } from './OIDCHelpers'
7
7
  import { IDPValidationError } from '../IDPValidationError'
8
8
 
9
+ const DEFAULT_OIDC_TIMEOUT = 5000
9
10
 
10
11
  export class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {
11
12
  private issuerCache: Record<string, Issuer<Client>> = {}
@@ -40,7 +41,7 @@ export class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration>
40
41
  private async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {
41
42
  this.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)
42
43
 
43
- return new this.issuerCache[configuration.url].Client(
44
+ const client = new this.issuerCache[configuration.url].Client(
44
45
  {
45
46
  client_id: configuration.clientId,
46
47
  client_secret: configuration.clientSecret,
@@ -52,5 +53,9 @@ export class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration>
52
53
  additionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],
53
54
  },
54
55
  )
56
+
57
+ client[custom.http_options] = () => ({ timeout: configuration.timeout ?? DEFAULT_OIDC_TIMEOUT })
58
+
59
+ return client
55
60
  }
56
61
  }
@@ -13,6 +13,7 @@ export const OIDCConfigurationOptions = Typesafe.partial({
13
13
  idTokenSignedResponseAlg: Typesafe.string,
14
14
  fetchUserInfo: Typesafe.boolean,
15
15
  returnOIDCResult: Typesafe.boolean,
16
+ timeout: Typesafe.number,
16
17
  })
17
18
  export const BaseOIDCConfiguration = Typesafe.intersection(
18
19
  Typesafe.object({