@odx/auth 17.2.1 → 18.0.0

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 (114) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/fesm2022/odx-auth-plugins-service-connect.mjs +3 -3
  3. package/fesm2022/odx-auth-plugins-service-connect.mjs.map +1 -1
  4. package/fesm2022/odx-auth.mjs +42 -42
  5. package/fesm2022/odx-auth.mjs.map +1 -1
  6. package/index.d.ts +744 -15
  7. package/package.json +4 -8
  8. package/plugins/service-connect/index.d.ts +184 -8
  9. package/esm2022/index.mjs +0 -16
  10. package/esm2022/lib/auth.component.mjs +0 -50
  11. package/esm2022/lib/auth.config.mjs +0 -71
  12. package/esm2022/lib/auth.directive.mjs +0 -51
  13. package/esm2022/lib/auth.guard.mjs +0 -44
  14. package/esm2022/lib/auth.i18n.mjs +0 -13
  15. package/esm2022/lib/auth.interceptor.mjs +0 -23
  16. package/esm2022/lib/auth.logger.mjs +0 -3
  17. package/esm2022/lib/auth.module.mjs +0 -19
  18. package/esm2022/lib/auth.providers.mjs +0 -136
  19. package/esm2022/lib/auth.service.mjs +0 -317
  20. package/esm2022/lib/auth.typings.mjs +0 -2
  21. package/esm2022/lib/components/auth-actions/auth-actions.component.mjs +0 -40
  22. package/esm2022/lib/components/auth-loading-screen/auth-loading-screen.component.mjs +0 -53
  23. package/esm2022/lib/components/index.mjs +0 -3
  24. package/esm2022/lib/directives/auth-action.directive.mjs +0 -30
  25. package/esm2022/lib/directives/index.mjs +0 -4
  26. package/esm2022/lib/directives/sign-in.directive.mjs +0 -52
  27. package/esm2022/lib/directives/sign-out.directive.mjs +0 -50
  28. package/esm2022/lib/helpers/create-auth-host-url.mjs +0 -18
  29. package/esm2022/lib/helpers/create-inititals.mjs +0 -32
  30. package/esm2022/lib/helpers/handle-auth-error.mjs +0 -31
  31. package/esm2022/lib/helpers/handle-oauth-event.mjs +0 -13
  32. package/esm2022/lib/helpers/index.mjs +0 -9
  33. package/esm2022/lib/helpers/resolve-email.mjs +0 -34
  34. package/esm2022/lib/helpers/resolve-username.mjs +0 -38
  35. package/esm2022/lib/helpers/set-http-auth-header.mjs +0 -22
  36. package/esm2022/lib/helpers/user-language-loader.mjs +0 -17
  37. package/esm2022/lib/models/auth-environment.mjs +0 -3
  38. package/esm2022/lib/models/auth-plugin-manager.mjs +0 -49
  39. package/esm2022/lib/models/authorized-handler.mjs +0 -2
  40. package/esm2022/lib/models/index.mjs +0 -5
  41. package/esm2022/lib/models/offline-auth-error-handler.mjs +0 -7
  42. package/esm2022/lib/plugins/core-debug.plugin.mjs +0 -29
  43. package/esm2022/lib/plugins/core-identity.plugin.mjs +0 -20
  44. package/esm2022/lib/plugins/index.mjs +0 -4
  45. package/esm2022/lib/plugins/user-profile-link.plugin.mjs +0 -18
  46. package/esm2022/lib/unauth.guard.mjs +0 -38
  47. package/esm2022/odx-auth.mjs +0 -5
  48. package/esm2022/plugins/service-connect/index.mjs +0 -9
  49. package/esm2022/plugins/service-connect/lib/dtos/get-service-connect-rights-response.dto.mjs +0 -2
  50. package/esm2022/plugins/service-connect/lib/dtos/get-service-connect-user-response.dto.mjs +0 -2
  51. package/esm2022/plugins/service-connect/lib/dtos/index.mjs +0 -3
  52. package/esm2022/plugins/service-connect/lib/helpers/build-service-connect-url.mjs +0 -16
  53. package/esm2022/plugins/service-connect/lib/helpers/has-roles-or-rights-handler.mjs +0 -12
  54. package/esm2022/plugins/service-connect/lib/helpers/has-roles-or-rights.mjs +0 -11
  55. package/esm2022/plugins/service-connect/lib/helpers/index.mjs +0 -5
  56. package/esm2022/plugins/service-connect/lib/helpers/service-connect-plugin-factory.mjs +0 -25
  57. package/esm2022/plugins/service-connect/lib/service-connect-rights.directive.mjs +0 -44
  58. package/esm2022/plugins/service-connect/lib/service-connect-rights.guard.mjs +0 -15
  59. package/esm2022/plugins/service-connect/lib/service-connect-rights.plugin.mjs +0 -16
  60. package/esm2022/plugins/service-connect/lib/service-connect-user-language.plugin.mjs +0 -34
  61. package/esm2022/plugins/service-connect/lib/service-connect-user-profile.plugin.mjs +0 -28
  62. package/esm2022/plugins/service-connect/lib/service-connect.config.mjs +0 -17
  63. package/esm2022/plugins/service-connect/odx-auth-plugins-service-connect.mjs +0 -5
  64. package/lib/auth.component.d.ts +0 -20
  65. package/lib/auth.config.d.ts +0 -84
  66. package/lib/auth.directive.d.ts +0 -25
  67. package/lib/auth.guard.d.ts +0 -11
  68. package/lib/auth.i18n.d.ts +0 -3
  69. package/lib/auth.interceptor.d.ts +0 -10
  70. package/lib/auth.logger.d.ts +0 -3
  71. package/lib/auth.module.d.ts +0 -10
  72. package/lib/auth.providers.d.ts +0 -46
  73. package/lib/auth.service.d.ts +0 -206
  74. package/lib/auth.typings.d.ts +0 -27
  75. package/lib/components/auth-actions/auth-actions.component.d.ts +0 -16
  76. package/lib/components/auth-loading-screen/auth-loading-screen.component.d.ts +0 -24
  77. package/lib/components/index.d.ts +0 -2
  78. package/lib/directives/auth-action.directive.d.ts +0 -18
  79. package/lib/directives/index.d.ts +0 -3
  80. package/lib/directives/sign-in.directive.d.ts +0 -29
  81. package/lib/directives/sign-out.directive.d.ts +0 -28
  82. package/lib/helpers/create-auth-host-url.d.ts +0 -14
  83. package/lib/helpers/create-inititals.d.ts +0 -18
  84. package/lib/helpers/handle-auth-error.d.ts +0 -13
  85. package/lib/helpers/handle-oauth-event.d.ts +0 -11
  86. package/lib/helpers/index.d.ts +0 -8
  87. package/lib/helpers/resolve-email.d.ts +0 -21
  88. package/lib/helpers/resolve-username.d.ts +0 -22
  89. package/lib/helpers/set-http-auth-header.d.ts +0 -11
  90. package/lib/helpers/user-language-loader.d.ts +0 -11
  91. package/lib/models/auth-environment.d.ts +0 -6
  92. package/lib/models/auth-plugin-manager.d.ts +0 -21
  93. package/lib/models/authorized-handler.d.ts +0 -3
  94. package/lib/models/index.d.ts +0 -4
  95. package/lib/models/offline-auth-error-handler.d.ts +0 -2
  96. package/lib/plugins/core-debug.plugin.d.ts +0 -11
  97. package/lib/plugins/core-identity.plugin.d.ts +0 -18
  98. package/lib/plugins/index.d.ts +0 -3
  99. package/lib/plugins/user-profile-link.plugin.d.ts +0 -18
  100. package/lib/unauth.guard.d.ts +0 -11
  101. package/plugins/service-connect/lib/dtos/get-service-connect-rights-response.dto.d.ts +0 -3
  102. package/plugins/service-connect/lib/dtos/get-service-connect-user-response.dto.d.ts +0 -14
  103. package/plugins/service-connect/lib/dtos/index.d.ts +0 -2
  104. package/plugins/service-connect/lib/helpers/build-service-connect-url.d.ts +0 -10
  105. package/plugins/service-connect/lib/helpers/has-roles-or-rights-handler.d.ts +0 -10
  106. package/plugins/service-connect/lib/helpers/has-roles-or-rights.d.ts +0 -11
  107. package/plugins/service-connect/lib/helpers/index.d.ts +0 -4
  108. package/plugins/service-connect/lib/helpers/service-connect-plugin-factory.d.ts +0 -20
  109. package/plugins/service-connect/lib/service-connect-rights.directive.d.ts +0 -21
  110. package/plugins/service-connect/lib/service-connect-rights.guard.d.ts +0 -11
  111. package/plugins/service-connect/lib/service-connect-rights.plugin.d.ts +0 -18
  112. package/plugins/service-connect/lib/service-connect-user-language.plugin.d.ts +0 -24
  113. package/plugins/service-connect/lib/service-connect-user-profile.plugin.d.ts +0 -23
  114. package/plugins/service-connect/lib/service-connect.config.d.ts +0 -15
@@ -1,18 +0,0 @@
1
- import { AuthPluginFactory } from '../models';
2
- declare global {
3
- namespace OdxAuth {
4
- interface AuthPluginResult {
5
- email: string;
6
- initials: string;
7
- username: string;
8
- }
9
- }
10
- }
11
- /**
12
- * Core identity plugin for authentication.
13
- *
14
- * This plugin extracts and processes identity claims from the authentication service.
15
- *
16
- * @returns {AuthPluginFactory} A factory function that returns an observable with the processed identity claims.
17
- */
18
- export declare const coreIdentityPlugin: AuthPluginFactory;
@@ -1,3 +0,0 @@
1
- export * from './core-debug.plugin';
2
- export * from './core-identity.plugin';
3
- export * from './user-profile-link.plugin';
@@ -1,18 +0,0 @@
1
- import { AuthPluginFactory } from '../models';
2
- declare global {
3
- namespace OdxAuth {
4
- interface AuthPluginResult {
5
- userProfileUrl: string;
6
- }
7
- }
8
- }
9
- /**
10
- * A plugin factory that generates a user profile URL plugin.
11
- *
12
- * This plugin retrieves the user profile URL from the authentication configuration.
13
- * If the user profile URL is not specified in the configuration, it falls back to
14
- * using the default URL for the current environment from `ODX_AUTH_USER_PROFILE_HOSTS`.
15
- *
16
- * @returns A function that returns an observable emitting an object containing the user profile URL.
17
- */
18
- export declare const userProfileUrlPlugin: AuthPluginFactory;
@@ -1,11 +0,0 @@
1
- import { CanActivateFn } from '@angular/router';
2
- import { AuthorizedHandler } from './models';
3
- /**
4
- * Guard function to prevent unauthorized access to routes.
5
- *
6
- * @param {AuthorizedHandler} authorizedHandler - Optional handler to check if the user is authorized.
7
- * @param {any[] | string} redirectTo - Optional URL or route to redirect unauthorized users to. Can be a string or an array of strings.
8
- * @param {boolean} isExternal - Optional flag to indicate if the redirection should be external. Defaults to false.
9
- * @returns {CanActivateFn} - A function that implements the CanActivateFn interface.
10
- */
11
- export declare function unauthGuard(authorizedHandler?: AuthorizedHandler, redirectTo?: any[] | string, isExternal?: boolean): CanActivateFn;
@@ -1,3 +0,0 @@
1
- export interface GetServiceConnectRightsResponseDto {
2
- rights: string[];
3
- }
@@ -1,14 +0,0 @@
1
- export interface GetServiceConnectUserResponseDto {
2
- user_id: string;
3
- first_name: string;
4
- last_name: string;
5
- language_code: string;
6
- preferred_language: string;
7
- country: string;
8
- institution_id: number;
9
- institution_name: string;
10
- institution_name_2?: string | null;
11
- institution_name_3?: string | null;
12
- account_number?: string | null;
13
- institution_shortname: string;
14
- }
@@ -1,2 +0,0 @@
1
- export * from './get-service-connect-rights-response.dto';
2
- export * from './get-service-connect-user-response.dto';
@@ -1,10 +0,0 @@
1
- import { AuthEnvironment } from '@odx/auth';
2
- import { ServiceConnectEnvironment } from '../service-connect.config';
3
- /**
4
- * Builds a service connect URL based on the provided environment and endpoints.
5
- *
6
- * @param {ServiceConnectEnvironment | AuthEnvironment} environment - The environment configuration which can be either a `ServiceConnectEnvironment` or `AuthEnvironment`.
7
- * @param {string[]} endpoints - A list of endpoint strings to be appended to the base URL.
8
- * @returns {string} - The constructed service connect URL as a string.
9
- */
10
- export declare function buildServiceConnectUrl(environment: ServiceConnectEnvironment | AuthEnvironment, ...endpoints: string[]): string;
@@ -1,10 +0,0 @@
1
- import { AuthorizedHandler } from '@odx/auth';
2
- import { RolesOrRights } from './has-roles-or-rights';
3
- /**
4
- * Creates an authorized handler that checks if the user has the specified roles or rights.
5
- *
6
- * @param {RolesOrRights} rolesOrRights - The roles or rights to check against the user's claims.
7
- * @returns {AuthorizedHandler} - An handler function that takes user claims and returns a boolean indicating
8
- * whether the user has the required roles or rights.
9
- */
10
- export declare function hasRolesOrRightsHandler(rolesOrRights: RolesOrRights): AuthorizedHandler;
@@ -1,11 +0,0 @@
1
- export type Right = string | number;
2
- export type Role = Right[];
3
- export type RolesOrRights = Array<Role | Right>;
4
- /**
5
- * Checks if the user has any of the specified roles or rights.
6
- *
7
- * @param {Right[]} userRights - An array of rights that the user possesses.
8
- * @param {RolesOrRights} rolesOrRights - An array of roles or rights to check against. A role is represented as an array of rights.
9
- * @returns {boolean} - `true` if the user has any of the specified roles or rights, otherwise `false`.
10
- */
11
- export declare function hasRolesOrRights(userRights: Right[], rolesOrRights: RolesOrRights): boolean;
@@ -1,4 +0,0 @@
1
- export * from './build-service-connect-url';
2
- export * from './has-roles-or-rights';
3
- export * from './has-roles-or-rights-handler';
4
- export * from './service-connect-plugin-factory';
@@ -1,20 +0,0 @@
1
- import { AuthPluginFactory } from '@odx/auth';
2
- import { ServiceConnectEnvironment } from '../service-connect.config';
3
- export interface ServiceConnectPluginOptions<Dto = unknown> {
4
- environment?: ServiceConnectEnvironment;
5
- additionalClaims?: (dto: (Dto & Record<string, unknown>) | null) => Partial<OdxAuth.AuthPluginResult>;
6
- }
7
- export interface ServiceConnectPluginFactoryOptions<Dto> {
8
- endpoint: string[];
9
- parseResponse: (res: Dto | null) => Partial<OdxAuth.AuthPluginResult>;
10
- defaultValue?: Partial<OdxAuth.AuthPluginResult>;
11
- setup?: (pluginOptions?: ServiceConnectPluginOptions<Dto>) => void;
12
- }
13
- export type ServiceConnectPluginFactory<Dto = unknown> = (pluginOptions?: ServiceConnectPluginOptions<Dto>) => AuthPluginFactory;
14
- /**
15
- * Creates a plugin factory for fetching and parsing service connect data.
16
- *
17
- * @param {ServiceConnectPluginFactoryOptions<Dto>} options - The options for the service connect plugin factory.
18
- * @returns {ServiceConnectPluginFactory} - A function that creates an auth plugin factory for fetching and parsing service connect data.
19
- */
20
- export declare function serviceConnectPluginFactory<Dto = unknown>(options: ServiceConnectPluginFactoryOptions<Dto>): ServiceConnectPluginFactory<Dto>;
@@ -1,21 +0,0 @@
1
- import { RolesOrRights } from './helpers';
2
- import * as i0 from "@angular/core";
3
- import * as i1 from "@odx/auth";
4
- /**
5
- * A directive that extends the functionality of the `AuthDirective` to handle
6
- * roles or rights for service connection authorization.
7
- *
8
- * @see AuthDirective
9
- *
10
- * This directive should be used on an `ng-template` element with the selector
11
- * `odxAuthServiceConnectRights`.
12
- */
13
- export declare class ServiceConnectRightsDirective {
14
- private readonly authDirective;
15
- /**
16
- * Sets the roles or rights that the user must have to display the content.
17
- */
18
- set rolesOrRights(value: RolesOrRights | null | undefined);
19
- static ɵfac: i0.ɵɵFactoryDeclaration<ServiceConnectRightsDirective, never>;
20
- static ɵdir: i0.ɵɵDirectiveDeclaration<ServiceConnectRightsDirective, "ng-template[odxAuthServiceConnectRights]", never, { "rolesOrRights": { "alias": "odxAuthServiceConnectRights"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.AuthDirective; inputs: { "odxAuthElse": "odxAuthServiceConnectRightsElse"; }; outputs: {}; }]>;
21
- }
@@ -1,11 +0,0 @@
1
- import { CanActivateFn } from '@angular/router';
2
- import { RolesOrRights } from './helpers';
3
- /**
4
- * A guard function to check if the user has the required roles or rights to access a route.
5
- *
6
- * @param {RolesOrRights} rolesOrRights - The roles or rights required to access the route.
7
- * @param {string | any[]} redirectTo - (Optional) The route to redirect to if the user does not have the required roles or rights.
8
- * @param {boolean} isExternal - (Optional) A flag indicating if the redirection is to an external URL. Defaults to `false`.
9
- * @returns {CanActivateFn} - A function that checks the user's roles or rights and handles redirection if necessary.
10
- */
11
- export declare function serviceConnectRightsGuard(rolesOrRights: RolesOrRights, redirectTo?: string | any[], isExternal?: boolean): CanActivateFn;
@@ -1,18 +0,0 @@
1
- import { GetServiceConnectRightsResponseDto } from './dtos';
2
- import { Right } from './helpers';
3
- declare global {
4
- namespace OdxAuth {
5
- interface AuthPluginResult {
6
- rights: Right[];
7
- }
8
- }
9
- }
10
- /**
11
- * A plugin for fetching and parsing service connect rights.
12
- *
13
- * This plugin uses the `serviceConnectPluginFactory` to create a plugin that fetches user rights
14
- * from the specified endpoint and parses the response to extract the rights.
15
- *
16
- * @see {serviceConnectPluginFactory}
17
- */
18
- export declare const serviceConnectRightsPlugin: import("./helpers").ServiceConnectPluginFactory<GetServiceConnectRightsResponseDto>;
@@ -1,24 +0,0 @@
1
- import { GetServiceConnectUserResponseDto } from './dtos';
2
- /**
3
- * Gets the preferred language from a service connect user response.
4
- *
5
- * @param {GetServiceConnectUserResponseDto | null} res - The service connect user response.
6
- * @returns {string | undefined} - The language or undefined.
7
- */
8
- export declare function getServiceConnectUserLanguage(res?: GetServiceConnectUserResponseDto | null): string | undefined;
9
- /**
10
- * Gets the language code from a service connect user response.
11
- *
12
- * @param {GetServiceConnectUserResponseDto | null} res - The service connect user response.
13
- * @returns {string | undefined} - The language code or undefined.
14
- */
15
- export declare function getServiceConnectUserLanguageCode(res?: GetServiceConnectUserResponseDto | null): string | undefined;
16
- /**
17
- * A plugin for fetching and parsing the user's preferred language from service connect.
18
- *
19
- * This plugin uses the `serviceConnectPluginFactory` to create a plugin that fetches the user's preferred language
20
- * from the user endpoint and parses the response to extract the preferred language.
21
- *
22
- * @see {serviceConnectPluginFactory}
23
- */
24
- export declare const serviceConnectUserLanguagePlugin: import("./helpers").ServiceConnectPluginFactory<GetServiceConnectUserResponseDto>;
@@ -1,23 +0,0 @@
1
- import { GetServiceConnectUserResponseDto } from './dtos';
2
- declare global {
3
- namespace OdxAuth {
4
- interface AuthPluginResult {
5
- country?: string;
6
- institutionId?: number;
7
- institutionName?: string;
8
- institutionName2?: string;
9
- institutionName3?: string;
10
- institutionShortname?: string;
11
- accountNumber?: string;
12
- }
13
- }
14
- }
15
- /**
16
- * A plugin for fetching and parsing the user's profile from service connect.
17
- *
18
- * This plugin uses the `serviceConnectPluginFactory` to create a plugin that fetches the user's profile
19
- * from the user endpoint and parses the response to extract the user's profile information.
20
- *
21
- * @see {serviceConnectPluginFactory}
22
- */
23
- export declare const serviceConnectUserProfilePlugin: import("./helpers").ServiceConnectPluginFactory<GetServiceConnectUserResponseDto>;
@@ -1,15 +0,0 @@
1
- import { AuthEnvironment } from '@odx/auth';
2
- export type ServiceConnectEnvironment = {
3
- custom: string;
4
- };
5
- export declare const ServiceConnectEnvironments: Record<AuthEnvironment, string>;
6
- export declare const ServiceConnectScopes: {
7
- BASE: string;
8
- PROFILE: string;
9
- RIGHTS: string;
10
- INSTITUTION: string;
11
- };
12
- export declare const ServiceConnectEndpoints: {
13
- user: string;
14
- userRights: string;
15
- };