@contember/engine-tenant-api 2.0.0-alpha.22 → 2.0.0-alpha.24

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.
Files changed (40) hide show
  1. package/dist/development/src/model/service/idp/providers/OIDCHelpers.cjs +3 -1
  2. package/dist/development/src/model/service/idp/providers/OIDCHelpers.cjs.map +1 -1
  3. package/dist/development/src/model/service/idp/providers/OIDCHelpers.js +3 -1
  4. package/dist/development/src/model/service/idp/providers/OIDCHelpers.js.map +1 -1
  5. package/dist/development/src/model/service/idp/providers/OIDCProvider.cjs +6 -1
  6. package/dist/development/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
  7. package/dist/development/src/model/service/idp/providers/OIDCProvider.js +6 -1
  8. package/dist/development/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
  9. package/dist/development/src/model/service/idp/providers/OIDCTypes.cjs +2 -1
  10. package/dist/development/src/model/service/idp/providers/OIDCTypes.cjs.map +1 -1
  11. package/dist/development/src/model/service/idp/providers/OIDCTypes.js +2 -1
  12. package/dist/development/src/model/service/idp/providers/OIDCTypes.js.map +1 -1
  13. package/dist/production/src/model/service/idp/providers/OIDCHelpers.cjs +3 -1
  14. package/dist/production/src/model/service/idp/providers/OIDCHelpers.cjs.map +1 -1
  15. package/dist/production/src/model/service/idp/providers/OIDCHelpers.js +3 -1
  16. package/dist/production/src/model/service/idp/providers/OIDCHelpers.js.map +1 -1
  17. package/dist/production/src/model/service/idp/providers/OIDCProvider.cjs +6 -1
  18. package/dist/production/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
  19. package/dist/production/src/model/service/idp/providers/OIDCProvider.js +6 -1
  20. package/dist/production/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
  21. package/dist/production/src/model/service/idp/providers/OIDCTypes.cjs +2 -1
  22. package/dist/production/src/model/service/idp/providers/OIDCTypes.cjs.map +1 -1
  23. package/dist/production/src/model/service/idp/providers/OIDCTypes.js +2 -1
  24. package/dist/production/src/model/service/idp/providers/OIDCTypes.js.map +1 -1
  25. package/dist/tests/tsconfig.tsbuildinfo +1 -1
  26. package/dist/types/model/service/idp/providers/AppleProvider.d.ts +2 -0
  27. package/dist/types/model/service/idp/providers/AppleProvider.d.ts.map +1 -1
  28. package/dist/types/model/service/idp/providers/FacebookProvider.d.ts +2 -0
  29. package/dist/types/model/service/idp/providers/FacebookProvider.d.ts.map +1 -1
  30. package/dist/types/model/service/idp/providers/OIDCHelpers.d.ts +1 -1
  31. package/dist/types/model/service/idp/providers/OIDCHelpers.d.ts.map +1 -1
  32. package/dist/types/model/service/idp/providers/OIDCProvider.d.ts +1 -0
  33. package/dist/types/model/service/idp/providers/OIDCProvider.d.ts.map +1 -1
  34. package/dist/types/model/service/idp/providers/OIDCTypes.d.ts +4 -0
  35. package/dist/types/model/service/idp/providers/OIDCTypes.d.ts.map +1 -1
  36. package/dist/types/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +12 -12
  38. package/src/model/service/idp/providers/OIDCHelpers.ts +4 -2
  39. package/src/model/service/idp/providers/OIDCProvider.ts +6 -1
  40. package/src/model/service/idp/providers/OIDCTypes.ts +1 -0
@@ -21,7 +21,7 @@ const initOIDCAuth = async (client, { redirectUrl, scope, responseMode }) => {
21
21
  sessionData: { nonce, state }
22
22
  };
23
23
  };
24
- const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherData }, fetchUserInfo) => {
24
+ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherData }, fetchUserInfo, returnOIDCResult) => {
25
25
  const params = "parameters" in otherData ? otherData.parameters : client.callbackParams(otherData.url);
26
26
  if (params.state && !sessionData?.state) {
27
27
  throw new IDPValidationError.IDPValidationError(`state is present in parameters, but missing in session data`);
@@ -31,8 +31,10 @@ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherDa
31
31
  const claims = result.claims();
32
32
  const { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims;
33
33
  const userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {};
34
+ const oidcResult = returnOIDCResult ? result : {};
34
35
  return {
35
36
  externalIdentifier: claims.sub,
37
+ ...oidcResult,
36
38
  ...claimsWithoutHashes,
37
39
  ...userInfo
38
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCHelpers.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators } from 'openid-client'\nimport { OIDCResponseData } from './OIDCTypes'\nimport { IDPValidationError } from '../IDPValidationError'\nimport { IDPResponseError } from '../IDPResponseError'\nimport { IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\n\ncustom.setHttpOptionsDefaults({\n\ttimeout: 5000,\n})\n\nexport const initOIDCAuth = async (client: Client, { redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string }): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport const handleOIDCResponse = async (client: Client, { sessionData, redirectUrl, ...otherData }: OIDCResponseData, fetchUserInfo?: boolean): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\n\t\treturn {\n\t\t\texternalIdentifier: claims.sub,\n\t\t\t...claimsWithoutHashes,\n\t\t\t...userInfo,\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n"],"names":["custom","generators","IDPValidationError","errors","IDPResponseError"],"mappings":";;;;;AAMAA,aAAA,OAAO,uBAAuB;AAAA,EAC7B,SAAS;AACV,CAAC;AAEM,MAAM,eAAe,OAAO,QAAgB,EAAE,aAAa,OAAO,mBAA+G;AACjL,QAAA,QAAQC,wBAAW;AACnB,QAAA,QAAQA,wBAAW;AACnB,QAAA,MAAM,OAAO,iBAAiB;AAAA,IACnC,cAAc;AAAA,IACd,eAAe;AAAA,IACf,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AAEM,SAAA;AAAA,IACN,SAAS;AAAA,IACT,aAAa,EAAE,OAAO,MAAM;AAAA,EAAA;AAE9B;AAEa,MAAA,qBAAqB,OAAO,QAAgB,EAAE,aAAa,aAAa,GAAG,UAAU,GAAqB,kBAAkD;AAClK,QAAA,SAAS,gBAAgB,YAAY,UAAU,aAAa,OAAO,eAAe,UAAU,GAAG;AACrG,MAAI,OAAO,SAAS,CAAC,aAAa,OAAO;AAClC,UAAA,IAAIC,sCAAmB,6DAA6D;AAAA,EAC3F;AACI,MAAA;AACH,UAAM,SAAS,MAAM,OAAO,SAAS,aAAa,QAAQ,WAAW;AAC/D,UAAA,SAAS,OAAO;AACtB,UAAM,EAAE,SAAS,QAAQ,OAAO,GAAG,oBAAwB,IAAA;AACrD,UAAA,WAAW,OAAO,gBAAgB,gBAAgB,MAAM,OAAO,SAAS,MAAM,IAAI;AAEjF,WAAA;AAAA,MACN,oBAAoB,OAAO;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,WAEI,GAAQ;AACZ,QAAA,aAAaC,oBAAO,SAAS;AAC1B,YAAA,IAAID,mBAAmB,mBAAA,EAAE,OAAO;AAAA,IACvC;AACI,QAAA,aAAaC,oBAAO,SAAS;AAC1B,YAAA,OAAO,EAAE,UAAU;AACrB,UAAA,OAAO,SAAS,YAAY,OAAO,MAAM,UAAU,YAAY,OAAO,KAAK,OAAO,YAAY,UAAU;AAC3G,cAAM,IAAIC,iBAAAA,iBAAiB,KAAK,MAAM,OAAO;AAAA,MAC9C;AACM,YAAA,IAAIA,iBAAiB,iBAAA,EAAE,OAAO;AAAA,IACrC;AACM,UAAA;AAAA,EACP;AACD;;;"}
1
+ {"version":3,"file":"OIDCHelpers.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators } from 'openid-client'\nimport { OIDCResponseData } from './OIDCTypes'\nimport { IDPValidationError } from '../IDPValidationError'\nimport { IDPResponseError } from '../IDPResponseError'\nimport { IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\n\ncustom.setHttpOptionsDefaults({\n\ttimeout: 5000,\n})\n\nexport const initOIDCAuth = async (client: Client, { redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string }): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport const handleOIDCResponse = async (client: Client, { sessionData, redirectUrl, ...otherData }: OIDCResponseData, fetchUserInfo?: boolean, returnOIDCResult?: boolean): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\t\tconst oidcResult = returnOIDCResult ? result : {}\n\t\t\n\t\treturn {\n\t\t\texternalIdentifier: claims.sub,\n\t\t\t...oidcResult,\n\t\t\t...claimsWithoutHashes,\n\t\t\t...userInfo,\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n"],"names":["custom","generators","IDPValidationError","errors","IDPResponseError"],"mappings":";;;;;AAMAA,aAAA,OAAO,uBAAuB;AAAA,EAC7B,SAAS;AACV,CAAC;AAEM,MAAM,eAAe,OAAO,QAAgB,EAAE,aAAa,OAAO,mBAA+G;AACjL,QAAA,QAAQC,wBAAW;AACnB,QAAA,QAAQA,wBAAW;AACnB,QAAA,MAAM,OAAO,iBAAiB;AAAA,IACnC,cAAc;AAAA,IACd,eAAe;AAAA,IACf,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AAEM,SAAA;AAAA,IACN,SAAS;AAAA,IACT,aAAa,EAAE,OAAO,MAAM;AAAA,EAAA;AAE9B;AAEa,MAAA,qBAAqB,OAAO,QAAgB,EAAE,aAAa,aAAa,GAAG,UAAA,GAA+B,eAAyB,qBAAqD;AAC9L,QAAA,SAAS,gBAAgB,YAAY,UAAU,aAAa,OAAO,eAAe,UAAU,GAAG;AACrG,MAAI,OAAO,SAAS,CAAC,aAAa,OAAO;AAClC,UAAA,IAAIC,sCAAmB,6DAA6D;AAAA,EAC3F;AACI,MAAA;AACH,UAAM,SAAS,MAAM,OAAO,SAAS,aAAa,QAAQ,WAAW;AAC/D,UAAA,SAAS,OAAO;AACtB,UAAM,EAAE,SAAS,QAAQ,OAAO,GAAG,oBAAwB,IAAA;AACrD,UAAA,WAAW,OAAO,gBAAgB,gBAAgB,MAAM,OAAO,SAAS,MAAM,IAAI;AAClF,UAAA,aAAa,mBAAmB,SAAS;AAExC,WAAA;AAAA,MACN,oBAAoB,OAAO;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,WAEI,GAAQ;AACZ,QAAA,aAAaC,oBAAO,SAAS;AAC1B,YAAA,IAAID,mBAAmB,mBAAA,EAAE,OAAO;AAAA,IACvC;AACI,QAAA,aAAaC,oBAAO,SAAS;AAC1B,YAAA,OAAO,EAAE,UAAU;AACrB,UAAA,OAAO,SAAS,YAAY,OAAO,MAAM,UAAU,YAAY,OAAO,KAAK,OAAO,YAAY,UAAU;AAC3G,cAAM,IAAIC,iBAAAA,iBAAiB,KAAK,MAAM,OAAO;AAAA,MAC9C;AACM,YAAA,IAAIA,iBAAiB,iBAAA,EAAE,OAAO;AAAA,IACrC;AACM,UAAA;AAAA,EACP;AACD;;;"}
@@ -19,7 +19,7 @@ const initOIDCAuth = async (client, { redirectUrl, scope, responseMode }) => {
19
19
  sessionData: { nonce, state }
20
20
  };
21
21
  };
22
- const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherData }, fetchUserInfo) => {
22
+ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherData }, fetchUserInfo, returnOIDCResult) => {
23
23
  const params = "parameters" in otherData ? otherData.parameters : client.callbackParams(otherData.url);
24
24
  if (params.state && !sessionData?.state) {
25
25
  throw new IDPValidationError(`state is present in parameters, but missing in session data`);
@@ -29,8 +29,10 @@ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherDa
29
29
  const claims = result.claims();
30
30
  const { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims;
31
31
  const userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {};
32
+ const oidcResult = returnOIDCResult ? result : {};
32
33
  return {
33
34
  externalIdentifier: claims.sub,
35
+ ...oidcResult,
34
36
  ...claimsWithoutHashes,
35
37
  ...userInfo
36
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCHelpers.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators } from 'openid-client'\nimport { OIDCResponseData } from './OIDCTypes'\nimport { IDPValidationError } from '../IDPValidationError'\nimport { IDPResponseError } from '../IDPResponseError'\nimport { IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\n\ncustom.setHttpOptionsDefaults({\n\ttimeout: 5000,\n})\n\nexport const initOIDCAuth = async (client: Client, { redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string }): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport const handleOIDCResponse = async (client: Client, { sessionData, redirectUrl, ...otherData }: OIDCResponseData, fetchUserInfo?: boolean): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\n\t\treturn {\n\t\t\texternalIdentifier: claims.sub,\n\t\t\t...claimsWithoutHashes,\n\t\t\t...userInfo,\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n"],"names":[],"mappings":";;;AAMA,OAAO,uBAAuB;AAAA,EAC7B,SAAS;AACV,CAAC;AAEM,MAAM,eAAe,OAAO,QAAgB,EAAE,aAAa,OAAO,mBAA+G;AACjL,QAAA,QAAQ,WAAW;AACnB,QAAA,QAAQ,WAAW;AACnB,QAAA,MAAM,OAAO,iBAAiB;AAAA,IACnC,cAAc;AAAA,IACd,eAAe;AAAA,IACf,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AAEM,SAAA;AAAA,IACN,SAAS;AAAA,IACT,aAAa,EAAE,OAAO,MAAM;AAAA,EAAA;AAE9B;AAEa,MAAA,qBAAqB,OAAO,QAAgB,EAAE,aAAa,aAAa,GAAG,UAAU,GAAqB,kBAAkD;AAClK,QAAA,SAAS,gBAAgB,YAAY,UAAU,aAAa,OAAO,eAAe,UAAU,GAAG;AACrG,MAAI,OAAO,SAAS,CAAC,aAAa,OAAO;AAClC,UAAA,IAAI,mBAAmB,6DAA6D;AAAA,EAC3F;AACI,MAAA;AACH,UAAM,SAAS,MAAM,OAAO,SAAS,aAAa,QAAQ,WAAW;AAC/D,UAAA,SAAS,OAAO;AACtB,UAAM,EAAE,SAAS,QAAQ,OAAO,GAAG,oBAAwB,IAAA;AACrD,UAAA,WAAW,OAAO,gBAAgB,gBAAgB,MAAM,OAAO,SAAS,MAAM,IAAI;AAEjF,WAAA;AAAA,MACN,oBAAoB,OAAO;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,WAEI,GAAQ;AACZ,QAAA,aAAa,OAAO,SAAS;AAC1B,YAAA,IAAI,mBAAmB,EAAE,OAAO;AAAA,IACvC;AACI,QAAA,aAAa,OAAO,SAAS;AAC1B,YAAA,OAAO,EAAE,UAAU;AACrB,UAAA,OAAO,SAAS,YAAY,OAAO,MAAM,UAAU,YAAY,OAAO,KAAK,OAAO,YAAY,UAAU;AAC3G,cAAM,IAAI,iBAAiB,KAAK,MAAM,OAAO;AAAA,MAC9C;AACM,YAAA,IAAI,iBAAiB,EAAE,OAAO;AAAA,IACrC;AACM,UAAA;AAAA,EACP;AACD;"}
1
+ {"version":3,"file":"OIDCHelpers.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators } from 'openid-client'\nimport { OIDCResponseData } from './OIDCTypes'\nimport { IDPValidationError } from '../IDPValidationError'\nimport { IDPResponseError } from '../IDPResponseError'\nimport { IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\n\ncustom.setHttpOptionsDefaults({\n\ttimeout: 5000,\n})\n\nexport const initOIDCAuth = async (client: Client, { redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string }): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport const handleOIDCResponse = async (client: Client, { sessionData, redirectUrl, ...otherData }: OIDCResponseData, fetchUserInfo?: boolean, returnOIDCResult?: boolean): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\t\tconst oidcResult = returnOIDCResult ? result : {}\n\t\t\n\t\treturn {\n\t\t\texternalIdentifier: claims.sub,\n\t\t\t...oidcResult,\n\t\t\t...claimsWithoutHashes,\n\t\t\t...userInfo,\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n"],"names":[],"mappings":";;;AAMA,OAAO,uBAAuB;AAAA,EAC7B,SAAS;AACV,CAAC;AAEM,MAAM,eAAe,OAAO,QAAgB,EAAE,aAAa,OAAO,mBAA+G;AACjL,QAAA,QAAQ,WAAW;AACnB,QAAA,QAAQ,WAAW;AACnB,QAAA,MAAM,OAAO,iBAAiB;AAAA,IACnC,cAAc;AAAA,IACd,eAAe;AAAA,IACf,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AAEM,SAAA;AAAA,IACN,SAAS;AAAA,IACT,aAAa,EAAE,OAAO,MAAM;AAAA,EAAA;AAE9B;AAEa,MAAA,qBAAqB,OAAO,QAAgB,EAAE,aAAa,aAAa,GAAG,UAAA,GAA+B,eAAyB,qBAAqD;AAC9L,QAAA,SAAS,gBAAgB,YAAY,UAAU,aAAa,OAAO,eAAe,UAAU,GAAG;AACrG,MAAI,OAAO,SAAS,CAAC,aAAa,OAAO;AAClC,UAAA,IAAI,mBAAmB,6DAA6D;AAAA,EAC3F;AACI,MAAA;AACH,UAAM,SAAS,MAAM,OAAO,SAAS,aAAa,QAAQ,WAAW;AAC/D,UAAA,SAAS,OAAO;AACtB,UAAM,EAAE,SAAS,QAAQ,OAAO,GAAG,oBAAwB,IAAA;AACrD,UAAA,WAAW,OAAO,gBAAgB,gBAAgB,MAAM,OAAO,SAAS,MAAM,IAAI;AAClF,UAAA,aAAa,mBAAmB,SAAS;AAExC,WAAA;AAAA,MACN,oBAAoB,OAAO;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,WAEI,GAAQ;AACZ,QAAA,aAAa,OAAO,SAAS;AAC1B,YAAA,IAAI,mBAAmB,EAAE,OAAO;AAAA,IACvC;AACI,QAAA,aAAa,OAAO,SAAS;AAC1B,YAAA,OAAO,EAAE,UAAU;AACrB,UAAA,OAAO,SAAS,YAAY,OAAO,MAAM,UAAU,YAAY,OAAO,KAAK,OAAO,YAAY,UAAU;AAC3G,cAAM,IAAI,iBAAiB,KAAK,MAAM,OAAO;AAAA,MAC9C;AACM,YAAA,IAAI,iBAAiB,EAAE,OAAO;AAAA,IACrC;AACM,UAAA;AAAA,EACP;AACD;"}
@@ -25,7 +25,12 @@ class OIDCProvider {
25
25
  async processResponse(configuration, data) {
26
26
  const responseData = helpers.catchTypesafe(OIDCTypes.OIDCResponseData, IDPValidationError.IDPValidationError)(data);
27
27
  const client = await this.createOIDCClient(configuration);
28
- return await OIDCHelpers.handleOIDCResponse(client, responseData, configuration.fetchUserInfo);
28
+ return await OIDCHelpers.handleOIDCResponse(
29
+ client,
30
+ responseData,
31
+ configuration.fetchUserInfo,
32
+ configuration.returnOIDCResult
33
+ );
29
34
  }
30
35
  getPublicConfiguration({ clientSecret, ...config }) {
31
36
  return config;
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCProvider.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, Issuer } from 'openid-client'\nimport { IdentityProviderHandler, IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError'\nimport { catchTypesafe } from './helpers'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes'\nimport { handleOIDCResponse, initOIDCAuth } from './OIDCHelpers'\nimport { IDPValidationError } from '../IDPValidationError'\n\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: configuration.scope ?? configuration.claims,\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(client, responseData, configuration.fetchUserInfo)\n\t}\n\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\treturn new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\t}\n}\n"],"names":["catchTypesafe","OIDCConfiguration","InvalidIDPConfigurationError","OIDCInitData","IDPValidationError","initOIDCAuth","OIDCResponseData","handleOIDCResponse","Issuer"],"mappings":";;;;;;;;;;;AASO,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,CAAA,CAAC;AAE/B,kBAAA,MAAA,yBAAAA,QAAA,cAAcC,6BAAmBC,6BAA4B,4BAAA,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAWF,QAAAA,cAAcG,UAAAA,cAAcC,mBAAAA,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACjD,WAAA,MAAMC,yBAAa,QAAQ;AAAA,MACjC,OAAO,cAAc,SAAS,cAAc;AAAA,MAC5C,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAeL,QAAAA,cAAcM,UAAAA,kBAAkBF,mBAAAA,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAMG,YAAA,mBAAmB,QAAQ,cAAc,cAAc,aAAa;AAAA,EAClF;AAAA,EAGA,uBAAuB,EAAE,cAAc,GAAG,UAAyD;AAC3F,WAAA;AAAA,EACR;AAAA,EAEA,MAAc,iBAAiB,eAAmD;AAlCnF,QAAA,IAAA;AAmCO,KAAA,KAAA,KAAA,aAAL,KAAiB,cAAc,GAAA,MAA/B,SAAwC,MAAMC,aAAA,OAAO,SAAS,cAAc,GAAG;AAE/E,WAAO,IAAI,KAAK,YAAY,cAAc,GAAG,EAAE;AAAA,MAC9C;AAAA,QACC,WAAW,cAAc;AAAA,QACzB,eAAe,cAAc;AAAA,QAC7B,gBAAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,MACzE;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MACnF;AAAA,IAAA;AAAA,EAEF;AACD;;"}
1
+ {"version":3,"file":"OIDCProvider.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, Issuer } from 'openid-client'\nimport { IdentityProviderHandler, IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError'\nimport { catchTypesafe } from './helpers'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes'\nimport { handleOIDCResponse, initOIDCAuth } from './OIDCHelpers'\nimport { IDPValidationError } from '../IDPValidationError'\n\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: configuration.scope ?? configuration.claims,\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(\n\t\t\tclient,\n\t\t\tresponseData,\n\t\t\tconfiguration.fetchUserInfo,\n\t\t\tconfiguration.returnOIDCResult,\n\t\t)\n\t}\n\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\treturn new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\t}\n}\n"],"names":["catchTypesafe","OIDCConfiguration","InvalidIDPConfigurationError","OIDCInitData","IDPValidationError","initOIDCAuth","OIDCResponseData","handleOIDCResponse","Issuer"],"mappings":";;;;;;;;;;;AASO,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,CAAA,CAAC;AAE/B,kBAAA,MAAA,yBAAAA,QAAA,cAAcC,6BAAmBC,6BAA4B,4BAAA,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAWF,QAAAA,cAAcG,UAAAA,cAAcC,mBAAAA,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACjD,WAAA,MAAMC,yBAAa,QAAQ;AAAA,MACjC,OAAO,cAAc,SAAS,cAAc;AAAA,MAC5C,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAeL,QAAAA,cAAcM,UAAAA,kBAAkBF,mBAAAA,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAMG,YAAA;AAAA,MACZ;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,cAAc;AAAA,IAAA;AAAA,EAEhB;AAAA,EAGA,uBAAuB,EAAE,cAAc,GAAG,UAAyD;AAC3F,WAAA;AAAA,EACR;AAAA,EAEA,MAAc,iBAAiB,eAAmD;AAvCnF,QAAA,IAAA;AAwCO,KAAA,KAAA,KAAA,aAAL,KAAiB,cAAc,GAAA,MAA/B,SAAwC,MAAMC,aAAA,OAAO,SAAS,cAAc,GAAG;AAE/E,WAAO,IAAI,KAAK,YAAY,cAAc,GAAG,EAAE;AAAA,MAC9C;AAAA,QACC,WAAW,cAAc;AAAA,QACzB,eAAe,cAAc;AAAA,QAC7B,gBAAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,MACzE;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MACnF;AAAA,IAAA;AAAA,EAEF;AACD;;"}
@@ -23,7 +23,12 @@ class OIDCProvider {
23
23
  async processResponse(configuration, data) {
24
24
  const responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data);
25
25
  const client = await this.createOIDCClient(configuration);
26
- return await handleOIDCResponse(client, responseData, configuration.fetchUserInfo);
26
+ return await handleOIDCResponse(
27
+ client,
28
+ responseData,
29
+ configuration.fetchUserInfo,
30
+ configuration.returnOIDCResult
31
+ );
27
32
  }
28
33
  getPublicConfiguration({ clientSecret, ...config }) {
29
34
  return config;
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCProvider.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, Issuer } from 'openid-client'\nimport { IdentityProviderHandler, IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError'\nimport { catchTypesafe } from './helpers'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes'\nimport { handleOIDCResponse, initOIDCAuth } from './OIDCHelpers'\nimport { IDPValidationError } from '../IDPValidationError'\n\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: configuration.scope ?? configuration.claims,\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(client, responseData, configuration.fetchUserInfo)\n\t}\n\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\treturn new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;AASO,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,CAAA,CAAC;AAE/B,kBAAA,MAAA,yBAAA,cAAc,mBAAmB,4BAA4B,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAW,cAAc,cAAc,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACjD,WAAA,MAAM,aAAa,QAAQ;AAAA,MACjC,OAAO,cAAc,SAAS,cAAc;AAAA,MAC5C,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAe,cAAc,kBAAkB,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAM,mBAAmB,QAAQ,cAAc,cAAc,aAAa;AAAA,EAClF;AAAA,EAGA,uBAAuB,EAAE,cAAc,GAAG,UAAyD;AAC3F,WAAA;AAAA,EACR;AAAA,EAEA,MAAc,iBAAiB,eAAmD;AAlCnF,QAAA,IAAA;AAmCO,KAAA,KAAA,KAAA,aAAL,KAAiB,cAAc,GAAA,MAA/B,SAAwC,MAAM,OAAO,SAAS,cAAc,GAAG;AAE/E,WAAO,IAAI,KAAK,YAAY,cAAc,GAAG,EAAE;AAAA,MAC9C;AAAA,QACC,WAAW,cAAc;AAAA,QACzB,eAAe,cAAc;AAAA,QAC7B,gBAAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,MACzE;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MACnF;AAAA,IAAA;AAAA,EAEF;AACD;"}
1
+ {"version":3,"file":"OIDCProvider.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, Issuer } from 'openid-client'\nimport { IdentityProviderHandler, IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError'\nimport { catchTypesafe } from './helpers'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes'\nimport { handleOIDCResponse, initOIDCAuth } from './OIDCHelpers'\nimport { IDPValidationError } from '../IDPValidationError'\n\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: configuration.scope ?? configuration.claims,\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(\n\t\t\tclient,\n\t\t\tresponseData,\n\t\t\tconfiguration.fetchUserInfo,\n\t\t\tconfiguration.returnOIDCResult,\n\t\t)\n\t}\n\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\treturn new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;AASO,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,CAAA,CAAC;AAE/B,kBAAA,MAAA,yBAAA,cAAc,mBAAmB,4BAA4B,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAW,cAAc,cAAc,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACjD,WAAA,MAAM,aAAa,QAAQ;AAAA,MACjC,OAAO,cAAc,SAAS,cAAc;AAAA,MAC5C,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAe,cAAc,kBAAkB,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAM;AAAA,MACZ;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,cAAc;AAAA,IAAA;AAAA,EAEhB;AAAA,EAGA,uBAAuB,EAAE,cAAc,GAAG,UAAyD;AAC3F,WAAA;AAAA,EACR;AAAA,EAEA,MAAc,iBAAiB,eAAmD;AAvCnF,QAAA,IAAA;AAwCO,KAAA,KAAA,KAAA,aAAL,KAAiB,cAAc,GAAA,MAA/B,SAAwC,MAAM,OAAO,SAAS,cAAc,GAAG;AAE/E,WAAO,IAAI,KAAK,YAAY,cAAc,GAAG,EAAE;AAAA,MAC9C;AAAA,QACC,WAAW,cAAc;AAAA,QACzB,eAAe,cAAc;AAAA,QAC7B,gBAAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,MACzE;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MACnF;AAAA,IAAA;AAAA,EAEF;AACD;"}
@@ -25,7 +25,8 @@ const OIDCConfigurationOptions = Typesafe__namespace.partial({
25
25
  scope: Typesafe__namespace.string,
26
26
  additionalAuthorizedParties: Typesafe__namespace.array(Typesafe__namespace.string),
27
27
  idTokenSignedResponseAlg: Typesafe__namespace.string,
28
- fetchUserInfo: Typesafe__namespace.boolean
28
+ fetchUserInfo: Typesafe__namespace.boolean,
29
+ returnOIDCResult: Typesafe__namespace.boolean
29
30
  });
30
31
  const BaseOIDCConfiguration = Typesafe__namespace.intersection(
31
32
  Typesafe__namespace.object({
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCTypes.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCTypes.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { ResponseType } from 'openid-client'\n\nexport interface OIDCSessionData {\n\tnonce: string\n\tstate: string\n}\n\nexport const OIDCConfigurationOptions = Typesafe.partial({\n\tresponseType: Typesafe.enumeration<ResponseType>('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),\n\tclaims: Typesafe.string, // deprecated, use scope instead\n\tscope: Typesafe.string,\n\tadditionalAuthorizedParties: Typesafe.array(Typesafe.string),\n\tidTokenSignedResponseAlg: Typesafe.string,\n\tfetchUserInfo: Typesafe.boolean,\n})\nexport const BaseOIDCConfiguration = Typesafe.intersection(\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t\tclientId: Typesafe.string,\n\t\tclientSecret: Typesafe.string,\n\t}),\n\tOIDCConfigurationOptions,\n)\n\nexport const OIDCConfiguration = Typesafe.intersection(\n\tBaseOIDCConfiguration,\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t}),\n)\n\nexport type OIDCConfiguration = ReturnType<typeof OIDCConfiguration>\n\nexport const OIDCResponseData = Typesafe.intersection(\n\tTypesafe.union(\n\t\tTypesafe.object({\n\t\t\turl: Typesafe.string,\n\t\t}),\n\t\tTypesafe.object({\n\t\t\tparameters: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\t}),\n\t),\n\tTypesafe.partial({\n\t\tredirectUrl: Typesafe.string,\n\t\tsessionData: Typesafe.partial({\n\t\t\tnonce: Typesafe.string,\n\t\t\tstate: Typesafe.string,\n\t\t}),\n\n\t}),\n)\n\nexport type OIDCResponseData = ReturnType<typeof OIDCResponseData>\n\nexport const OIDCInitData = Typesafe.noExtraProps(Typesafe.intersection(\n\tTypesafe.object({\n\t\tredirectUrl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tresponseMode: Typesafe.string,\n\t}),\n))\n\nexport type OIDCInitData = ReturnType<typeof OIDCInitData>\n"],"names":["Typesafe"],"mappings":";;;;;;;;;;;;;;;;;;;;AAQa,MAAA,2BAA2BA,oBAAS,QAAQ;AAAA,EACxD,cAAcA,oBAAS,YAA0B,QAAQ,iBAAiB,uBAAuB,cAAc,YAAY,kBAAkB,MAAM;AAAA,EACnJ,QAAQA,oBAAS;AAAA;AAAA,EACjB,OAAOA,oBAAS;AAAA,EAChB,6BAA6BA,oBAAS,MAAMA,oBAAS,MAAM;AAAA,EAC3D,0BAA0BA,oBAAS;AAAA,EACnC,eAAeA,oBAAS;AACzB,CAAC;AACM,MAAM,wBAAwBA,oBAAS;AAAA,EAC7CA,oBAAS,OAAO;AAAA,IACf,KAAKA,oBAAS;AAAA,IACd,UAAUA,oBAAS;AAAA,IACnB,cAAcA,oBAAS;AAAA,EAAA,CACvB;AAAA,EACD;AACD;AAEO,MAAM,oBAAoBA,oBAAS;AAAA,EACzC;AAAA,EACAA,oBAAS,OAAO;AAAA,IACf,KAAKA,oBAAS;AAAA,EAAA,CACd;AACF;AAIO,MAAM,mBAAmBA,oBAAS;AAAA,EACxCA,oBAAS;AAAA,IACRA,oBAAS,OAAO;AAAA,MACf,KAAKA,oBAAS;AAAA,IAAA,CACd;AAAA,IACDA,oBAAS,OAAO;AAAA,MACf,YAAYA,oBAAS,OAAOA,oBAAS,QAAQA,oBAAS,MAAM;AAAA,IAAA,CAC5D;AAAA,EACF;AAAA,EACAA,oBAAS,QAAQ;AAAA,IAChB,aAAaA,oBAAS;AAAA,IACtB,aAAaA,oBAAS,QAAQ;AAAA,MAC7B,OAAOA,oBAAS;AAAA,MAChB,OAAOA,oBAAS;AAAA,IAAA,CAChB;AAAA,EAAA,CAED;AACF;AAIa,MAAA,eAAeA,oBAAS,aAAaA,oBAAS;AAAA,EAC1DA,oBAAS,OAAO;AAAA,IACf,aAAaA,oBAAS;AAAA,EAAA,CACtB;AAAA,EACDA,oBAAS,QAAQ;AAAA,IAChB,cAAcA,oBAAS;AAAA,EAAA,CACvB;AACF,CAAC;;;;;;"}
1
+ {"version":3,"file":"OIDCTypes.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCTypes.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { ResponseType } from 'openid-client'\n\nexport interface OIDCSessionData {\n\tnonce: string\n\tstate: string\n}\n\nexport const OIDCConfigurationOptions = Typesafe.partial({\n\tresponseType: Typesafe.enumeration<ResponseType>('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),\n\tclaims: Typesafe.string, // deprecated, use scope instead\n\tscope: Typesafe.string,\n\tadditionalAuthorizedParties: Typesafe.array(Typesafe.string),\n\tidTokenSignedResponseAlg: Typesafe.string,\n\tfetchUserInfo: Typesafe.boolean,\n\treturnOIDCResult: Typesafe.boolean,\n})\nexport const BaseOIDCConfiguration = Typesafe.intersection(\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t\tclientId: Typesafe.string,\n\t\tclientSecret: Typesafe.string,\n\t}),\n\tOIDCConfigurationOptions,\n)\n\nexport const OIDCConfiguration = Typesafe.intersection(\n\tBaseOIDCConfiguration,\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t}),\n)\n\nexport type OIDCConfiguration = ReturnType<typeof OIDCConfiguration>\n\nexport const OIDCResponseData = Typesafe.intersection(\n\tTypesafe.union(\n\t\tTypesafe.object({\n\t\t\turl: Typesafe.string,\n\t\t}),\n\t\tTypesafe.object({\n\t\t\tparameters: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\t}),\n\t),\n\tTypesafe.partial({\n\t\tredirectUrl: Typesafe.string,\n\t\tsessionData: Typesafe.partial({\n\t\t\tnonce: Typesafe.string,\n\t\t\tstate: Typesafe.string,\n\t\t}),\n\n\t}),\n)\n\nexport type OIDCResponseData = ReturnType<typeof OIDCResponseData>\n\nexport const OIDCInitData = Typesafe.noExtraProps(Typesafe.intersection(\n\tTypesafe.object({\n\t\tredirectUrl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tresponseMode: Typesafe.string,\n\t}),\n))\n\nexport type OIDCInitData = ReturnType<typeof OIDCInitData>\n"],"names":["Typesafe"],"mappings":";;;;;;;;;;;;;;;;;;;;AAQa,MAAA,2BAA2BA,oBAAS,QAAQ;AAAA,EACxD,cAAcA,oBAAS,YAA0B,QAAQ,iBAAiB,uBAAuB,cAAc,YAAY,kBAAkB,MAAM;AAAA,EACnJ,QAAQA,oBAAS;AAAA;AAAA,EACjB,OAAOA,oBAAS;AAAA,EAChB,6BAA6BA,oBAAS,MAAMA,oBAAS,MAAM;AAAA,EAC3D,0BAA0BA,oBAAS;AAAA,EACnC,eAAeA,oBAAS;AAAA,EACxB,kBAAkBA,oBAAS;AAC5B,CAAC;AACM,MAAM,wBAAwBA,oBAAS;AAAA,EAC7CA,oBAAS,OAAO;AAAA,IACf,KAAKA,oBAAS;AAAA,IACd,UAAUA,oBAAS;AAAA,IACnB,cAAcA,oBAAS;AAAA,EAAA,CACvB;AAAA,EACD;AACD;AAEO,MAAM,oBAAoBA,oBAAS;AAAA,EACzC;AAAA,EACAA,oBAAS,OAAO;AAAA,IACf,KAAKA,oBAAS;AAAA,EAAA,CACd;AACF;AAIO,MAAM,mBAAmBA,oBAAS;AAAA,EACxCA,oBAAS;AAAA,IACRA,oBAAS,OAAO;AAAA,MACf,KAAKA,oBAAS;AAAA,IAAA,CACd;AAAA,IACDA,oBAAS,OAAO;AAAA,MACf,YAAYA,oBAAS,OAAOA,oBAAS,QAAQA,oBAAS,MAAM;AAAA,IAAA,CAC5D;AAAA,EACF;AAAA,EACAA,oBAAS,QAAQ;AAAA,IAChB,aAAaA,oBAAS;AAAA,IACtB,aAAaA,oBAAS,QAAQ;AAAA,MAC7B,OAAOA,oBAAS;AAAA,MAChB,OAAOA,oBAAS;AAAA,IAAA,CAChB;AAAA,EAAA,CAED;AACF;AAIa,MAAA,eAAeA,oBAAS,aAAaA,oBAAS;AAAA,EAC1DA,oBAAS,OAAO;AAAA,IACf,aAAaA,oBAAS;AAAA,EAAA,CACtB;AAAA,EACDA,oBAAS,QAAQ;AAAA,IAChB,cAAcA,oBAAS;AAAA,EAAA,CACvB;AACF,CAAC;;;;;;"}
@@ -6,7 +6,8 @@ const OIDCConfigurationOptions = Typesafe.partial({
6
6
  scope: Typesafe.string,
7
7
  additionalAuthorizedParties: Typesafe.array(Typesafe.string),
8
8
  idTokenSignedResponseAlg: Typesafe.string,
9
- fetchUserInfo: Typesafe.boolean
9
+ fetchUserInfo: Typesafe.boolean,
10
+ returnOIDCResult: Typesafe.boolean
10
11
  });
11
12
  const BaseOIDCConfiguration = Typesafe.intersection(
12
13
  Typesafe.object({
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCTypes.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCTypes.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { ResponseType } from 'openid-client'\n\nexport interface OIDCSessionData {\n\tnonce: string\n\tstate: string\n}\n\nexport const OIDCConfigurationOptions = Typesafe.partial({\n\tresponseType: Typesafe.enumeration<ResponseType>('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),\n\tclaims: Typesafe.string, // deprecated, use scope instead\n\tscope: Typesafe.string,\n\tadditionalAuthorizedParties: Typesafe.array(Typesafe.string),\n\tidTokenSignedResponseAlg: Typesafe.string,\n\tfetchUserInfo: Typesafe.boolean,\n})\nexport const BaseOIDCConfiguration = Typesafe.intersection(\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t\tclientId: Typesafe.string,\n\t\tclientSecret: Typesafe.string,\n\t}),\n\tOIDCConfigurationOptions,\n)\n\nexport const OIDCConfiguration = Typesafe.intersection(\n\tBaseOIDCConfiguration,\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t}),\n)\n\nexport type OIDCConfiguration = ReturnType<typeof OIDCConfiguration>\n\nexport const OIDCResponseData = Typesafe.intersection(\n\tTypesafe.union(\n\t\tTypesafe.object({\n\t\t\turl: Typesafe.string,\n\t\t}),\n\t\tTypesafe.object({\n\t\t\tparameters: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\t}),\n\t),\n\tTypesafe.partial({\n\t\tredirectUrl: Typesafe.string,\n\t\tsessionData: Typesafe.partial({\n\t\t\tnonce: Typesafe.string,\n\t\t\tstate: Typesafe.string,\n\t\t}),\n\n\t}),\n)\n\nexport type OIDCResponseData = ReturnType<typeof OIDCResponseData>\n\nexport const OIDCInitData = Typesafe.noExtraProps(Typesafe.intersection(\n\tTypesafe.object({\n\t\tredirectUrl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tresponseMode: Typesafe.string,\n\t}),\n))\n\nexport type OIDCInitData = ReturnType<typeof OIDCInitData>\n"],"names":[],"mappings":";AAQa,MAAA,2BAA2B,SAAS,QAAQ;AAAA,EACxD,cAAc,SAAS,YAA0B,QAAQ,iBAAiB,uBAAuB,cAAc,YAAY,kBAAkB,MAAM;AAAA,EACnJ,QAAQ,SAAS;AAAA;AAAA,EACjB,OAAO,SAAS;AAAA,EAChB,6BAA6B,SAAS,MAAM,SAAS,MAAM;AAAA,EAC3D,0BAA0B,SAAS;AAAA,EACnC,eAAe,SAAS;AACzB,CAAC;AACM,MAAM,wBAAwB,SAAS;AAAA,EAC7C,SAAS,OAAO;AAAA,IACf,KAAK,SAAS;AAAA,IACd,UAAU,SAAS;AAAA,IACnB,cAAc,SAAS;AAAA,EAAA,CACvB;AAAA,EACD;AACD;AAEO,MAAM,oBAAoB,SAAS;AAAA,EACzC;AAAA,EACA,SAAS,OAAO;AAAA,IACf,KAAK,SAAS;AAAA,EAAA,CACd;AACF;AAIO,MAAM,mBAAmB,SAAS;AAAA,EACxC,SAAS;AAAA,IACR,SAAS,OAAO;AAAA,MACf,KAAK,SAAS;AAAA,IAAA,CACd;AAAA,IACD,SAAS,OAAO;AAAA,MACf,YAAY,SAAS,OAAO,SAAS,QAAQ,SAAS,MAAM;AAAA,IAAA,CAC5D;AAAA,EACF;AAAA,EACA,SAAS,QAAQ;AAAA,IAChB,aAAa,SAAS;AAAA,IACtB,aAAa,SAAS,QAAQ;AAAA,MAC7B,OAAO,SAAS;AAAA,MAChB,OAAO,SAAS;AAAA,IAAA,CAChB;AAAA,EAAA,CAED;AACF;AAIa,MAAA,eAAe,SAAS,aAAa,SAAS;AAAA,EAC1D,SAAS,OAAO;AAAA,IACf,aAAa,SAAS;AAAA,EAAA,CACtB;AAAA,EACD,SAAS,QAAQ;AAAA,IAChB,cAAc,SAAS;AAAA,EAAA,CACvB;AACF,CAAC;"}
1
+ {"version":3,"file":"OIDCTypes.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCTypes.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { ResponseType } from 'openid-client'\n\nexport interface OIDCSessionData {\n\tnonce: string\n\tstate: string\n}\n\nexport const OIDCConfigurationOptions = Typesafe.partial({\n\tresponseType: Typesafe.enumeration<ResponseType>('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),\n\tclaims: Typesafe.string, // deprecated, use scope instead\n\tscope: Typesafe.string,\n\tadditionalAuthorizedParties: Typesafe.array(Typesafe.string),\n\tidTokenSignedResponseAlg: Typesafe.string,\n\tfetchUserInfo: Typesafe.boolean,\n\treturnOIDCResult: Typesafe.boolean,\n})\nexport const BaseOIDCConfiguration = Typesafe.intersection(\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t\tclientId: Typesafe.string,\n\t\tclientSecret: Typesafe.string,\n\t}),\n\tOIDCConfigurationOptions,\n)\n\nexport const OIDCConfiguration = Typesafe.intersection(\n\tBaseOIDCConfiguration,\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t}),\n)\n\nexport type OIDCConfiguration = ReturnType<typeof OIDCConfiguration>\n\nexport const OIDCResponseData = Typesafe.intersection(\n\tTypesafe.union(\n\t\tTypesafe.object({\n\t\t\turl: Typesafe.string,\n\t\t}),\n\t\tTypesafe.object({\n\t\t\tparameters: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\t}),\n\t),\n\tTypesafe.partial({\n\t\tredirectUrl: Typesafe.string,\n\t\tsessionData: Typesafe.partial({\n\t\t\tnonce: Typesafe.string,\n\t\t\tstate: Typesafe.string,\n\t\t}),\n\n\t}),\n)\n\nexport type OIDCResponseData = ReturnType<typeof OIDCResponseData>\n\nexport const OIDCInitData = Typesafe.noExtraProps(Typesafe.intersection(\n\tTypesafe.object({\n\t\tredirectUrl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tresponseMode: Typesafe.string,\n\t}),\n))\n\nexport type OIDCInitData = ReturnType<typeof OIDCInitData>\n"],"names":[],"mappings":";AAQa,MAAA,2BAA2B,SAAS,QAAQ;AAAA,EACxD,cAAc,SAAS,YAA0B,QAAQ,iBAAiB,uBAAuB,cAAc,YAAY,kBAAkB,MAAM;AAAA,EACnJ,QAAQ,SAAS;AAAA;AAAA,EACjB,OAAO,SAAS;AAAA,EAChB,6BAA6B,SAAS,MAAM,SAAS,MAAM;AAAA,EAC3D,0BAA0B,SAAS;AAAA,EACnC,eAAe,SAAS;AAAA,EACxB,kBAAkB,SAAS;AAC5B,CAAC;AACM,MAAM,wBAAwB,SAAS;AAAA,EAC7C,SAAS,OAAO;AAAA,IACf,KAAK,SAAS;AAAA,IACd,UAAU,SAAS;AAAA,IACnB,cAAc,SAAS;AAAA,EAAA,CACvB;AAAA,EACD;AACD;AAEO,MAAM,oBAAoB,SAAS;AAAA,EACzC;AAAA,EACA,SAAS,OAAO;AAAA,IACf,KAAK,SAAS;AAAA,EAAA,CACd;AACF;AAIO,MAAM,mBAAmB,SAAS;AAAA,EACxC,SAAS;AAAA,IACR,SAAS,OAAO;AAAA,MACf,KAAK,SAAS;AAAA,IAAA,CACd;AAAA,IACD,SAAS,OAAO;AAAA,MACf,YAAY,SAAS,OAAO,SAAS,QAAQ,SAAS,MAAM;AAAA,IAAA,CAC5D;AAAA,EACF;AAAA,EACA,SAAS,QAAQ;AAAA,IAChB,aAAa,SAAS;AAAA,IACtB,aAAa,SAAS,QAAQ;AAAA,MAC7B,OAAO,SAAS;AAAA,MAChB,OAAO,SAAS;AAAA,IAAA,CAChB;AAAA,EAAA,CAED;AACF;AAIa,MAAA,eAAe,SAAS,aAAa,SAAS;AAAA,EAC1D,SAAS,OAAO;AAAA,IACf,aAAa,SAAS;AAAA,EAAA,CACtB;AAAA,EACD,SAAS,QAAQ;AAAA,IAChB,cAAc,SAAS;AAAA,EAAA,CACvB;AACF,CAAC;"}
@@ -21,7 +21,7 @@ const initOIDCAuth = async (client, { redirectUrl, scope, responseMode }) => {
21
21
  sessionData: { nonce, state }
22
22
  };
23
23
  };
24
- const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherData }, fetchUserInfo) => {
24
+ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherData }, fetchUserInfo, returnOIDCResult) => {
25
25
  const params = "parameters" in otherData ? otherData.parameters : client.callbackParams(otherData.url);
26
26
  if (params.state && !sessionData?.state) {
27
27
  throw new IDPValidationError.IDPValidationError(`state is present in parameters, but missing in session data`);
@@ -31,8 +31,10 @@ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherDa
31
31
  const claims = result.claims();
32
32
  const { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims;
33
33
  const userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {};
34
+ const oidcResult = returnOIDCResult ? result : {};
34
35
  return {
35
36
  externalIdentifier: claims.sub,
37
+ ...oidcResult,
36
38
  ...claimsWithoutHashes,
37
39
  ...userInfo
38
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCHelpers.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators } from 'openid-client'\nimport { OIDCResponseData } from './OIDCTypes'\nimport { IDPValidationError } from '../IDPValidationError'\nimport { IDPResponseError } from '../IDPResponseError'\nimport { IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\n\ncustom.setHttpOptionsDefaults({\n\ttimeout: 5000,\n})\n\nexport const initOIDCAuth = async (client: Client, { redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string }): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport const handleOIDCResponse = async (client: Client, { sessionData, redirectUrl, ...otherData }: OIDCResponseData, fetchUserInfo?: boolean): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\n\t\treturn {\n\t\t\texternalIdentifier: claims.sub,\n\t\t\t...claimsWithoutHashes,\n\t\t\t...userInfo,\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n"],"names":["custom","generators","IDPValidationError","errors","IDPResponseError"],"mappings":";;;;;AAMAA,aAAA,OAAO,uBAAuB;AAAA,EAC7B,SAAS;AACV,CAAC;AAEM,MAAM,eAAe,OAAO,QAAgB,EAAE,aAAa,OAAO,mBAA+G;AACjL,QAAA,QAAQC,wBAAW;AACnB,QAAA,QAAQA,wBAAW;AACnB,QAAA,MAAM,OAAO,iBAAiB;AAAA,IACnC,cAAc;AAAA,IACd,eAAe;AAAA,IACf,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AAEM,SAAA;AAAA,IACN,SAAS;AAAA,IACT,aAAa,EAAE,OAAO,MAAM;AAAA,EAAA;AAE9B;AAEa,MAAA,qBAAqB,OAAO,QAAgB,EAAE,aAAa,aAAa,GAAG,UAAU,GAAqB,kBAAkD;AAClK,QAAA,SAAS,gBAAgB,YAAY,UAAU,aAAa,OAAO,eAAe,UAAU,GAAG;AACrG,MAAI,OAAO,SAAS,CAAC,aAAa,OAAO;AAClC,UAAA,IAAIC,sCAAmB,6DAA6D;AAAA,EAC3F;AACI,MAAA;AACH,UAAM,SAAS,MAAM,OAAO,SAAS,aAAa,QAAQ,WAAW;AAC/D,UAAA,SAAS,OAAO;AACtB,UAAM,EAAE,SAAS,QAAQ,OAAO,GAAG,oBAAwB,IAAA;AACrD,UAAA,WAAW,OAAO,gBAAgB,gBAAgB,MAAM,OAAO,SAAS,MAAM,IAAI;AAEjF,WAAA;AAAA,MACN,oBAAoB,OAAO;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,WAEI,GAAQ;AACZ,QAAA,aAAaC,oBAAO,SAAS;AAC1B,YAAA,IAAID,mBAAmB,mBAAA,EAAE,OAAO;AAAA,IACvC;AACI,QAAA,aAAaC,oBAAO,SAAS;AAC1B,YAAA,OAAO,EAAE,UAAU;AACrB,UAAA,OAAO,SAAS,YAAY,OAAO,MAAM,UAAU,YAAY,OAAO,KAAK,OAAO,YAAY,UAAU;AAC3G,cAAM,IAAIC,iBAAAA,iBAAiB,KAAK,MAAM,OAAO;AAAA,MAC9C;AACM,YAAA,IAAIA,iBAAiB,iBAAA,EAAE,OAAO;AAAA,IACrC;AACM,UAAA;AAAA,EACP;AACD;;;"}
1
+ {"version":3,"file":"OIDCHelpers.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators } from 'openid-client'\nimport { OIDCResponseData } from './OIDCTypes'\nimport { IDPValidationError } from '../IDPValidationError'\nimport { IDPResponseError } from '../IDPResponseError'\nimport { IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\n\ncustom.setHttpOptionsDefaults({\n\ttimeout: 5000,\n})\n\nexport const initOIDCAuth = async (client: Client, { redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string }): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport const handleOIDCResponse = async (client: Client, { sessionData, redirectUrl, ...otherData }: OIDCResponseData, fetchUserInfo?: boolean, returnOIDCResult?: boolean): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\t\tconst oidcResult = returnOIDCResult ? result : {}\n\t\t\n\t\treturn {\n\t\t\texternalIdentifier: claims.sub,\n\t\t\t...oidcResult,\n\t\t\t...claimsWithoutHashes,\n\t\t\t...userInfo,\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n"],"names":["custom","generators","IDPValidationError","errors","IDPResponseError"],"mappings":";;;;;AAMAA,aAAA,OAAO,uBAAuB;AAAA,EAC7B,SAAS;AACV,CAAC;AAEM,MAAM,eAAe,OAAO,QAAgB,EAAE,aAAa,OAAO,mBAA+G;AACjL,QAAA,QAAQC,wBAAW;AACnB,QAAA,QAAQA,wBAAW;AACnB,QAAA,MAAM,OAAO,iBAAiB;AAAA,IACnC,cAAc;AAAA,IACd,eAAe;AAAA,IACf,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AAEM,SAAA;AAAA,IACN,SAAS;AAAA,IACT,aAAa,EAAE,OAAO,MAAM;AAAA,EAAA;AAE9B;AAEa,MAAA,qBAAqB,OAAO,QAAgB,EAAE,aAAa,aAAa,GAAG,UAAA,GAA+B,eAAyB,qBAAqD;AAC9L,QAAA,SAAS,gBAAgB,YAAY,UAAU,aAAa,OAAO,eAAe,UAAU,GAAG;AACrG,MAAI,OAAO,SAAS,CAAC,aAAa,OAAO;AAClC,UAAA,IAAIC,sCAAmB,6DAA6D;AAAA,EAC3F;AACI,MAAA;AACH,UAAM,SAAS,MAAM,OAAO,SAAS,aAAa,QAAQ,WAAW;AAC/D,UAAA,SAAS,OAAO;AACtB,UAAM,EAAE,SAAS,QAAQ,OAAO,GAAG,oBAAwB,IAAA;AACrD,UAAA,WAAW,OAAO,gBAAgB,gBAAgB,MAAM,OAAO,SAAS,MAAM,IAAI;AAClF,UAAA,aAAa,mBAAmB,SAAS;AAExC,WAAA;AAAA,MACN,oBAAoB,OAAO;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,WAEI,GAAQ;AACZ,QAAA,aAAaC,oBAAO,SAAS;AAC1B,YAAA,IAAID,mBAAmB,mBAAA,EAAE,OAAO;AAAA,IACvC;AACI,QAAA,aAAaC,oBAAO,SAAS;AAC1B,YAAA,OAAO,EAAE,UAAU;AACrB,UAAA,OAAO,SAAS,YAAY,OAAO,MAAM,UAAU,YAAY,OAAO,KAAK,OAAO,YAAY,UAAU;AAC3G,cAAM,IAAIC,iBAAAA,iBAAiB,KAAK,MAAM,OAAO;AAAA,MAC9C;AACM,YAAA,IAAIA,iBAAiB,iBAAA,EAAE,OAAO;AAAA,IACrC;AACM,UAAA;AAAA,EACP;AACD;;;"}
@@ -19,7 +19,7 @@ const initOIDCAuth = async (client, { redirectUrl, scope, responseMode }) => {
19
19
  sessionData: { nonce, state }
20
20
  };
21
21
  };
22
- const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherData }, fetchUserInfo) => {
22
+ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherData }, fetchUserInfo, returnOIDCResult) => {
23
23
  const params = "parameters" in otherData ? otherData.parameters : client.callbackParams(otherData.url);
24
24
  if (params.state && !sessionData?.state) {
25
25
  throw new IDPValidationError(`state is present in parameters, but missing in session data`);
@@ -29,8 +29,10 @@ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherDa
29
29
  const claims = result.claims();
30
30
  const { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims;
31
31
  const userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {};
32
+ const oidcResult = returnOIDCResult ? result : {};
32
33
  return {
33
34
  externalIdentifier: claims.sub,
35
+ ...oidcResult,
34
36
  ...claimsWithoutHashes,
35
37
  ...userInfo
36
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCHelpers.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators } from 'openid-client'\nimport { OIDCResponseData } from './OIDCTypes'\nimport { IDPValidationError } from '../IDPValidationError'\nimport { IDPResponseError } from '../IDPResponseError'\nimport { IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\n\ncustom.setHttpOptionsDefaults({\n\ttimeout: 5000,\n})\n\nexport const initOIDCAuth = async (client: Client, { redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string }): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport const handleOIDCResponse = async (client: Client, { sessionData, redirectUrl, ...otherData }: OIDCResponseData, fetchUserInfo?: boolean): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\n\t\treturn {\n\t\t\texternalIdentifier: claims.sub,\n\t\t\t...claimsWithoutHashes,\n\t\t\t...userInfo,\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n"],"names":[],"mappings":";;;AAMA,OAAO,uBAAuB;AAAA,EAC7B,SAAS;AACV,CAAC;AAEM,MAAM,eAAe,OAAO,QAAgB,EAAE,aAAa,OAAO,mBAA+G;AACjL,QAAA,QAAQ,WAAW;AACnB,QAAA,QAAQ,WAAW;AACnB,QAAA,MAAM,OAAO,iBAAiB;AAAA,IACnC,cAAc;AAAA,IACd,eAAe;AAAA,IACf,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AAEM,SAAA;AAAA,IACN,SAAS;AAAA,IACT,aAAa,EAAE,OAAO,MAAM;AAAA,EAAA;AAE9B;AAEa,MAAA,qBAAqB,OAAO,QAAgB,EAAE,aAAa,aAAa,GAAG,UAAU,GAAqB,kBAAkD;AAClK,QAAA,SAAS,gBAAgB,YAAY,UAAU,aAAa,OAAO,eAAe,UAAU,GAAG;AACrG,MAAI,OAAO,SAAS,CAAC,aAAa,OAAO;AAClC,UAAA,IAAI,mBAAmB,6DAA6D;AAAA,EAC3F;AACI,MAAA;AACH,UAAM,SAAS,MAAM,OAAO,SAAS,aAAa,QAAQ,WAAW;AAC/D,UAAA,SAAS,OAAO;AACtB,UAAM,EAAE,SAAS,QAAQ,OAAO,GAAG,oBAAwB,IAAA;AACrD,UAAA,WAAW,OAAO,gBAAgB,gBAAgB,MAAM,OAAO,SAAS,MAAM,IAAI;AAEjF,WAAA;AAAA,MACN,oBAAoB,OAAO;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,WAEI,GAAQ;AACZ,QAAA,aAAa,OAAO,SAAS;AAC1B,YAAA,IAAI,mBAAmB,EAAE,OAAO;AAAA,IACvC;AACI,QAAA,aAAa,OAAO,SAAS;AAC1B,YAAA,OAAO,EAAE,UAAU;AACrB,UAAA,OAAO,SAAS,YAAY,OAAO,MAAM,UAAU,YAAY,OAAO,KAAK,OAAO,YAAY,UAAU;AAC3G,cAAM,IAAI,iBAAiB,KAAK,MAAM,OAAO;AAAA,MAC9C;AACM,YAAA,IAAI,iBAAiB,EAAE,OAAO;AAAA,IACrC;AACM,UAAA;AAAA,EACP;AACD;"}
1
+ {"version":3,"file":"OIDCHelpers.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators } from 'openid-client'\nimport { OIDCResponseData } from './OIDCTypes'\nimport { IDPValidationError } from '../IDPValidationError'\nimport { IDPResponseError } from '../IDPResponseError'\nimport { IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\n\ncustom.setHttpOptionsDefaults({\n\ttimeout: 5000,\n})\n\nexport const initOIDCAuth = async (client: Client, { redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string }): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport const handleOIDCResponse = async (client: Client, { sessionData, redirectUrl, ...otherData }: OIDCResponseData, fetchUserInfo?: boolean, returnOIDCResult?: boolean): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\t\tconst oidcResult = returnOIDCResult ? result : {}\n\t\t\n\t\treturn {\n\t\t\texternalIdentifier: claims.sub,\n\t\t\t...oidcResult,\n\t\t\t...claimsWithoutHashes,\n\t\t\t...userInfo,\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n"],"names":[],"mappings":";;;AAMA,OAAO,uBAAuB;AAAA,EAC7B,SAAS;AACV,CAAC;AAEM,MAAM,eAAe,OAAO,QAAgB,EAAE,aAAa,OAAO,mBAA+G;AACjL,QAAA,QAAQ,WAAW;AACnB,QAAA,QAAQ,WAAW;AACnB,QAAA,MAAM,OAAO,iBAAiB;AAAA,IACnC,cAAc;AAAA,IACd,eAAe;AAAA,IACf,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AAEM,SAAA;AAAA,IACN,SAAS;AAAA,IACT,aAAa,EAAE,OAAO,MAAM;AAAA,EAAA;AAE9B;AAEa,MAAA,qBAAqB,OAAO,QAAgB,EAAE,aAAa,aAAa,GAAG,UAAA,GAA+B,eAAyB,qBAAqD;AAC9L,QAAA,SAAS,gBAAgB,YAAY,UAAU,aAAa,OAAO,eAAe,UAAU,GAAG;AACrG,MAAI,OAAO,SAAS,CAAC,aAAa,OAAO;AAClC,UAAA,IAAI,mBAAmB,6DAA6D;AAAA,EAC3F;AACI,MAAA;AACH,UAAM,SAAS,MAAM,OAAO,SAAS,aAAa,QAAQ,WAAW;AAC/D,UAAA,SAAS,OAAO;AACtB,UAAM,EAAE,SAAS,QAAQ,OAAO,GAAG,oBAAwB,IAAA;AACrD,UAAA,WAAW,OAAO,gBAAgB,gBAAgB,MAAM,OAAO,SAAS,MAAM,IAAI;AAClF,UAAA,aAAa,mBAAmB,SAAS;AAExC,WAAA;AAAA,MACN,oBAAoB,OAAO;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,WAEI,GAAQ;AACZ,QAAA,aAAa,OAAO,SAAS;AAC1B,YAAA,IAAI,mBAAmB,EAAE,OAAO;AAAA,IACvC;AACI,QAAA,aAAa,OAAO,SAAS;AAC1B,YAAA,OAAO,EAAE,UAAU;AACrB,UAAA,OAAO,SAAS,YAAY,OAAO,MAAM,UAAU,YAAY,OAAO,KAAK,OAAO,YAAY,UAAU;AAC3G,cAAM,IAAI,iBAAiB,KAAK,MAAM,OAAO;AAAA,MAC9C;AACM,YAAA,IAAI,iBAAiB,EAAE,OAAO;AAAA,IACrC;AACM,UAAA;AAAA,EACP;AACD;"}
@@ -25,7 +25,12 @@ class OIDCProvider {
25
25
  async processResponse(configuration, data) {
26
26
  const responseData = helpers.catchTypesafe(OIDCTypes.OIDCResponseData, IDPValidationError.IDPValidationError)(data);
27
27
  const client = await this.createOIDCClient(configuration);
28
- return await OIDCHelpers.handleOIDCResponse(client, responseData, configuration.fetchUserInfo);
28
+ return await OIDCHelpers.handleOIDCResponse(
29
+ client,
30
+ responseData,
31
+ configuration.fetchUserInfo,
32
+ configuration.returnOIDCResult
33
+ );
29
34
  }
30
35
  getPublicConfiguration({ clientSecret, ...config }) {
31
36
  return config;
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCProvider.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, Issuer } from 'openid-client'\nimport { IdentityProviderHandler, IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError'\nimport { catchTypesafe } from './helpers'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes'\nimport { handleOIDCResponse, initOIDCAuth } from './OIDCHelpers'\nimport { IDPValidationError } from '../IDPValidationError'\n\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: configuration.scope ?? configuration.claims,\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(client, responseData, configuration.fetchUserInfo)\n\t}\n\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\treturn new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\t}\n}\n"],"names":["catchTypesafe","OIDCConfiguration","InvalidIDPConfigurationError","OIDCInitData","IDPValidationError","initOIDCAuth","OIDCResponseData","handleOIDCResponse","Issuer"],"mappings":";;;;;;;;;;;AASO,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,CAAA,CAAC;AAE/B,kBAAA,MAAA,yBAAAA,QAAA,cAAcC,6BAAmBC,6BAA4B,4BAAA,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAWF,QAAAA,cAAcG,UAAAA,cAAcC,mBAAAA,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACjD,WAAA,MAAMC,yBAAa,QAAQ;AAAA,MACjC,OAAO,cAAc,SAAS,cAAc;AAAA,MAC5C,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAeL,QAAAA,cAAcM,UAAAA,kBAAkBF,mBAAAA,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAMG,YAAA,mBAAmB,QAAQ,cAAc,cAAc,aAAa;AAAA,EAClF;AAAA,EAGA,uBAAuB,EAAE,cAAc,GAAG,UAAyD;AAC3F,WAAA;AAAA,EACR;AAAA,EAEA,MAAc,iBAAiB,eAAmD;AAlCnF,QAAA,IAAA;AAmCO,KAAA,KAAA,KAAA,aAAL,KAAiB,cAAc,GAAA,MAA/B,SAAwC,MAAMC,aAAA,OAAO,SAAS,cAAc,GAAG;AAE/E,WAAO,IAAI,KAAK,YAAY,cAAc,GAAG,EAAE;AAAA,MAC9C;AAAA,QACC,WAAW,cAAc;AAAA,QACzB,eAAe,cAAc;AAAA,QAC7B,gBAAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,MACzE;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MACnF;AAAA,IAAA;AAAA,EAEF;AACD;;"}
1
+ {"version":3,"file":"OIDCProvider.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, Issuer } from 'openid-client'\nimport { IdentityProviderHandler, IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError'\nimport { catchTypesafe } from './helpers'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes'\nimport { handleOIDCResponse, initOIDCAuth } from './OIDCHelpers'\nimport { IDPValidationError } from '../IDPValidationError'\n\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: configuration.scope ?? configuration.claims,\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(\n\t\t\tclient,\n\t\t\tresponseData,\n\t\t\tconfiguration.fetchUserInfo,\n\t\t\tconfiguration.returnOIDCResult,\n\t\t)\n\t}\n\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\treturn new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\t}\n}\n"],"names":["catchTypesafe","OIDCConfiguration","InvalidIDPConfigurationError","OIDCInitData","IDPValidationError","initOIDCAuth","OIDCResponseData","handleOIDCResponse","Issuer"],"mappings":";;;;;;;;;;;AASO,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,CAAA,CAAC;AAE/B,kBAAA,MAAA,yBAAAA,QAAA,cAAcC,6BAAmBC,6BAA4B,4BAAA,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAWF,QAAAA,cAAcG,UAAAA,cAAcC,mBAAAA,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACjD,WAAA,MAAMC,yBAAa,QAAQ;AAAA,MACjC,OAAO,cAAc,SAAS,cAAc;AAAA,MAC5C,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAeL,QAAAA,cAAcM,UAAAA,kBAAkBF,mBAAAA,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAMG,YAAA;AAAA,MACZ;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,cAAc;AAAA,IAAA;AAAA,EAEhB;AAAA,EAGA,uBAAuB,EAAE,cAAc,GAAG,UAAyD;AAC3F,WAAA;AAAA,EACR;AAAA,EAEA,MAAc,iBAAiB,eAAmD;AAvCnF,QAAA,IAAA;AAwCO,KAAA,KAAA,KAAA,aAAL,KAAiB,cAAc,GAAA,MAA/B,SAAwC,MAAMC,aAAA,OAAO,SAAS,cAAc,GAAG;AAE/E,WAAO,IAAI,KAAK,YAAY,cAAc,GAAG,EAAE;AAAA,MAC9C;AAAA,QACC,WAAW,cAAc;AAAA,QACzB,eAAe,cAAc;AAAA,QAC7B,gBAAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,MACzE;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MACnF;AAAA,IAAA;AAAA,EAEF;AACD;;"}
@@ -23,7 +23,12 @@ class OIDCProvider {
23
23
  async processResponse(configuration, data) {
24
24
  const responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data);
25
25
  const client = await this.createOIDCClient(configuration);
26
- return await handleOIDCResponse(client, responseData, configuration.fetchUserInfo);
26
+ return await handleOIDCResponse(
27
+ client,
28
+ responseData,
29
+ configuration.fetchUserInfo,
30
+ configuration.returnOIDCResult
31
+ );
27
32
  }
28
33
  getPublicConfiguration({ clientSecret, ...config }) {
29
34
  return config;
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCProvider.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, Issuer } from 'openid-client'\nimport { IdentityProviderHandler, IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError'\nimport { catchTypesafe } from './helpers'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes'\nimport { handleOIDCResponse, initOIDCAuth } from './OIDCHelpers'\nimport { IDPValidationError } from '../IDPValidationError'\n\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: configuration.scope ?? configuration.claims,\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(client, responseData, configuration.fetchUserInfo)\n\t}\n\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\treturn new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;AASO,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,CAAA,CAAC;AAE/B,kBAAA,MAAA,yBAAA,cAAc,mBAAmB,4BAA4B,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAW,cAAc,cAAc,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACjD,WAAA,MAAM,aAAa,QAAQ;AAAA,MACjC,OAAO,cAAc,SAAS,cAAc;AAAA,MAC5C,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAe,cAAc,kBAAkB,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAM,mBAAmB,QAAQ,cAAc,cAAc,aAAa;AAAA,EAClF;AAAA,EAGA,uBAAuB,EAAE,cAAc,GAAG,UAAyD;AAC3F,WAAA;AAAA,EACR;AAAA,EAEA,MAAc,iBAAiB,eAAmD;AAlCnF,QAAA,IAAA;AAmCO,KAAA,KAAA,KAAA,aAAL,KAAiB,cAAc,GAAA,MAA/B,SAAwC,MAAM,OAAO,SAAS,cAAc,GAAG;AAE/E,WAAO,IAAI,KAAK,YAAY,cAAc,GAAG,EAAE;AAAA,MAC9C;AAAA,QACC,WAAW,cAAc;AAAA,QACzB,eAAe,cAAc;AAAA,QAC7B,gBAAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,MACzE;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MACnF;AAAA,IAAA;AAAA,EAEF;AACD;"}
1
+ {"version":3,"file":"OIDCProvider.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, Issuer } from 'openid-client'\nimport { IdentityProviderHandler, IDPResponse, InitIDPAuthResult } from '../IdentityProviderHandler'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError'\nimport { catchTypesafe } from './helpers'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes'\nimport { handleOIDCResponse, initOIDCAuth } from './OIDCHelpers'\nimport { IDPValidationError } from '../IDPValidationError'\n\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: configuration.scope ?? configuration.claims,\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(\n\t\t\tclient,\n\t\t\tresponseData,\n\t\t\tconfiguration.fetchUserInfo,\n\t\t\tconfiguration.returnOIDCResult,\n\t\t)\n\t}\n\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\treturn new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;AASO,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,CAAA,CAAC;AAE/B,kBAAA,MAAA,yBAAA,cAAc,mBAAmB,4BAA4B,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAW,cAAc,cAAc,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACjD,WAAA,MAAM,aAAa,QAAQ;AAAA,MACjC,OAAO,cAAc,SAAS,cAAc;AAAA,MAC5C,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAe,cAAc,kBAAkB,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAM;AAAA,MACZ;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,cAAc;AAAA,IAAA;AAAA,EAEhB;AAAA,EAGA,uBAAuB,EAAE,cAAc,GAAG,UAAyD;AAC3F,WAAA;AAAA,EACR;AAAA,EAEA,MAAc,iBAAiB,eAAmD;AAvCnF,QAAA,IAAA;AAwCO,KAAA,KAAA,KAAA,aAAL,KAAiB,cAAc,GAAA,MAA/B,SAAwC,MAAM,OAAO,SAAS,cAAc,GAAG;AAE/E,WAAO,IAAI,KAAK,YAAY,cAAc,GAAG,EAAE;AAAA,MAC9C;AAAA,QACC,WAAW,cAAc;AAAA,QACzB,eAAe,cAAc;AAAA,QAC7B,gBAAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,MACzE;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MACnF;AAAA,IAAA;AAAA,EAEF;AACD;"}
@@ -25,7 +25,8 @@ const OIDCConfigurationOptions = Typesafe__namespace.partial({
25
25
  scope: Typesafe__namespace.string,
26
26
  additionalAuthorizedParties: Typesafe__namespace.array(Typesafe__namespace.string),
27
27
  idTokenSignedResponseAlg: Typesafe__namespace.string,
28
- fetchUserInfo: Typesafe__namespace.boolean
28
+ fetchUserInfo: Typesafe__namespace.boolean,
29
+ returnOIDCResult: Typesafe__namespace.boolean
29
30
  });
30
31
  const BaseOIDCConfiguration = Typesafe__namespace.intersection(
31
32
  Typesafe__namespace.object({
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCTypes.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCTypes.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { ResponseType } from 'openid-client'\n\nexport interface OIDCSessionData {\n\tnonce: string\n\tstate: string\n}\n\nexport const OIDCConfigurationOptions = Typesafe.partial({\n\tresponseType: Typesafe.enumeration<ResponseType>('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),\n\tclaims: Typesafe.string, // deprecated, use scope instead\n\tscope: Typesafe.string,\n\tadditionalAuthorizedParties: Typesafe.array(Typesafe.string),\n\tidTokenSignedResponseAlg: Typesafe.string,\n\tfetchUserInfo: Typesafe.boolean,\n})\nexport const BaseOIDCConfiguration = Typesafe.intersection(\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t\tclientId: Typesafe.string,\n\t\tclientSecret: Typesafe.string,\n\t}),\n\tOIDCConfigurationOptions,\n)\n\nexport const OIDCConfiguration = Typesafe.intersection(\n\tBaseOIDCConfiguration,\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t}),\n)\n\nexport type OIDCConfiguration = ReturnType<typeof OIDCConfiguration>\n\nexport const OIDCResponseData = Typesafe.intersection(\n\tTypesafe.union(\n\t\tTypesafe.object({\n\t\t\turl: Typesafe.string,\n\t\t}),\n\t\tTypesafe.object({\n\t\t\tparameters: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\t}),\n\t),\n\tTypesafe.partial({\n\t\tredirectUrl: Typesafe.string,\n\t\tsessionData: Typesafe.partial({\n\t\t\tnonce: Typesafe.string,\n\t\t\tstate: Typesafe.string,\n\t\t}),\n\n\t}),\n)\n\nexport type OIDCResponseData = ReturnType<typeof OIDCResponseData>\n\nexport const OIDCInitData = Typesafe.noExtraProps(Typesafe.intersection(\n\tTypesafe.object({\n\t\tredirectUrl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tresponseMode: Typesafe.string,\n\t}),\n))\n\nexport type OIDCInitData = ReturnType<typeof OIDCInitData>\n"],"names":["Typesafe"],"mappings":";;;;;;;;;;;;;;;;;;;;AAQa,MAAA,2BAA2BA,oBAAS,QAAQ;AAAA,EACxD,cAAcA,oBAAS,YAA0B,QAAQ,iBAAiB,uBAAuB,cAAc,YAAY,kBAAkB,MAAM;AAAA,EACnJ,QAAQA,oBAAS;AAAA;AAAA,EACjB,OAAOA,oBAAS;AAAA,EAChB,6BAA6BA,oBAAS,MAAMA,oBAAS,MAAM;AAAA,EAC3D,0BAA0BA,oBAAS;AAAA,EACnC,eAAeA,oBAAS;AACzB,CAAC;AACM,MAAM,wBAAwBA,oBAAS;AAAA,EAC7CA,oBAAS,OAAO;AAAA,IACf,KAAKA,oBAAS;AAAA,IACd,UAAUA,oBAAS;AAAA,IACnB,cAAcA,oBAAS;AAAA,EAAA,CACvB;AAAA,EACD;AACD;AAEO,MAAM,oBAAoBA,oBAAS;AAAA,EACzC;AAAA,EACAA,oBAAS,OAAO;AAAA,IACf,KAAKA,oBAAS;AAAA,EAAA,CACd;AACF;AAIO,MAAM,mBAAmBA,oBAAS;AAAA,EACxCA,oBAAS;AAAA,IACRA,oBAAS,OAAO;AAAA,MACf,KAAKA,oBAAS;AAAA,IAAA,CACd;AAAA,IACDA,oBAAS,OAAO;AAAA,MACf,YAAYA,oBAAS,OAAOA,oBAAS,QAAQA,oBAAS,MAAM;AAAA,IAAA,CAC5D;AAAA,EACF;AAAA,EACAA,oBAAS,QAAQ;AAAA,IAChB,aAAaA,oBAAS;AAAA,IACtB,aAAaA,oBAAS,QAAQ;AAAA,MAC7B,OAAOA,oBAAS;AAAA,MAChB,OAAOA,oBAAS;AAAA,IAAA,CAChB;AAAA,EAAA,CAED;AACF;AAIa,MAAA,eAAeA,oBAAS,aAAaA,oBAAS;AAAA,EAC1DA,oBAAS,OAAO;AAAA,IACf,aAAaA,oBAAS;AAAA,EAAA,CACtB;AAAA,EACDA,oBAAS,QAAQ;AAAA,IAChB,cAAcA,oBAAS;AAAA,EAAA,CACvB;AACF,CAAC;;;;;;"}
1
+ {"version":3,"file":"OIDCTypes.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCTypes.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { ResponseType } from 'openid-client'\n\nexport interface OIDCSessionData {\n\tnonce: string\n\tstate: string\n}\n\nexport const OIDCConfigurationOptions = Typesafe.partial({\n\tresponseType: Typesafe.enumeration<ResponseType>('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),\n\tclaims: Typesafe.string, // deprecated, use scope instead\n\tscope: Typesafe.string,\n\tadditionalAuthorizedParties: Typesafe.array(Typesafe.string),\n\tidTokenSignedResponseAlg: Typesafe.string,\n\tfetchUserInfo: Typesafe.boolean,\n\treturnOIDCResult: Typesafe.boolean,\n})\nexport const BaseOIDCConfiguration = Typesafe.intersection(\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t\tclientId: Typesafe.string,\n\t\tclientSecret: Typesafe.string,\n\t}),\n\tOIDCConfigurationOptions,\n)\n\nexport const OIDCConfiguration = Typesafe.intersection(\n\tBaseOIDCConfiguration,\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t}),\n)\n\nexport type OIDCConfiguration = ReturnType<typeof OIDCConfiguration>\n\nexport const OIDCResponseData = Typesafe.intersection(\n\tTypesafe.union(\n\t\tTypesafe.object({\n\t\t\turl: Typesafe.string,\n\t\t}),\n\t\tTypesafe.object({\n\t\t\tparameters: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\t}),\n\t),\n\tTypesafe.partial({\n\t\tredirectUrl: Typesafe.string,\n\t\tsessionData: Typesafe.partial({\n\t\t\tnonce: Typesafe.string,\n\t\t\tstate: Typesafe.string,\n\t\t}),\n\n\t}),\n)\n\nexport type OIDCResponseData = ReturnType<typeof OIDCResponseData>\n\nexport const OIDCInitData = Typesafe.noExtraProps(Typesafe.intersection(\n\tTypesafe.object({\n\t\tredirectUrl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tresponseMode: Typesafe.string,\n\t}),\n))\n\nexport type OIDCInitData = ReturnType<typeof OIDCInitData>\n"],"names":["Typesafe"],"mappings":";;;;;;;;;;;;;;;;;;;;AAQa,MAAA,2BAA2BA,oBAAS,QAAQ;AAAA,EACxD,cAAcA,oBAAS,YAA0B,QAAQ,iBAAiB,uBAAuB,cAAc,YAAY,kBAAkB,MAAM;AAAA,EACnJ,QAAQA,oBAAS;AAAA;AAAA,EACjB,OAAOA,oBAAS;AAAA,EAChB,6BAA6BA,oBAAS,MAAMA,oBAAS,MAAM;AAAA,EAC3D,0BAA0BA,oBAAS;AAAA,EACnC,eAAeA,oBAAS;AAAA,EACxB,kBAAkBA,oBAAS;AAC5B,CAAC;AACM,MAAM,wBAAwBA,oBAAS;AAAA,EAC7CA,oBAAS,OAAO;AAAA,IACf,KAAKA,oBAAS;AAAA,IACd,UAAUA,oBAAS;AAAA,IACnB,cAAcA,oBAAS;AAAA,EAAA,CACvB;AAAA,EACD;AACD;AAEO,MAAM,oBAAoBA,oBAAS;AAAA,EACzC;AAAA,EACAA,oBAAS,OAAO;AAAA,IACf,KAAKA,oBAAS;AAAA,EAAA,CACd;AACF;AAIO,MAAM,mBAAmBA,oBAAS;AAAA,EACxCA,oBAAS;AAAA,IACRA,oBAAS,OAAO;AAAA,MACf,KAAKA,oBAAS;AAAA,IAAA,CACd;AAAA,IACDA,oBAAS,OAAO;AAAA,MACf,YAAYA,oBAAS,OAAOA,oBAAS,QAAQA,oBAAS,MAAM;AAAA,IAAA,CAC5D;AAAA,EACF;AAAA,EACAA,oBAAS,QAAQ;AAAA,IAChB,aAAaA,oBAAS;AAAA,IACtB,aAAaA,oBAAS,QAAQ;AAAA,MAC7B,OAAOA,oBAAS;AAAA,MAChB,OAAOA,oBAAS;AAAA,IAAA,CAChB;AAAA,EAAA,CAED;AACF;AAIa,MAAA,eAAeA,oBAAS,aAAaA,oBAAS;AAAA,EAC1DA,oBAAS,OAAO;AAAA,IACf,aAAaA,oBAAS;AAAA,EAAA,CACtB;AAAA,EACDA,oBAAS,QAAQ;AAAA,IAChB,cAAcA,oBAAS;AAAA,EAAA,CACvB;AACF,CAAC;;;;;;"}
@@ -6,7 +6,8 @@ const OIDCConfigurationOptions = Typesafe.partial({
6
6
  scope: Typesafe.string,
7
7
  additionalAuthorizedParties: Typesafe.array(Typesafe.string),
8
8
  idTokenSignedResponseAlg: Typesafe.string,
9
- fetchUserInfo: Typesafe.boolean
9
+ fetchUserInfo: Typesafe.boolean,
10
+ returnOIDCResult: Typesafe.boolean
10
11
  });
11
12
  const BaseOIDCConfiguration = Typesafe.intersection(
12
13
  Typesafe.object({
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCTypes.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCTypes.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { ResponseType } from 'openid-client'\n\nexport interface OIDCSessionData {\n\tnonce: string\n\tstate: string\n}\n\nexport const OIDCConfigurationOptions = Typesafe.partial({\n\tresponseType: Typesafe.enumeration<ResponseType>('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),\n\tclaims: Typesafe.string, // deprecated, use scope instead\n\tscope: Typesafe.string,\n\tadditionalAuthorizedParties: Typesafe.array(Typesafe.string),\n\tidTokenSignedResponseAlg: Typesafe.string,\n\tfetchUserInfo: Typesafe.boolean,\n})\nexport const BaseOIDCConfiguration = Typesafe.intersection(\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t\tclientId: Typesafe.string,\n\t\tclientSecret: Typesafe.string,\n\t}),\n\tOIDCConfigurationOptions,\n)\n\nexport const OIDCConfiguration = Typesafe.intersection(\n\tBaseOIDCConfiguration,\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t}),\n)\n\nexport type OIDCConfiguration = ReturnType<typeof OIDCConfiguration>\n\nexport const OIDCResponseData = Typesafe.intersection(\n\tTypesafe.union(\n\t\tTypesafe.object({\n\t\t\turl: Typesafe.string,\n\t\t}),\n\t\tTypesafe.object({\n\t\t\tparameters: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\t}),\n\t),\n\tTypesafe.partial({\n\t\tredirectUrl: Typesafe.string,\n\t\tsessionData: Typesafe.partial({\n\t\t\tnonce: Typesafe.string,\n\t\t\tstate: Typesafe.string,\n\t\t}),\n\n\t}),\n)\n\nexport type OIDCResponseData = ReturnType<typeof OIDCResponseData>\n\nexport const OIDCInitData = Typesafe.noExtraProps(Typesafe.intersection(\n\tTypesafe.object({\n\t\tredirectUrl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tresponseMode: Typesafe.string,\n\t}),\n))\n\nexport type OIDCInitData = ReturnType<typeof OIDCInitData>\n"],"names":[],"mappings":";AAQa,MAAA,2BAA2B,SAAS,QAAQ;AAAA,EACxD,cAAc,SAAS,YAA0B,QAAQ,iBAAiB,uBAAuB,cAAc,YAAY,kBAAkB,MAAM;AAAA,EACnJ,QAAQ,SAAS;AAAA;AAAA,EACjB,OAAO,SAAS;AAAA,EAChB,6BAA6B,SAAS,MAAM,SAAS,MAAM;AAAA,EAC3D,0BAA0B,SAAS;AAAA,EACnC,eAAe,SAAS;AACzB,CAAC;AACM,MAAM,wBAAwB,SAAS;AAAA,EAC7C,SAAS,OAAO;AAAA,IACf,KAAK,SAAS;AAAA,IACd,UAAU,SAAS;AAAA,IACnB,cAAc,SAAS;AAAA,EAAA,CACvB;AAAA,EACD;AACD;AAEO,MAAM,oBAAoB,SAAS;AAAA,EACzC;AAAA,EACA,SAAS,OAAO;AAAA,IACf,KAAK,SAAS;AAAA,EAAA,CACd;AACF;AAIO,MAAM,mBAAmB,SAAS;AAAA,EACxC,SAAS;AAAA,IACR,SAAS,OAAO;AAAA,MACf,KAAK,SAAS;AAAA,IAAA,CACd;AAAA,IACD,SAAS,OAAO;AAAA,MACf,YAAY,SAAS,OAAO,SAAS,QAAQ,SAAS,MAAM;AAAA,IAAA,CAC5D;AAAA,EACF;AAAA,EACA,SAAS,QAAQ;AAAA,IAChB,aAAa,SAAS;AAAA,IACtB,aAAa,SAAS,QAAQ;AAAA,MAC7B,OAAO,SAAS;AAAA,MAChB,OAAO,SAAS;AAAA,IAAA,CAChB;AAAA,EAAA,CAED;AACF;AAIa,MAAA,eAAe,SAAS,aAAa,SAAS;AAAA,EAC1D,SAAS,OAAO;AAAA,IACf,aAAa,SAAS;AAAA,EAAA,CACtB;AAAA,EACD,SAAS,QAAQ;AAAA,IAChB,cAAc,SAAS;AAAA,EAAA,CACvB;AACF,CAAC;"}
1
+ {"version":3,"file":"OIDCTypes.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCTypes.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\nimport { ResponseType } from 'openid-client'\n\nexport interface OIDCSessionData {\n\tnonce: string\n\tstate: string\n}\n\nexport const OIDCConfigurationOptions = Typesafe.partial({\n\tresponseType: Typesafe.enumeration<ResponseType>('code', 'code id_token', 'code id_token token', 'code token', 'id_token', 'id_token token', 'none'),\n\tclaims: Typesafe.string, // deprecated, use scope instead\n\tscope: Typesafe.string,\n\tadditionalAuthorizedParties: Typesafe.array(Typesafe.string),\n\tidTokenSignedResponseAlg: Typesafe.string,\n\tfetchUserInfo: Typesafe.boolean,\n\treturnOIDCResult: Typesafe.boolean,\n})\nexport const BaseOIDCConfiguration = Typesafe.intersection(\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t\tclientId: Typesafe.string,\n\t\tclientSecret: Typesafe.string,\n\t}),\n\tOIDCConfigurationOptions,\n)\n\nexport const OIDCConfiguration = Typesafe.intersection(\n\tBaseOIDCConfiguration,\n\tTypesafe.object({\n\t\turl: Typesafe.string,\n\t}),\n)\n\nexport type OIDCConfiguration = ReturnType<typeof OIDCConfiguration>\n\nexport const OIDCResponseData = Typesafe.intersection(\n\tTypesafe.union(\n\t\tTypesafe.object({\n\t\t\turl: Typesafe.string,\n\t\t}),\n\t\tTypesafe.object({\n\t\t\tparameters: Typesafe.record(Typesafe.string, Typesafe.string),\n\t\t}),\n\t),\n\tTypesafe.partial({\n\t\tredirectUrl: Typesafe.string,\n\t\tsessionData: Typesafe.partial({\n\t\t\tnonce: Typesafe.string,\n\t\t\tstate: Typesafe.string,\n\t\t}),\n\n\t}),\n)\n\nexport type OIDCResponseData = ReturnType<typeof OIDCResponseData>\n\nexport const OIDCInitData = Typesafe.noExtraProps(Typesafe.intersection(\n\tTypesafe.object({\n\t\tredirectUrl: Typesafe.string,\n\t}),\n\tTypesafe.partial({\n\t\tresponseMode: Typesafe.string,\n\t}),\n))\n\nexport type OIDCInitData = ReturnType<typeof OIDCInitData>\n"],"names":[],"mappings":";AAQa,MAAA,2BAA2B,SAAS,QAAQ;AAAA,EACxD,cAAc,SAAS,YAA0B,QAAQ,iBAAiB,uBAAuB,cAAc,YAAY,kBAAkB,MAAM;AAAA,EACnJ,QAAQ,SAAS;AAAA;AAAA,EACjB,OAAO,SAAS;AAAA,EAChB,6BAA6B,SAAS,MAAM,SAAS,MAAM;AAAA,EAC3D,0BAA0B,SAAS;AAAA,EACnC,eAAe,SAAS;AAAA,EACxB,kBAAkB,SAAS;AAC5B,CAAC;AACM,MAAM,wBAAwB,SAAS;AAAA,EAC7C,SAAS,OAAO;AAAA,IACf,KAAK,SAAS;AAAA,IACd,UAAU,SAAS;AAAA,IACnB,cAAc,SAAS;AAAA,EAAA,CACvB;AAAA,EACD;AACD;AAEO,MAAM,oBAAoB,SAAS;AAAA,EACzC;AAAA,EACA,SAAS,OAAO;AAAA,IACf,KAAK,SAAS;AAAA,EAAA,CACd;AACF;AAIO,MAAM,mBAAmB,SAAS;AAAA,EACxC,SAAS;AAAA,IACR,SAAS,OAAO;AAAA,MACf,KAAK,SAAS;AAAA,IAAA,CACd;AAAA,IACD,SAAS,OAAO;AAAA,MACf,YAAY,SAAS,OAAO,SAAS,QAAQ,SAAS,MAAM;AAAA,IAAA,CAC5D;AAAA,EACF;AAAA,EACA,SAAS,QAAQ;AAAA,IAChB,aAAa,SAAS;AAAA,IACtB,aAAa,SAAS,QAAQ;AAAA,MAC7B,OAAO,SAAS;AAAA,MAChB,OAAO,SAAS;AAAA,IAAA,CAChB;AAAA,EAAA,CAED;AACF;AAIa,MAAA,eAAe,SAAS,aAAa,SAAS;AAAA,EAC1D,SAAS,OAAO;AAAA,IACf,aAAa,SAAS;AAAA,EAAA,CACtB;AAAA,EACD,SAAS,QAAQ;AAAA,IAChB,cAAc,SAAS;AAAA,EAAA,CACvB;AACF,CAAC;"}