@odx/auth 16.0.0 → 16.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @odx/auth
2
2
 
3
+ ## 16.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - b203a38: Add `additionalClaims` option to ServiceConnectPluginFactory, which can be used to parse additional claims from the service connect plugin http response
8
+
3
9
  ## 16.0.0
4
10
 
5
11
  ### Major Changes
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXNlcnZpY2UtY29ubmVjdC11c2VyLXJlc3BvbnNlLmR0by5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYXV0aC9wbHVnaW5zL3NlcnZpY2UtY29ubmVjdC9zcmMvbGliL2R0b3MvZ2V0LXNlcnZpY2UtY29ubmVjdC11c2VyLXJlc3BvbnNlLmR0by50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBHZXRTZXJ2aWNlQ29ubmVjdFVzZXJSZXNwb25zZUR0byB7XG4gIHVzZXJfaWQ6IHN0cmluZztcbiAgZmlyc3RfbmFtZTogc3RyaW5nO1xuICBsYXN0X25hbWU6IHN0cmluZztcbiAgbGFuZ3VhZ2VfY29kZTogc3RyaW5nO1xuICBwcmVmZXJyZWRfbGFuZ3VhZ2U6IHN0cmluZztcbiAgY291bnRyeTogc3RyaW5nO1xuICBpbnN0aXR1dGlvbl9pZDogbnVtYmVyO1xuICBpbnN0aXR1dGlvbl9uYW1lOiBzdHJpbmc7XG4gIGluc3RpdHV0aW9uX3Nob3J0bmFtZTogc3RyaW5nO1xufVxuIl19
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXNlcnZpY2UtY29ubmVjdC11c2VyLXJlc3BvbnNlLmR0by5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYXV0aC9wbHVnaW5zL3NlcnZpY2UtY29ubmVjdC9zcmMvbGliL2R0b3MvZ2V0LXNlcnZpY2UtY29ubmVjdC11c2VyLXJlc3BvbnNlLmR0by50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBHZXRTZXJ2aWNlQ29ubmVjdFVzZXJSZXNwb25zZUR0byB7XG4gIHVzZXJfaWQ6IHN0cmluZztcbiAgZmlyc3RfbmFtZTogc3RyaW5nO1xuICBsYXN0X25hbWU6IHN0cmluZztcbiAgbGFuZ3VhZ2VfY29kZTogc3RyaW5nO1xuICBwcmVmZXJyZWRfbGFuZ3VhZ2U6IHN0cmluZztcbiAgY291bnRyeTogc3RyaW5nO1xuICBpbnN0aXR1dGlvbl9pZDogbnVtYmVyO1xuICBpbnN0aXR1dGlvbl9uYW1lOiBzdHJpbmc7XG4gIGluc3RpdHV0aW9uX25hbWVfMj86IHN0cmluZyB8IG51bGw7XG4gIGluc3RpdHV0aW9uX25hbWVfMz86IHN0cmluZyB8IG51bGw7XG4gIGFjY291bnRfbnVtYmVyPzogc3RyaW5nIHwgbnVsbDtcbiAgaW5zdGl0dXRpb25fc2hvcnRuYW1lOiBzdHJpbmc7XG59XG4iXX0=
@@ -15,10 +15,11 @@ export function serviceConnectPluginFactory(options) {
15
15
  const { environment } = injectAuthConfig();
16
16
  const httpClient = inject(HttpClient);
17
17
  const url = buildServiceConnectUrl(pluginOptions?.environment ?? environment, ...options.endpoint);
18
- const parseResponse = (dto) => options.parseResponse(dto) ?? options.defaultValue ?? {};
19
- return () => defer(() => httpClient.get(url, {
20
- context: new HttpContext().set(requireAuthentication, true),
21
- })).pipe(map((dto) => parseResponse(dto)));
18
+ const parseResponse = (res) => ({
19
+ ...(options.parseResponse(res) ?? options.defaultValue ?? {}),
20
+ ...(pluginOptions?.additionalClaims?.(res) ?? {}),
21
+ });
22
+ return () => defer(() => httpClient.get(url, { context: new HttpContext().set(requireAuthentication, true) })).pipe(map((res) => parseResponse(res)));
22
23
  };
23
24
  }
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS1jb25uZWN0LXBsdWdpbi1mYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9hdXRoL3BsdWdpbnMvc2VydmljZS1jb25uZWN0L3NyYy9saWIvaGVscGVycy9zZXJ2aWNlLWNvbm5lY3QtcGx1Z2luLWZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxXQUFXLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUMvRCxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3ZDLE9BQU8sRUFBcUIsZ0JBQWdCLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFDdkYsT0FBTyxFQUFFLEtBQUssRUFBRSxHQUFHLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFFbEMsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFlckU7Ozs7O0dBS0c7QUFDSCxNQUFNLFVBQVUsMkJBQTJCLENBQWdCLE9BQWdEO0lBQ3pHLE9BQU8sQ0FBQyxhQUFhLEVBQUUsRUFBRSxDQUFDLEdBQUcsRUFBRTtRQUM3QixPQUFPLENBQUMsS0FBSyxFQUFFLENBQUMsYUFBYSxDQUFDLENB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wdGlvbnM/LmVudmlyb25tZW50ID8/IGVudmlyb25tZW50LCAuLi5vcHRpb25zLmVuZHBvaW50KTtcbiAgICBjb25zdCBwYXJzZVJlc3BvbnNlID0gKHJlczogRHRvIHwgbnVsbCkgPT4gKHtcbiAgICAgIC4uLihvcHRpb25zLnBhcnNlUmVzcG9uc2UocmVzKSA/PyBvcHRpb25zLmRlZmF1bHRWYWx1ZSA/PyB7fSksXG4gICAgICAuLi4ocGx1Z2luT3B0aW9ucz8uYWRkaXRpb25hbENsYWltcz8uKHJlcyBhcyBEdG8gJiBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPikgPz8ge30pLFxuICAgIH0pO1xuXG4gICAgcmV0dXJuICgpID0+IGRlZmVyKCgpID0+IGh0dHBDbGllbnQuZ2V0PER0bz4odXJsLCB7IGNvbnRleHQ6IG5ldyBIdHRwQ29udGV4dCgpLnNldChyZXF1aXJlQXV0aGVudGljYXRpb24sIHRydWUpIH0pKS5waXBlKG1hcCgocmVzKSA9PiBwYXJzZVJlc3BvbnNlKHJlcykpKTtcbiAgfTtcbn1cbiJdfQ==
@@ -16,9 +16,12 @@ export const serviceConnectUserProfilePlugin = serviceConnectPluginFactory({
16
16
  country: res?.country,
17
17
  institutionId: res?.institution_id,
18
18
  institutionName: res?.institution_name,
19
+ institutionName2: res?.institution_name_2 ?? undefined,
20
+ institutionName3: res?.institution_name_3 ?? undefined,
21
+ accountNumber: res?.account_number ?? undefined,
19
22
  institutionShortname: res?.institution_shortname,
20
23
  preferredLanguage: getServiceConnectUserLanguage(res),
21
24
  };
22
25
  },
23
26
  });
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS1jb25uZWN0LXVzZXItcHJvZmlsZS5wbHVnaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJzL2F1dGgvcGx1Z2lucy9zZXJ2aWNlLWNvbm5lY3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IHtcbiAgICByZXR1cm4ge1xuICAgICAgY291bnRyeTogcmVzPy5jb3VudHJ5LFxuICAgICAgaW5zdGl0dXRpb25JZDogcmVzPy5pbnN0aXR1dGlvbl9pZCxcbiAgICAgIGluc3RpdHV0aW9uTmFtZTogcmVzPy5pbnN0aXR1dGlvbl9uYW1lLFxuICAgICAgaW5zdGl0dXRpb25OYW1lMjogcmVzPy5pbnN0aXR1dGlvbl9uYW1lXzIgPz8gdW5kZWZpbmVkLFxuICAgICAgaW5zdGl0dXRpb25OYW1lMzogcmVzPy5pbnN0aXR1dGlvbl9uYW1lXzMgPz8gdW5kZWZpbmVkLFxuICAgICAgYWNjb3VudE51bWJlcjogcmVzPy5hY2NvdW50X251bWJlciA/PyB1bmRlZmluZWQsXG4gICAgICBpbnN0aXR1dGlvblNob3J0bmFtZTogcmVzPy5pbnN0aXR1dGlvbl9zaG9ydG5hbWUsXG4gICAgICBwcmVmZXJyZWRMYW5ndWFnZTogZ2V0U2VydmljZUNvbm5lY3RVc2VyTGFuZ3VhZ2UocmVzKSxcbiAgICB9O1xuICB9LFxufSk7XG4iXX0=
@@ -70,10 +70,11 @@ function serviceConnectPluginFactory(options) {
70
70
  const { environment } = injectAuthConfig();
71
71
  const httpClient = inject(HttpClient);
72
72
  const url = buildServiceConnectUrl(pluginOptions?.environment ?? environment, ...options.endpoint);
73
- const parseResponse = (dto) => options.parseResponse(dto) ?? options.defaultValue ?? {};
74
- return () => defer(() => httpClient.get(url, {
75
- context: new HttpContext().set(requireAuthentication, true),
76
- })).pipe(map((dto) => parseResponse(dto)));
73
+ const parseResponse = (res) => ({
74
+ ...(options.parseResponse(res) ?? options.defaultValue ?? {}),
75
+ ...(pluginOptions?.additionalClaims?.(res) ?? {}),
76
+ });
77
+ return () => defer(() => httpClient.get(url, { context: new HttpContext().set(requireAuthentication, true) })).pipe(map((res) => parseResponse(res)));
77
78
  };
78
79
  }
79
80
 
@@ -180,6 +181,9 @@ const serviceConnectUserProfilePlugin = serviceConnectPluginFactory({
180
181
  country: res?.country,
181
182
  institutionId: res?.institution_id,
182
183
  institutionName: res?.institution_name,
184
+ institutionName2: res?.institution_name_2 ?? undefined,
185
+ institutionName3: res?.institution_name_3 ?? undefined,
186
+ accountNumber: res?.account_number ?? undefined,
183
187
  institutionShortname: res?.institution_shortname,
184
188
  preferredLanguage: getServiceConnectUserLanguage(res),
185
189
  };
@@ -1 +1 @@
1
- {"version":3,"file":"odx-auth-plugins-service-connect.mjs","sources":["../../../../libs/auth/plugins/service-connect/src/lib/service-connect.config.ts","../../../../libs/auth/plugins/service-connect/src/lib/helpers/build-service-connect-url.ts","../../../../libs/auth/plugins/service-connect/src/lib/helpers/has-roles-or-rights.ts","../../../../libs/auth/plugins/service-connect/src/lib/helpers/has-roles-or-rights-handler.ts","../../../../libs/auth/plugins/service-connect/src/lib/helpers/service-connect-plugin-factory.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-rights.directive.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-rights.guard.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-rights.plugin.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-user-language.plugin.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-user-profile.plugin.ts","../../../../libs/auth/plugins/service-connect/src/odx-auth-plugins-service-connect.ts"],"sourcesContent":["import { AuthEnvironment } from '@odx/auth';\n\nexport type ServiceConnectEnvironment = { custom: string };\nexport const ServiceConnnectEnvironments: Record<AuthEnvironment, string> = {\n [AuthEnvironment.DEV]: 'https://api.test.connect.draeger.com',\n [AuthEnvironment.STAGE]: 'https://api.staging.connect.draeger.com',\n [AuthEnvironment.PROD]: 'https://api.connect.draeger.com',\n};\nexport const ServiceConnectScopes = {\n BASE: 'dcid',\n PROFILE: 'dcid.profile',\n RIGHTS: 'dcid.rights',\n INSTITUTION: 'dcid.institution',\n};\nexport const ServiceConnectEndpoints = {\n user: '/users/me',\n userRights: '/users/me/rights',\n};\n","import { buildUrl, isString } from '@odx/angular/utils';\nimport { AuthEnvironment } from '@odx/auth';\nimport { ServiceConnectEnvironment, ServiceConnnectEnvironments } from '../service-connect.config';\n\n/**\n * Builds a service connect URL based on the provided environment and endpoints.\n *\n * @param {ServiceConnectEnvironment | AuthEnvironment} environment - The environment configuration which can be either a `ServiceConnectEnvironment` or `AuthEnvironment`.\n * @param {string[]} endpoints - A list of endpoint strings to be appended to the base URL.\n * @returns {string} - The constructed service connect URL as a string.\n */\nexport function buildServiceConnectUrl(environment: ServiceConnectEnvironment | AuthEnvironment, ...endpoints: string[]): string {\n if (isString(environment)) {\n return buildUrl(ServiceConnnectEnvironments[environment], ...endpoints);\n }\n return buildUrl(environment.custom, ...endpoints);\n}\n","export type Right = string | number;\nexport type Role = Right[];\nexport type RolesOrRights = Array<Role | Right>;\n\n/**\n * Checks if the user has any of the specified roles or rights.\n *\n * @param {Right[]} userRights - An array of rights that the user possesses.\n * @param {RolesOrRights} rolesOrRights - An array of roles or rights to check against. A role is represented as an array of rights.\n * @returns {boolean} - `true` if the user has any of the specified roles or rights, otherwise `false`.\n */\nexport function hasRolesOrRights(userRights: Right[], rolesOrRights: RolesOrRights): boolean {\n return rolesOrRights.some((rights) => (Array.isArray(rights) ? rights : [rights])?.every((right) => userRights.includes(right)));\n}\n","import { AuthorizedHandler } from '@odx/auth';\nimport { hasRolesOrRights, RolesOrRights } from './has-roles-or-rights';\n\n/**\n * Creates an authorized handler that checks if the user has the specified roles or rights.\n *\n * @param {RolesOrRights} rolesOrRights - The roles or rights to check against the user's claims.\n * @returns {AuthorizedHandler} - An handler function that takes user claims and returns a boolean indicating\n * whether the user has the required roles or rights.\n */\nexport function hasRolesOrRightsHandler(rolesOrRights: RolesOrRights): AuthorizedHandler {\n return (claims) => hasRolesOrRights(claims?.rights ?? [], rolesOrRights);\n}\n","import { HttpClient, HttpContext } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { AuthPluginFactory, injectAuthConfig, requireAuthentication } from '@odx/auth';\nimport { defer, map } from 'rxjs';\nimport { ServiceConnectEnvironment } from '../service-connect.config';\nimport { buildServiceConnectUrl } from './build-service-connect-url';\n\nexport interface ServiceConnectPluginOptions {\n environment?: ServiceConnectEnvironment;\n}\n\nexport interface ServiceConnectPluginFactoryOptions<Dto> {\n endpoint: string[];\n parseResponse: (res: Dto | null) => Partial<OdxAuth.AuthPluginResult>;\n defaultValue?: Partial<OdxAuth.AuthPluginResult>;\n setup?: (pluginOptions?: ServiceConnectPluginOptions) => void;\n}\n\nexport type ServiceConnectPluginFactory = (pluginOptions?: ServiceConnectPluginOptions) => AuthPluginFactory;\n\n/**\n * Creates a plugin factory for fetching and parsing service connect data.\n *\n * @param {ServiceConnectPluginFactoryOptions<Dto>} options - The options for the service connect plugin factory.\n * @returns {ServiceConnectPluginFactory} - A function that creates an auth plugin factory for fetching and parsing service connect data.\n */\nexport function serviceConnectPluginFactory<Dto = unknown>(options: ServiceConnectPluginFactoryOptions<Dto>): ServiceConnectPluginFactory {\n return (pluginOptions) => () => {\n options.setup?.(pluginOptions);\n const { environment } = injectAuthConfig();\n const httpClient = inject(HttpClient);\n const url = buildServiceConnectUrl(pluginOptions?.environment ?? environment, ...options.endpoint);\n const parseResponse = (dto: Dto | null) => options.parseResponse(dto) ?? options.defaultValue ?? {};\n\n return () =>\n defer(() =>\n httpClient.get<Dto>(url, {\n context: new HttpContext().set(requireAuthentication, true),\n }),\n ).pipe(map((dto) => parseResponse(dto)));\n };\n}\n","import { Directive, inject, Input } from '@angular/core';\nimport { AuthDirective } from '@odx/auth';\nimport { hasRolesOrRightsHandler, RolesOrRights } from './helpers';\n\n/**\n * A directive that extends the functionality of the `AuthDirective` to handle\n * roles or rights for service connection authorization.\n *\n * @see AuthDirective\n *\n * This directive should be used on an `ng-template` element with the selector\n * `odxAuthServiceConnectRights`.\n */\n@Directive({\n standalone: true,\n selector: 'ng-template[odxAuthServiceConnectRights]',\n hostDirectives: [\n {\n directive: AuthDirective,\n inputs: ['odxAuthElse:odxAuthServiceConnectRightsElse'],\n },\n ],\n})\nexport class ServiceConnectRightsDirective {\n private readonly authDirective = inject(AuthDirective, { host: true });\n\n /**\n * Sets the roles or rights that the user must have to display the content.\n */\n @Input('odxAuthServiceConnectRights')\n public set rolesOrRights(value: RolesOrRights | null | undefined) {\n this.authDirective.authorizationHandler = hasRolesOrRightsHandler(value ?? []);\n }\n}\n","import { CanActivateFn } from '@angular/router';\nimport { authGuard } from '@odx/auth';\nimport { hasRolesOrRightsHandler, RolesOrRights } from './helpers';\n\n/**\n * A guard function to check if the user has the required roles or rights to access a route.\n *\n * @param {RolesOrRights} rolesOrRights - The roles or rights required to access the route.\n * @param {string | any[]} redirectTo - (Optional) The route to redirect to if the user does not have the required roles or rights.\n * @param {boolean} isExternal - (Optional) A flag indicating if the redirection is to an external URL. Defaults to `false`.\n * @returns {CanActivateFn} - A function that checks the user's roles or rights and handles redirection if necessary.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function serviceConnectRightsGuard(rolesOrRights: RolesOrRights, redirectTo?: string | any[], isExternal = false): CanActivateFn {\n return authGuard(hasRolesOrRightsHandler(rolesOrRights), redirectTo, isExternal);\n}\n","import { GetServiceConnectRightsResponseDto } from './dtos';\nimport { Right, serviceConnectPluginFactory } from './helpers';\nimport { ServiceConnectEndpoints } from './service-connect.config';\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace OdxAuth {\n interface AuthPluginResult {\n rights: Right[];\n }\n }\n}\n\n/**\n * A plugin for fetching and parsing service connect rights.\n *\n * This plugin uses the `serviceConnectPluginFactory` to create a plugin that fetches user rights\n * from the specified endpoint and parses the response to extract the rights.\n *\n * @see {serviceConnectPluginFactory}\n */\nexport const serviceConnectRightsPlugin = serviceConnectPluginFactory<GetServiceConnectRightsResponseDto>({\n endpoint: [ServiceConnectEndpoints.userRights],\n parseResponse: (res) => ({ rights: res?.rights ?? [] }),\n defaultValue: { rights: [] },\n});\n","import { getLanguageCode } from '@odx/angular/utils';\nimport { GetServiceConnectUserResponseDto } from './dtos';\nimport { serviceConnectPluginFactory } from './helpers';\nimport { ServiceConnectEndpoints } from './service-connect.config';\n\n/**\n * Gets the language code from a service connect user response.\n *\n * @param {GetServiceConnectUserResponseDto | null} res - The service connect user response.\n * @returns {string | undefined} - The language code or undefined.\n */\nexport function getServiceConnectUserLanguage(res?: GetServiceConnectUserResponseDto | null): string | undefined {\n return (res?.preferred_language ?? res?.language_code) ? getLanguageCode(res.preferred_language ?? res.language_code) : undefined;\n}\n\n/**\n * A plugin for fetching and parsing the user's preferred language from service connect.\n *\n * This plugin uses the `serviceConnectPluginFactory` to create a plugin that fetches the user's preferred language\n * from the user endpoint and parses the response to extract the preferred language.\n *\n * @see {serviceConnectPluginFactory}\n */\nexport const serviceConnectUserLanguagePlugin = serviceConnectPluginFactory<GetServiceConnectUserResponseDto>({\n endpoint: [ServiceConnectEndpoints.user],\n parseResponse: (res) => ({ preferredLanguage: getServiceConnectUserLanguage(res) }),\n});\n","import { GetServiceConnectUserResponseDto } from './dtos';\nimport { serviceConnectPluginFactory } from './helpers';\nimport { getServiceConnectUserLanguage } from './service-connect-user-language.plugin';\nimport { ServiceConnectEndpoints } from './service-connect.config';\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace OdxAuth {\n interface AuthPluginResult {\n country?: string;\n institutionId?: number;\n institutionName?: string;\n institutionShortname?: string;\n }\n }\n}\n\n/**\n * A plugin for fetching and parsing the user's profile from service connect.\n *\n * This plugin uses the `serviceConnectPluginFactory` to create a plugin that fetches the user's profile\n * from the user endpoint and parses the response to extract the user's profile information.\n *\n * @see {serviceConnectPluginFactory}\n */\nexport const serviceConnectUserProfilePlugin = serviceConnectPluginFactory<GetServiceConnectUserResponseDto>({\n endpoint: [ServiceConnectEndpoints.user],\n parseResponse: (res) => {\n return {\n country: res?.country,\n institutionId: res?.institution_id,\n institutionName: res?.institution_name,\n institutionShortname: res?.institution_shortname,\n preferredLanguage: getServiceConnect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CAAA;;ACpBD;;;;;AAKG;AACG,SAAU,6BAA6B,CAAC,GAA6C,EAAA;IACzF,OAAO,CAAC,GAAG,EAAE,kBAAkB,IAAI,GAAG,EAAE,aAAa,IAAI,eAAe,CAAC,GAAG,CAAC,kBAAkB,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;AACpI,CAAC;AAED;;;;;;;AAOG;AACI,MAAM,gCAAgC,GAAG,2BAA2B,CAAmC;AAC5G,IAAA,QAAQ,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC;AACxC,IAAA,aAAa,EAAE,CAAC,GAAG,MAAM,EAAE,iBAAiB,EAAE,6BAA6B,CAAC,GAAG,CAAC,EAAE,CAAC;AACpF,CAAA;;ACTD;;;;;;;AAOG;AACI,MAAM,+BAA+B,GAAG,2BAA2B,CAAmC;AAC3G,IAAA,QAAQ,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC;AACxC,IAAA,aAAa,EAAE,CAAC,GAAG,KAAI;QACrB,OAAO;YACL,OAAO,EAAE,GAAG,EAAE,OAAO;YACrB,aAAa,EAAE,GAAG,EAAE,cAAc;YAClC,eAAe,EAAE,GAAG,EAAE,gBAAgB;YACtC,oBAAoB,EAAE,GAAG,EAAE,qBAAqB;AAChD,YAAA,iBAAiB,EAAE,6BAA6B,CAAC,GAAG,CAAC;SACtD,CAAC;KACH;AACF,CAAA;;ACpCD;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-auth-plugins-service-connect.mjs","sources":["../../../../libs/auth/plugins/service-connect/src/lib/service-connect.config.ts","../../../../libs/auth/plugins/service-connect/src/lib/helpers/build-service-connect-url.ts","../../../../libs/auth/plugins/service-connect/src/lib/helpers/has-roles-or-rights.ts","../../../../libs/auth/plugins/service-connect/src/lib/helpers/has-roles-or-rights-handler.ts","../../../../libs/auth/plugins/service-connect/src/lib/helpers/service-connect-plugin-factory.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-rights.directive.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-rights.guard.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-rights.plugin.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-user-language.plugin.ts","../../../../libs/auth/plugins/service-connect/src/lib/service-connect-user-profile.plugin.ts","../../../../libs/auth/plugins/service-connect/src/odx-auth-plugins-service-connect.ts"],"sourcesContent":["import { AuthEnvironment } from '@odx/auth';\n\nexport type ServiceConnectEnvironment = { custom: string };\nexport const ServiceConnnectEnvironments: Record<AuthEnvironment, string> = {\n [AuthEnvironment.DEV]: 'https://api.test.connect.draeger.com',\n [AuthEnvironment.STAGE]: 'https://api.staging.connect.draeger.com',\n [AuthEnvironment.PROD]: 'https://api.connect.draeger.com',\n};\nexport const ServiceConnectScopes = {\n BASE: 'dcid',\n PROFILE: 'dcid.profile',\n RIGHTS: 'dcid.rights',\n INSTITUTION: 'dcid.institution',\n};\nexport const ServiceConnectEndpoints = {\n user: '/users/me',\n userRights: '/users/me/rights',\n};\n","import { buildUrl, isString } from '@odx/angular/utils';\nimport { AuthEnvironment } from '@odx/auth';\nimport { ServiceConnectEnvironment, ServiceConnnectEnvironments } from '../service-connect.config';\n\n/**\n * Builds a service connect URL based on the provided environment and endpoints.\n *\n * @param {ServiceConnectEnvironment | AuthEnvironment} environment - The environment configuration which can be either a `ServiceConnectEnvironment` or `AuthEnvironment`.\n * @param {string[]} endpoints - A list of endpoint strings to be appended to the base URL.\n * @returns {string} - The constructed service connect URL as a string.\n */\nexport function buildServiceConnectUrl(environment: ServiceConnectEnvironment | AuthEnvironment, ...endpoints: string[]): string {\n if (isString(environment)) {\n return buildUrl(ServiceConnnectEnvironments[environment], ...endpoints);\n }\n return buildUrl(environment.custom, ...endpoints);\n}\n","export type Right = string | number;\nexport type Role = Right[];\nexport type RolesOrRights = Array<Role | Right>;\n\n/**\n * Checks if the user has any of the specified roles or rights.\n *\n * @param {Right[]} userRights - An array of rights that the user possesses.\n * @param {RolesOrRights} rolesOrRights - An array of roles or rights to check against. A role is represented as an array of rights.\n * @returns {boolean} - `true` if the user has any of the specified roles or rights, otherwise `false`.\n */\nexport function hasRolesOrRights(userRights: Right[], rolesOrRights: RolesOrRights): boolean {\n return rolesOrRights.some((rights) => (Array.isArray(rights) ? rights : [rights])?.every((right) => userRights.includes(right)));\n}\n","import { AuthorizedHandler } from '@odx/auth';\nimport { hasRolesOrRights, RolesOrRights } from './has-roles-or-rights';\n\n/**\n * Creates an authorized handler that checks if the user has the specified roles or rights.\n *\n * @param {RolesOrRights} rolesOrRights - The roles or rights to check against the user's claims.\n * @returns {AuthorizedHandler} - An handler function that takes user claims and returns a boolean indicating\n * whether the user has the required roles or rights.\n */\nexport function hasRolesOrRightsHandler(rolesOrRights: RolesOrRights): AuthorizedHandler {\n return (claims) => hasRolesOrRights(claims?.rights ?? [], rolesOrRights);\n}\n","import { HttpClient, HttpContext } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { AuthPluginFactory, injectAuthConfig, requireAuthentication } from '@odx/auth';\nimport { defer, map } from 'rxjs';\nimport { ServiceConnectEnvironment } from '../service-connect.config';\nimport { buildServiceConnectUrl } from './build-service-connect-url';\n\nexport interface ServiceConnectPluginOptions<Dto = unknown> {\n environment?: ServiceConnectEnvironment;\n additionalClaims?: (dto: (Dto & Record<string, unknown>) | null) => Partial<OdxAuth.AuthPluginResult>;\n}\n\nexport interface ServiceConnectPluginFactoryOptions<Dto> {\n endpoint: string[];\n parseResponse: (res: Dto | null) => Partial<OdxAuth.AuthPluginResult>;\n defaultValue?: Partial<OdxAuth.AuthPluginResult>;\n setup?: (pluginOptions?: ServiceConnectPluginOptions<Dto>) => void;\n}\n\nexport type ServiceConnectPluginFactory<Dto = unknown> = (pluginOptions?: ServiceConnectPluginOptions<Dto>) => AuthPluginFactory;\n\n/**\n * Creates a plugin factory for fetching and parsing service connect data.\n *\n * @param {ServiceConnectPluginFactoryOptions<Dto>} options - The options for the service connect plugin factory.\n * @returns {ServiceConnectPluginFactory} - A function that creates an auth plugin factory for fetching and parsing service connect data.\n */\nexport function serviceConnectPluginFactory<Dto = unknown>(options: ServiceConnectPluginFactoryOptions<Dto>): ServiceConnectPluginFactory<Dto> {\n return (pluginOptions) => () => {\n options.setup?.(pluginOptions);\n const { environment } = injectAuthConfig();\n const httpClient = inject(HttpClient);\n const url = buildServiceConnectUrl(pluginOptions?.environment ?? environment, ...options.endpoint);\n const parseResponse = (res: Dto | null) => ({\n ...(options.parseResponse(res) ?? options.defaultValue ?? {}),\n ...(pluginOptions?.additionalClaims?.(res as Dto & Record<string, unknown>) ?? {}),\n });\n\n return () => defer(() => httpClient.get<Dto>(url, { context: new HttpContext().set(requireAuthentication, true) })).pipe(map((res) => parseResponse(res)));\n };\n}\n","import { Directive, inject, Input } from '@angular/core';\nimport { AuthDirective } from '@odx/auth';\nimport { hasRolesOrRightsHandler, RolesOrRights } from './helpers';\n\n/**\n * A directive that extends the functionality of the `AuthDirective` to handle\n * roles or rights for service connection authorization.\n *\n * @see AuthDirective\n *\n * This directive should be used on an `ng-template` element with the selector\n * `odxAuthServiceConnectRights`.\n */\n@Directive({\n standalone: true,\n selector: 'ng-template[odxAuthServiceConnectRights]',\n hostDirectives: [\n {\n directive: AuthDirective,\n inputs: ['odxAuthElse:odxAuthServiceConnectRightsElse'],\n },\n ],\n})\nexport class ServiceConnectRightsDirective {\n private readonly authDirective = inject(AuthDirective, { host: true });\n\n /**\n * Sets the roles or rights that the user must have to display the content.\n */\n @Input('odxAuthServiceConnectRights')\n public set rolesOrRights(value: RolesOrRights | null | undefined) {\n this.authDirective.authorizationHandler = hasRolesOrRightsHandler(value ?? []);\n }\n}\n","import { CanActivateFn } from '@angular/router';\nimport { authGuard } from '@odx/auth';\nimport { hasRolesOrRightsHandler, RolesOrRights } from './helpers';\n\n/**\n * A guard function to check if the user has the required roles or rights to access a route.\n *\n * @param {RolesOrRights} rolesOrRights - The roles or rights required to access the route.\n * @param {string | any[]} redirectTo - (Optional) The route to redirect to if the user does not have the required roles or rights.\n * @param {boolean} isExternal - (Optional) A flag indicating if the redirection is to an external URL. Defaults to `false`.\n * @returns {CanActivateFn} - A function that checks the user's roles or rights and handles redirection if necessary.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function serviceConnectRightsGuard(rolesOrRights: RolesOrRights, redirectTo?: string | any[], isExternal = false): CanActivateFn {\n return authGuard(hasRolesOrRightsHandler(rolesOrRights), redirectTo, isExternal);\n}\n","import { GetServiceConnectRightsResponseDto } from './dtos';\nimport { Right, serviceConnectPluginFactory } from './helpers';\nimport { ServiceConnectEndpoints } from './service-connect.config';\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace OdxAuth {\n interface AuthPluginResult {\n rights: Right[];\n }\n }\n}\n\n/**\n * A plugin for fetching and parsing service connect rights.\n *\n * This plugin uses the `serviceConnectPluginFactory` to create a plugin that fetches user rights\n * from the specified endpoint and parses the response to extract the rights.\n *\n * @see {serviceConnectPluginFactory}\n */\nexport const serviceConnectRightsPlugin = serviceConnectPluginFactory<GetServiceConnectRightsResponseDto>({\n endpoint: [ServiceConnectEndpoints.userRights],\n parseResponse: (res) => ({ rights: res?.rights ?? [] }),\n defaultValue: { rights: [] },\n});\n","import { getLanguageCode } from '@odx/angular/utils';\nimport { GetServiceConnectUserResponseDto } from './dtos';\nimport { serviceConnectPluginFactory } from './helpers';\nimport { ServiceConnectEndpoints } from './service-connect.config';\n\n/**\n * Gets the language code from a service connect user response.\n *\n * @param {GetServiceConnectUserResponseDto | null} res - The service connect user response.\n * @returns {string | undefined} - The language code or undefined.\n */\nexport function getServiceConnectUserLanguage(res?: GetServiceConnectUserResponseDto | null): string | undefined {\n return (res?.preferred_language ?? res?.language_code) ? getLanguageCode(res.preferred_language ?? res.language_code) : undefined;\n}\n\n/**\n * A plugin for fetching and parsing the user's preferred language from service connect.\n *\n * This plugin uses the `serviceConnectPluginFactory` to create a plugin that fetches the user's preferred language\n * from the user endpoint and parses the response to extract the preferred language.\n *\n * @see {serviceConnectPluginFactory}\n */\nexport const serviceConnectUserLanguagePlugin = serviceConnectPluginFactory<GetServiceConnectUserResponseDto>({\n endpoint: [ServiceConnectEndpoints.user],\n parseResponse: (res) => ({ preferredLanguage: getServiceConnectUserLanguage(res) }),\n});\n","import { GetServiceConnectUserResponseDto } from './dtos';\nimport { serviceConnectPluginFactory } from './helpers';\nimport { getServiceConnectUserLanguage } from './service-connect-user-language.plugin';\nimport { ServiceConnectEndpoints } from './service-connect.config';\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace OdxAuth {\n interface AuthPluginResult {\n country?: string;\n institutionId?: number;\n institutionName?: string;\n institutionName2?: string;\n institutionName3?: string;\n institutionShortname?: string;\n accountNumber?: string;\n }\n }\n}\n\n/**\n * A plugin for fetching and parsing the user's profile from service connect.\n *\n * This plugin uses the `serviceConnectPluginFactory` to create a plugin that fetches the user's profile\n * from the user endpoint and parses the response to extract the user's profile information.\n *\n * @see {serviceConnectPluginFactory}\n */\nexport const serviceConnectUserProfilePlugin = serviceConnectPluginFactory<GetServiceConnectUserResponseDto>({\n endpoint: [ServiceConnectEndpoints.user],\n parseResponse: (res) => {\n return {\n country: res?.country,\n institutionId: res?.institution_id,\n institutionName: res?.institution_name,\n institutionName2: res?.institution_name_2 ?? undefined,\n institutionName3: res?.institution_name_3 ?? undefined,\n accountNumber: res?.account_number ?? undefined,\n institutionShortname: res?.institution_shortname,\n preferredLanguage: getServiceConnectUserLanguage(res),\n };\n },\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAGa,MAAA,2BAA2B,GAAoC;AAC1E,IAAA,CAAC,eAAe,CAAC,GAAG,GAAG,sCAAsC;AAC7D,IAAA,CAAC,eAAe,CAAC,KAAK,GAAG,yCAAyC;AAClE,IAAA,CAAC,eAAe,CAAC,IAAI,GAAG,iCAAiC;EACzD;AACW,MAAA,oBAAoB,GAAG;AAClC,IAAA,IAAI,EAAE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AAED;;;;;;;AAOG;AACI,MAAM,gCAAgC,GAAG,2BAA2B,CAAmC;AAC5G,IAAA,QAAQ,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC;AACxC,IAAA,aAAa,EAAE,CAAC,GAAG,MAAM,EAAE,iBAAiB,EAAE,6BAA6B,CAAC,GAAG,CAAC,EAAE,CAAC;AACpF,CAAA;;ACND;;;;;;;AAOG;AACI,MAAM,+BAA+B,GAAG,2BAA2B,CAAmC;AAC3G,IAAA,QAAQ,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC;AACxC,IAAA,aAAa,EAAE,CAAC,GAAG,KAAI;QACrB,OAAO;YACL,OAAO,EAAE,GAAG,EAAE,OAAO;YACrB,aAAa,EAAE,GAAG,EAAE,cAAc;YAClC,eAAe,EAAE,GAAG,EAAE,gBAAgB;AACtC,YAAA,gBAAgB,EAAE,GAAG,EAAE,kBAAkB,IAAI,SAAS;AACtD,YAAA,gBAAgB,EAAE,GAAG,EAAE,kBAAkB,IAAI,SAAS;AACtD,YAAA,aAAa,EAAE,GAAG,EAAE,cAAc,IAAI,SAAS;YAC/C,oBAAoB,EAAE,GAAG,EAAE,qBAAqB;AAChD,YAAA,iBAAiB,EAAE,6BAA6B,CAAC,GAAG,CAAC;SACtD,CAAC;KACH;AACF,CAAA;;AC1CD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odx/auth",
3
- "version": "16.0.0",
3
+ "version": "16.0.1",
4
4
  "author": "Drägerwerk AG & Co.KGaA",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "peerDependencies": {
@@ -7,5 +7,8 @@ export interface GetServiceConnectUserResponseDto {
7
7
  country: string;
8
8
  institution_id: number;
9
9
  institution_name: string;
10
+ institution_name_2?: string | null;
11
+ institution_name_3?: string | null;
12
+ account_number?: string | null;
10
13
  institution_shortname: string;
11
14
  }
@@ -1,19 +1,20 @@
1
1
  import { AuthPluginFactory } from '@odx/auth';
2
2
  import { ServiceConnectEnvironment } from '../service-connect.config';
3
- export interface ServiceConnectPluginOptions {
3
+ export interface ServiceConnectPluginOptions<Dto = unknown> {
4
4
  environment?: ServiceConnectEnvironment;
5
+ additionalClaims?: (dto: (Dto & Record<string, unknown>) | null) => Partial<OdxAuth.AuthPluginResult>;
5
6
  }
6
7
  export interface ServiceConnectPluginFactoryOptions<Dto> {
7
8
  endpoint: string[];
8
9
  parseResponse: (res: Dto | null) => Partial<OdxAuth.AuthPluginResult>;
9
10
  defaultValue?: Partial<OdxAuth.AuthPluginResult>;
10
- setup?: (pluginOptions?: ServiceConnectPluginOptions) => void;
11
+ setup?: (pluginOptions?: ServiceConnectPluginOptions<Dto>) => void;
11
12
  }
12
- export type ServiceConnectPluginFactory = (pluginOptions?: ServiceConnectPluginOptions) => AuthPluginFactory;
13
+ export type ServiceConnectPluginFactory<Dto = unknown> = (pluginOptions?: ServiceConnectPluginOptions<Dto>) => AuthPluginFactory;
13
14
  /**
14
15
  * Creates a plugin factory for fetching and parsing service connect data.
15
16
  *
16
17
  * @param {ServiceConnectPluginFactoryOptions<Dto>} options - The options for the service connect plugin factory.
17
18
  * @returns {ServiceConnectPluginFactory} - A function that creates an auth plugin factory for fetching and parsing service connect data.
18
19
  */
19
- export declare function serviceConnectPluginFactory<Dto = unknown>(options: ServiceConnectPluginFactoryOptions<Dto>): ServiceConnectPluginFactory;
20
+ export declare function serviceConnectPluginFactory<Dto = unknown>(options: ServiceConnectPluginFactoryOptions<Dto>): ServiceConnectPluginFactory<Dto>;
@@ -1,3 +1,4 @@
1
+ import { GetServiceConnectRightsResponseDto } from './dtos';
1
2
  import { Right } from './helpers';
2
3
  declare global {
3
4
  namespace OdxAuth {
@@ -14,4 +15,4 @@ declare global {
14
15
  *
15
16
  * @see {serviceConnectPluginFactory}
16
17
  */
17
- export declare const serviceConnectRightsPlugin: import("./helpers").ServiceConnectPluginFactory;
18
+ export declare const serviceConnectRightsPlugin: import("./helpers").ServiceConnectPluginFactory<GetServiceConnectRightsResponseDto>;
@@ -14,4 +14,4 @@ export declare function getServiceConnectUserLanguage(res?: GetServiceConnectUse
14
14
  *
15
15
  * @see {serviceConnectPluginFactory}
16
16
  */
17
- export declare const serviceConnectUserLanguagePlugin: import("./helpers").ServiceConnectPluginFactory;
17
+ export declare const serviceConnectUserLanguagePlugin: import("./helpers").ServiceConnectPluginFactory<GetServiceConnectUserResponseDto>;
@@ -1,10 +1,14 @@
1
+ import { GetServiceConnectUserResponseDto } from './dtos';
1
2
  declare global {
2
3
  namespace OdxAuth {
3
4
  interface AuthPluginResult {
4
5
  country?: string;
5
6
  institutionId?: number;
6
7
  institutionName?: string;
8
+ institutionName2?: string;
9
+ institutionName3?: string;
7
10
  institutionShortname?: string;
11
+ accountNumber?: string;
8
12
  }
9
13
  }
10
14
  }
@@ -16,4 +20,4 @@ declare global {
16
20
  *
17
21
  * @see {serviceConnectPluginFactory}
18
22
  */
19
- export declare const serviceConnectUserProfilePlugin: import("./helpers").ServiceConnectPluginFactory;
23
+ export declare const serviceConnectUserProfilePlugin: import("./helpers").ServiceConnectPluginFactory<GetServiceConnectUserResponseDto>;