@odx/auth 4.0.7 → 5.1.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.
- package/README.md +3 -0
- package/esm2020/index.mjs +1 -1
- package/esm2020/lib/auth.component.mjs +4 -4
- package/esm2020/lib/auth.config.mjs +4 -3
- package/esm2020/lib/auth.directive.mjs +4 -4
- package/esm2020/lib/auth.guard.mjs +1 -1
- package/esm2020/lib/auth.i18n.mjs +1 -1
- package/esm2020/lib/auth.module.mjs +5 -5
- package/esm2020/lib/auth.providers.mjs +8 -7
- package/esm2020/lib/auth.service.mjs +42 -37
- package/esm2020/lib/auth.typings.mjs +1 -1
- package/esm2020/lib/components/auth-actions/auth-actions.component.mjs +4 -4
- package/esm2020/lib/components/auth-loading-screen/auth-loading-screen.component.mjs +6 -6
- package/esm2020/lib/components/index.mjs +1 -1
- package/esm2020/lib/directives/auth-action.directive.mjs +6 -6
- package/esm2020/lib/directives/index.mjs +1 -1
- package/esm2020/lib/directives/sign-in.directive.mjs +4 -4
- package/esm2020/lib/directives/sign-out.directive.mjs +4 -4
- package/esm2020/lib/helpers/create-inititals.mjs +1 -1
- package/esm2020/lib/helpers/handle-auth-error.mjs +1 -1
- package/esm2020/lib/helpers/handle-oauth-event.mjs +1 -1
- package/esm2020/lib/helpers/index.mjs +1 -1
- package/esm2020/lib/helpers/resolve-email.mjs +1 -1
- package/esm2020/lib/helpers/resolve-username.mjs +1 -1
- package/esm2020/lib/models/auth-environment.mjs +1 -1
- package/esm2020/lib/models/auth-http-cache.mjs +4 -4
- package/esm2020/lib/models/auth-plugin-manager.mjs +10 -5
- package/esm2020/lib/models/authorized-handler.mjs +1 -1
- package/esm2020/lib/models/index.mjs +1 -1
- package/esm2020/lib/models/offline-auth-error-handler.mjs +1 -1
- package/esm2020/lib/plugins/core-identity.plugin.mjs +1 -1
- package/esm2020/lib/plugins/index.mjs +1 -2
- package/esm2020/lib/plugins/user-profile-link.plugin.mjs +1 -1
- package/esm2020/lib/unauth.guard.mjs +1 -1
- package/esm2020/odx-auth.mjs +1 -1
- package/esm2020/plugins/service-connect/index.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/dtos/get-service-connect-rights-response.dto.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/dtos/index.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/helpers/build-service-connect-url.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/helpers/has-roles-or-rights-handler.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/helpers/has-roles-or-rights.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/helpers/index.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/helpers/service-connect-plugin-factory.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/service-connect-rights.directive.mjs +4 -4
- package/esm2020/plugins/service-connect/lib/service-connect-rights.guard.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/service-connect-rights.plugin.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/service-connect.config.mjs +1 -1
- package/esm2020/plugins/service-connect/lib/service-connect.typings.mjs +1 -1
- package/esm2020/plugins/service-connect/odx-auth-plugins-service-connect.mjs +1 -1
- package/fesm2015/odx-auth-plugins-service-connect.mjs +3 -3
- package/fesm2015/odx-auth-plugins-service-connect.mjs.map +1 -1
- package/fesm2015/odx-auth.mjs +93 -87
- package/fesm2015/odx-auth.mjs.map +1 -1
- package/fesm2020/odx-auth-plugins-service-connect.mjs +3 -3
- package/fesm2020/odx-auth-plugins-service-connect.mjs.map +1 -1
- package/fesm2020/odx-auth.mjs +89 -90
- package/fesm2020/odx-auth.mjs.map +1 -1
- package/lib/auth.config.d.ts +2 -1
- package/lib/auth.service.d.ts +5 -2
- package/lib/auth.typings.d.ts +0 -4
- package/lib/plugins/index.d.ts +0 -1
- package/package.json +1 -1
- package/esm2020/lib/plugins/loading-screen-plugin.mjs +0 -16
- package/lib/plugins/loading-screen-plugin.d.ts +0 -2
|
@@ -12,4 +12,4 @@ export function serviceConnectPluginFactory(options) {
|
|
|
12
12
|
return () => defer(() => httpCache.request(url, true)).pipe(map((dto) => parseResponse(dto)));
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS1jb25uZWN0LXBsdWdpbi1mYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9hdXRoL3BsdWdpbnMvc2VydmljZS1jb25uZWN0L3NyYy9saWIvaGVscGVycy9zZXJ2aWNlLWNvbm5lY3QtcGx1Z2luLWZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN2QyxPQUFPLEVBQUUsYUFBYSxFQUFxQixnQkFBZ0IsRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUMvRSxPQUFPLEVBQUUsS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUVsQyxPQUFPLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQWVyRSxNQUFNLFVBQVUsMkJBQTJCLENBQWdCLE9BQWdEO0lBQ3pHLE9BQU8sQ0FBQyxhQUFhLEVBQUUsRUFBRSxDQUFDLEdBQUcsRUFBRTtRQUM3QixPQUFPLENBQUMsS0FBSyxFQUFFLENBQUMsYUFBYSxDQUFDLENBQUM7UUFDL0IsTUFBTSxFQUFFLFdBQVcsRUFBRSxHQUFHLGdCQUFnQixFQUFFLENBQUM7UUFDM0MsTUFBTSxTQUFTLEdBQUcsTUFBTSxDQUFDLGFBQWEsQ0FBQyxDQUFDO1FBQ3hDLE1BQU0sR0FBRyxHQUFHLHNCQUFzQixDQUFDLGFBQWEsR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pbnQpO1xuICAgIGNvbnN0IHBhcnNlUmVzcG9uc2UgPSAoZHRvOiBEdG8gfCBudWxsKSA9PiBvcHRpb25zLnBhcnNlUmVzcG9uc2UoZHRvKSA/PyBvcHRpb25zLmRlZmF1bHRWYWx1ZSA/PyB7fTtcblxuICAgIHJldHVybiAoKSA9PiBkZWZlcigoKSA9PiBodHRwQ2FjaGUucmVxdWVzdDxEdG8+KHVybCwgdHJ1ZSkpLnBpcGUobWFwKChkdG8pID0+IHBhcnNlUmVzcG9uc2UoZHRvKSkpO1xuICB9O1xufVxuIl19
|
|
@@ -11,9 +11,9 @@ export class ServiceConnectRightsDirective {
|
|
|
11
11
|
this.authDirective.authorizationHandler = hasRolesOrRightsHandler(value ?? []);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
ServiceConnectRightsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
15
|
-
ServiceConnectRightsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
14
|
+
ServiceConnectRightsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ServiceConnectRightsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
15
|
+
ServiceConnectRightsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ServiceConnectRightsDirective, isStandalone: true, selector: "ng-template[odxAuthServiceConnectRights]", inputs: { rolesOrRights: ["odxAuthServiceConnectRights", "rolesOrRights"] }, hostDirectives: [{ directive: i1.AuthDirective, inputs: ["odxAuthElse", "odxAuthServiceConnectRightsElse"] }], ngImport: i0 });
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ServiceConnectRightsDirective, decorators: [{
|
|
17
17
|
type: Directive,
|
|
18
18
|
args: [{
|
|
19
19
|
standalone: true,
|
|
@@ -29,4 +29,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
29
29
|
type: Input,
|
|
30
30
|
args: ['odxAuthServiceConnectRights']
|
|
31
31
|
}] } });
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS1jb25uZWN0LXJpZ2h0cy5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJzL2F1dGgvcGx1Z2lucy9zZXJ2aWNlLWNvbm5lY3Qvc3JjL2xpYi9zZXJ2aWNlLWNvbm5lY3QtcmlnaHRzLmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekQsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUMxQyxPQUFPLEVBQUUsdUJBQXVCLEVBQWlCLE1BQU0sV0FBVyxDQUFDOzs7QUFZbkUsTUFBTSxPQUFPLDZCQUE2QjtJQVYxQztRQVdtQixrQkFBYSxHQUFHLE1BQU0sQ0FBQyxhQUFhLEVBQUUsRUFBRSxJQUFJLEVBQUUsSUFBSSxFQUFFLENBQUMsQ0FBQztLQU14RTtJQUpDLElBQ1csYUFBYSxDQUFDLEtBQXVDO1FBQzlELElBQUksQ0FBQyxhQUFhLENBQUMsb0JBQW9CLEdBQUcsdUJBQXVCLENBQUMsS0FBSyxJQUFJLEVBQUUsQ0FBQyxDQUFDO0lBQ2pGLENBQUM7OzJIQU5VLDZCQUE2QjsrR0FBN0IsNkJBQT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vbm5lY3RSaWdodHMnKVxuICBwdWJsaWMgc2V0IHJvbGVzT3JSaWdodHModmFsdWU6IFJvbGVzT3JSaWdodHMgfCBudWxsIHwgdW5kZWZpbmVkKSB7XG4gICAgdGhpcy5hdXRoRGlyZWN0aXZlLmF1dGhvcml6YXRpb25IYW5kbGVyID0gaGFzUm9sZXNPclJpZ2h0c0hhbmRsZXIodmFsdWUgPz8gW10pO1xuICB9XG59XG4iXX0=
|
|
@@ -4,4 +4,4 @@ import { hasRolesOrRightsHandler } from './helpers';
|
|
|
4
4
|
export function serviceConnectRightsGuard(rolesOrRights, redirectTo) {
|
|
5
5
|
return authGuard(hasRolesOrRightsHandler(rolesOrRights), redirectTo);
|
|
6
6
|
}
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS1jb25uZWN0LXJpZ2h0cy5ndWFyZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYXV0aC9wbHVnaW5zL3NlcnZpY2UtY29ubmVjdC9zcmMvbGliL3NlcnZpY2UtY29ubmVjdC1yaWdodHMuZ3VhcmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUN0QyxPQUFPLEVBQUUsdUJBQXVCLEVBQWlCLE1BQU0sV0FBVyxDQUFDO0FBRW5FLDhEQUE4RDtBQUM5RCxNQUFNLFVBQVUseUJBQXlCLENBQUMsYUFBNEIsRUFBRSxVQUEyQjtJQUNqRyxPQUFPLFNBQVMsQ0FBQyx1QkFBdUIsQ0FBQyxhQUFhLENBQUMsRUFBRSxVQUFVLENBQUMsQ0FBQztBQUN2RSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQ2FuQWN0aXZhdGVGbiB9IGZyb20gJ0Bhbmd1bGFyL3JvdXRlcic7XG5pbXBvcnQgeyBhdXRoR3VhcmQgfSBmcm9tICdAb2R4L2F1dGgnO1xuaW1wb3J0IHsgaGFzUm9sZXNPclJpZ2h0c0hhbmRsZXIsIFJvbGVzT3JSaWdodHMgfSBmcm9tICcuL2hlbHBlcnMnO1xuXG4vLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLWV4cGxpY2l0LWFueVxuZXhwb3J0IGZ1bmN0aW9uIHNlcnZpY2VDb25uZWN0UmlnaHRzR3VhcmQocm9sZXNPclJpZ2h0czogUm9sZXNPclJpZ2h0cywgcmVkaXJlY3RUbz86IHN0cmluZyB8IGFueVtdKTogQ2FuQWN0aXZhdGVGbiB7XG4gIHJldHVybiBhdXRoR3VhcmQoaGFzUm9sZXNPclJpZ2h0c0hhbmRsZXIocm9sZXNPclJpZ2h0cyksIHJlZGlyZWN0VG8pO1xufVxuIl19
|
|
@@ -6,4 +6,4 @@ export const serviceConnectRightsPlugin = serviceConnectPluginFactory({
|
|
|
6
6
|
parseResponse: (res) => ({ rights: res?.rights ?? [] }),
|
|
7
7
|
defaultValue: { rights: [] },
|
|
8
8
|
});
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS1jb25uZWN0LXJpZ2h0cy5wbHVnaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJzL2F1dGgvcGx1Z2lucy9zZXJ2aWNlLWNvbm5lY3Qvc3JjL2xpYi9zZXJ2aWNlLWNvbm5lY3QtcmlnaHRzLnBsdWdpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSx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XVsdFZhbHVlOiB7IHJpZ2h0czogW10gfSxcbn0pO1xuIl19
|
|
@@ -12,4 +12,4 @@ export const ServiceConnectScopes = {
|
|
|
12
12
|
export const ServiceConnectEndpoints = {
|
|
13
13
|
userRights: '/users/me/rights',
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS1jb25uZWN0LmNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYXV0aC9wbHVnaW5zL3NlcnZpY2UtY29ubmVjdC9zcmMvbGliL3NlcnZpY2UtY29ubmVjdC5jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsTUFBTSxDQUFDLE1BQU0sMkJBQTJCLEdBQW9DO0lBQzFFLEdBQUcsRUFBRSxzQ0FBc0M7SUFDM0MsS0FBSyxFQUFFLHlDQUF5QztJQUNoRCxJQUFJLEVBQUUsaUNBQWlDO0NBQ3hDLENBQUM7QUFDRixNQUFNLENBQUMsTUFBTSxvQkFBb0IsR0FBRztJQUNsQyxJQUFJLEVBQUUsTUFBTTtJQUNaLE9BQU8sRUFBRSxjQUFjO0lBQ3ZCLE1BQU0sRUFBRSxhQUFhO0lBQ3JCLFdBQVcsRUFBRSxrQkFBa0I7Q0FDaEMsQ0FBQztBQUNGLE1BQU0sQ0FBQyxNQUFNLHVCQUF1QixHQUFHO0lBQ3JDLFVBQVUsRUFBRSxrQkFBa0I7Q0FDL0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEF1dGhFbnZpcm9ubWVudCB9IGZyb20gJ0BvZHgvYXV0aCc7XG5cbmV4cG9ydCB0eXBlIFNlcnZpY2VDb25uZWN0RW52aXJvbm1lbnQgPSB7IGN1c3RvbTogc3RyaW5nIH07XG5leHBvcnQgY29uc3QgU2VydmljZUNvbm5uZWN0RW52aXJvbm1lbnRzOiBSZWNvcmQ8QXV0aEVudmlyb25tZW50LCBzdHJpbmc+ID0ge1xuICBkZXY6ICdodHRwczovL2FwaS50ZXN0LmNvbm5lY3QuZHJhZWdlci5jb20nLFxuICBzdGFnZTogJ2h0dHBzOi8vYXBpLnN0YWdpbmcuY29ubmVjdC5kcmFlZ2VyLmNvbScsXG4gIHByb2Q6ICdodHRwczovL2FwaS5jb25uZWN0LmRyYWVnZXIuY29tJyxcbn07XG5leHBvcnQgY29uc3QgU2VydmljZUNvbm5lY3RTY29wZXMgPSB7XG4gIEJBU0U6ICdkY2lkJyxcbiAgUFJPRklMRTogJ2RjaWQucHJvZmlsZScsXG4gIFJJR0hUUzogJ2RjaWQucmlnaHRzJyxcbiAgSU5TVElUVVRJT046ICdkY2lkLmluc3RpdHV0aW9uJyxcbn07XG5leHBvcnQgY29uc3QgU2VydmljZUNvbm5lY3RFbmRwb2ludHMgPSB7XG4gIHVzZXJSaWdodHM6ICcvdXNlcnMvbWUvcmlnaHRzJyxcbn07XG4iXX0=
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS1jb25uZWN0LnR5cGluZ3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJzL2F1dGgvcGx1Z2lucy9zZXJ2aWNlLWNvbm5lY3Qvc3JjL2xpYi9zZXJ2aWNlLWNvbm5lY3QudHlwaW5ncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgUmlnaHQgfSBmcm9tICcuL2hlbHBlcnMnO1xuXG5kZWNsYXJlIGdsb2JhbCB7XG4gIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tbmFtZXNwYWNlXG4gIG5hbWVzcGFjZSBPZHhBdXRoIHtcbiAgICBpbnRlcmZhY2UgQXV0aFBsdWdpblJlc3VsdCB7XG4gICAgICByaWdodHM6IFJpZ2h0W107XG4gICAgfVxuICB9XG59XG5cbmV4cG9ydCB7fTtcbiJdfQ==
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Generated bundle index. Do not edit.
|
|
3
3
|
*/
|
|
4
4
|
export * from './index';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib2R4LWF1dGgtcGx1Z2lucy1zZXJ2aWNlLWNvbm5lY3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2F1dGgvcGx1Z2lucy9zZXJ2aWNlLWNvbm5lY3Qvc3JjL29keC1hdXRoLXBsdWdpbnMtc2VydmljZS1jb25uZWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|
|
@@ -55,9 +55,9 @@ class ServiceConnectRightsDirective {
|
|
|
55
55
|
this.authDirective.authorizationHandler = hasRolesOrRightsHandler(value !== null && value !== void 0 ? value : []);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
ServiceConnectRightsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
59
|
-
ServiceConnectRightsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
60
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
58
|
+
ServiceConnectRightsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ServiceConnectRightsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
59
|
+
ServiceConnectRightsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ServiceConnectRightsDirective, isStandalone: true, selector: "ng-template[odxAuthServiceConnectRights]", inputs: { rolesOrRights: ["odxAuthServiceConnectRights", "rolesOrRights"] }, hostDirectives: [{ directive: i1.AuthDirective, inputs: ["odxAuthElse", "odxAuthServiceConnectRightsElse"] }], ngImport: i0 });
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ServiceConnectRightsDirective, decorators: [{
|
|
61
61
|
type: Directive,
|
|
62
62
|
args: [{
|
|
63
63
|
standalone: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-auth-plugins-service-connect.mjs","sources":["../../../../
|
|
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/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 dev: 'https://api.test.connect.draeger.com',\n stage: 'https://api.staging.connect.draeger.com',\n 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 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\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\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\nexport function hasRolesOrRightsHandler(rolesOrRights: RolesOrRights): AuthorizedHandler {\n return (claims) => hasRolesOrRights(claims?.rights ?? [], rolesOrRights);\n}\n","import { inject } from '@angular/core';\nimport { AuthHttpCache, AuthPluginFactory, injectAuthConfig } 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\nexport function serviceConnectPluginFactory<Dto = unknown>(options: ServiceConnectPluginFactoryOptions<Dto>): ServiceConnectPluginFactory {\n return (pluginOptions) => () => {\n options.setup?.(pluginOptions);\n const { environment } = injectAuthConfig();\n const httpCache = inject(AuthHttpCache);\n const url = buildServiceConnectUrl(pluginOptions?.environment ?? environment, ...options.endpoint);\n const parseResponse = (dto: Dto | null) => options.parseResponse(dto) ?? options.defaultValue ?? {};\n\n return () => defer(() => httpCache.request<Dto>(url, true)).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@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 @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// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function serviceConnectRightsGuard(rolesOrRights: RolesOrRights, redirectTo?: string | any[]): CanActivateFn {\n return authGuard(hasRolesOrRightsHandler(rolesOrRights), redirectTo);\n}\n","import { GetServiceConnectRightsResponseDto } from './dtos';\nimport { serviceConnectPluginFactory } from './helpers';\nimport { ServiceConnectEndpoints } from './service-connect.config';\nimport './service-connect.typings';\n\nexport const serviceConnectRightsPlugin = serviceConnectPluginFactory<GetServiceConnectRightsResponseDto>({\n endpoint: [ServiceConnectEndpoints.userRights],\n parseResponse: (res) => ({ rights: res?.rights ?? [] }),\n defaultValue: { rights: [] },\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAGa,MAAA,2BAA2B,GAAoC;AAC1E,IAAA,GAAG,EAAE,sCAAsC;AAC3C,IAAA,KAAK,EAAE,yCAAyC;AAChD,IAAA,IAAI,EAAE,iCAAiC;EACvC;AACW,MAAA,oBAAoB,GAAG;AAClC,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,cAAc;AACvB,IAAA,MAAM,EAAE,aAAa;AACrB,IAAA,WAAW,EAAE,kBAAkB;EAC/B;AACW,MAAA,uBAAuB,GAAG;AACrC,IAAA,UAAU,EAAE,kBAAkB;;;SCXhB,sBAAsB,CAAC,WAAwD,EAAE,GAAG,SAAmB,EAAA;AACrH,IAAA,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE;QACzB,OAAO,QAAQ,CAAC,2BAA2B,CAAC,WAAW,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC;AACzE,KAAA;IACD,OAAO,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AACpD;;ACLgB,SAAA,gBAAgB,CAAC,UAAmB,EAAE,aAA4B,EAAA;IAChF,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,OAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,0CAAE,KAAK,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA,EAAA,CAAC,CAAC;AACnI;;ACHM,SAAU,uBAAuB,CAAC,aAA4B,E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AACF,qBAAA;iBACF,CAAA;8BAKY,aAAa,EAAA,CAAA;sBADvB,KAAK;uBAAC,6BAA6B,CAAA;;;ACbtC;AACgB,SAAA,yBAAyB,CAAC,aAA4B,EAAE,UAA2B,EAAA;IACjG,OAAO,SAAS,CAAC,uBAAuB,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC;AACvE;;ACFO,MAAM,0BAA0B,GAAG,2BAA2B,CAAqC;AACxG,IAAA,QAAQ,EAAE,CAAC,uBAAuB,CAAC,UAAU,CAAC;IAC9C,aAAa,EAAE,CAAC,GAAG,eAAK,QAAC,EAAE,MAAM,EAAE,CAAA,EAAA,GAAA,GAAG,KAAH,IAAA,IAAA,GAAG,KAAH,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,GAAG,CAAE,MAAM,mCAAI,EAAE,EAAE,EAAC,EAAA;AACvD,IAAA,YAAY,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;AAC7B,CAAA;;ACTD;;AAEG;;;;"}
|
package/fesm2015/odx-auth.mjs
CHANGED
|
@@ -12,12 +12,11 @@ import { LogoDirective } from '@odx/angular/components/logo';
|
|
|
12
12
|
import { TranslatePipe, provideTranslations } from '@odx/angular/internal/translate';
|
|
13
13
|
import { isString, createConfigTokens, injectElement, untilDestroyed, Position, buildUrl } from '@odx/angular/utils';
|
|
14
14
|
import { OAuthErrorEvent, OAuthService, provideOAuthClient, OAuthModuleConfig, OAuthStorage } from 'angular-oauth2-oidc';
|
|
15
|
-
import { filter, switchMap, BehaviorSubject, map, distinctUntilChanged, share, of, combineLatest, catchError, tap, take, fromEvent, startWith,
|
|
15
|
+
import { filter, switchMap, BehaviorSubject, map, distinctUntilChanged, share, of, combineLatest, catchError, tap, take, fromEvent, startWith, shareReplay, merge, EMPTY } from 'rxjs';
|
|
16
16
|
import { __awaiter, __decorate } from 'tslib';
|
|
17
17
|
import { HttpErrorResponse } from '@angular/common/http';
|
|
18
18
|
import { Router } from '@angular/router';
|
|
19
19
|
import { deepmerge } from 'deepmerge-ts';
|
|
20
|
-
import jwtDecode from 'jwt-decode';
|
|
21
20
|
import * as i2 from '@odx/angular/components/list';
|
|
22
21
|
import { ListModule } from '@odx/angular/components/list';
|
|
23
22
|
import { CSSComponent } from '@odx/angular/internal';
|
|
@@ -142,11 +141,12 @@ const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = c
|
|
|
142
141
|
createInitials,
|
|
143
142
|
resolveEmail,
|
|
144
143
|
resolveUsername,
|
|
145
|
-
showRedirectOverlay: false,
|
|
146
144
|
plugins: [],
|
|
147
145
|
defaultAuthorizedHandler: null,
|
|
148
|
-
enableLoadingScreen:
|
|
146
|
+
enableLoadingScreen: true,
|
|
149
147
|
loadingScreenMessage: null,
|
|
148
|
+
refreshTokenOnInit: true,
|
|
149
|
+
requireSignIn: false,
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
var translations = {
|
|
@@ -206,9 +206,9 @@ class AuthHttpCache {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
AuthHttpCache.CACHE_KEY = '@odx/auth/http-cache';
|
|
209
|
-
AuthHttpCache.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
210
|
-
AuthHttpCache.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
|
211
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
209
|
+
AuthHttpCache.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthHttpCache, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
210
|
+
AuthHttpCache.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthHttpCache, providedIn: 'root' });
|
|
211
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthHttpCache, decorators: [{
|
|
212
212
|
type: Injectable,
|
|
213
213
|
args: [{ providedIn: 'root' }]
|
|
214
214
|
}], ctorParameters: function () { return []; } });
|
|
@@ -225,7 +225,12 @@ class AuthPluginManager {
|
|
|
225
225
|
if (this.plugins.length < 1) {
|
|
226
226
|
return of({});
|
|
227
227
|
}
|
|
228
|
-
return authService.isInitialized$.pipe(switchMap(() =>
|
|
228
|
+
return authService.isInitialized$.pipe(switchMap(() => {
|
|
229
|
+
if (!authService.getAccessToken()) {
|
|
230
|
+
return of({});
|
|
231
|
+
}
|
|
232
|
+
return combineLatest(this.plugins.map((plugin) => plugin(authService).pipe(catchError(this.handlePluginError.bind(this))))).pipe(map((results) => deepmerge(...results)));
|
|
233
|
+
}), tap((result) => this.result$$.next(result)), take(1));
|
|
229
234
|
}
|
|
230
235
|
getResult() {
|
|
231
236
|
var _a;
|
|
@@ -237,9 +242,9 @@ class AuthPluginManager {
|
|
|
237
242
|
return of({});
|
|
238
243
|
}
|
|
239
244
|
}
|
|
240
|
-
AuthPluginManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
241
|
-
AuthPluginManager.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
|
242
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
245
|
+
AuthPluginManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthPluginManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
246
|
+
AuthPluginManager.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthPluginManager, providedIn: 'root' });
|
|
247
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthPluginManager, decorators: [{
|
|
243
248
|
type: Injectable,
|
|
244
249
|
args: [{ providedIn: 'root' }]
|
|
245
250
|
}] });
|
|
@@ -262,52 +267,41 @@ class AuthService {
|
|
|
262
267
|
this.isInitialized$$ = new BehaviorSubject(false);
|
|
263
268
|
this.isRedirecting$$ = new BehaviorSubject(false);
|
|
264
269
|
this.onAccessTokenUpdate$ = fromEvent(this.windowRef.nativeWindow, 'storage').pipe(filter(({ key }) => key === 'access_token' || key === null), startWith(null), share());
|
|
270
|
+
this.silentRefreshHandler$ = this.isInitialized$$.pipe(filter(Boolean), switchMap(() => this.windowRef.isOnline$), tap((isOnline) => this.updateSilentRefresh(isOnline)));
|
|
265
271
|
this.onAuthStateChange$ = combineLatest([this.oauthService.events.pipe(startWith(null)), this.windowRef.isOnline$, this.onAccessTokenUpdate$]);
|
|
266
272
|
this.isInitialized$ = this.isInitialized$$.pipe(filter(Boolean), distinctUntilChanged());
|
|
267
|
-
this.isRedirecting$ = this.isRedirecting$$.pipe(distinctUntilChanged(),
|
|
273
|
+
this.isRedirecting$ = this.isRedirecting$$.pipe(distinctUntilChanged(), shareReplay({ refCount: true }));
|
|
268
274
|
this.isLoading$ = merge(this.isRedirecting$, this.authPluginManager.pluginsLoading$).pipe(distinctUntilChanged());
|
|
269
275
|
this.isAuthenticated$ = this.isInitialized$.pipe(switchMap(() => this.authPluginManager.pluginsReady$), switchMap(() => this.onAuthStateChange$), map(() => this.isAuthenticated()), shareReplay({ refCount: true }));
|
|
270
276
|
this.identityClaims$ = this.isAuthenticated$.pipe(map(() => this.getIdentityClaims()), shareReplay({ refCount: true }));
|
|
271
277
|
this.errors$ = this.oauthService.events.pipe(filter((event) => event instanceof OAuthErrorEvent), share());
|
|
272
|
-
const isOnline$ = this.isInitialized$.pipe(filter(Boolean), switchMap(() => this.windowRef.isOnline$));
|
|
273
|
-
isOnline$.subscribe((isOnline) => {
|
|
274
|
-
if (isOnline) {
|
|
275
|
-
this.oauthService.setupAutomaticSilentRefresh();
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
this.oauthService.stopAutomaticRefresh();
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
278
|
this.authPluginManager.runPlugins(this).subscribe();
|
|
279
|
+
this.silentRefreshHandler$.subscribe();
|
|
282
280
|
}
|
|
283
281
|
initialize(config) {
|
|
284
282
|
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
+
this.assertAudience(config.clientId);
|
|
285
284
|
this.oauthService.configure(Object.assign(Object.assign({}, config), { openUri: this.redirectToLogin.bind(this) }));
|
|
286
285
|
try {
|
|
287
286
|
yield this.oauthService.loadDiscoveryDocument(this.authConfig.discoveryUrl);
|
|
288
287
|
yield this.oauthService.tryLogin();
|
|
289
|
-
|
|
290
|
-
yield this.oauthService.refreshToken();
|
|
291
|
-
}
|
|
292
|
-
this.isInitialized$$.next(true);
|
|
293
|
-
if (this.authConfig.loadUserProfile && this.oauthService.hasValidAccessToken()) {
|
|
294
|
-
yield this.loadUserProfile();
|
|
295
|
-
}
|
|
288
|
+
yield this.tryRefreshToken();
|
|
296
289
|
}
|
|
297
290
|
catch (error) {
|
|
298
291
|
if (!(error instanceof HttpErrorResponse || error instanceof OAuthErrorEvent)) {
|
|
299
292
|
throw error;
|
|
300
293
|
}
|
|
301
|
-
|
|
302
|
-
if (error.type === 'token_refresh_error' || isUnauthenticated) {
|
|
294
|
+
if (error.type === 'token_refresh_error' || (error instanceof HttpErrorResponse && error.status === 401)) {
|
|
303
295
|
this.signOut(true);
|
|
304
296
|
this.signIn(this.windowRef.location.pathname);
|
|
305
297
|
}
|
|
306
|
-
this.isInitialized$$.next(true);
|
|
307
298
|
}
|
|
308
|
-
|
|
309
|
-
|
|
299
|
+
this.isInitialized$$.next(true);
|
|
300
|
+
if (this.authConfig.requireSignIn && !this.isAuthenticated()) {
|
|
301
|
+
this.signIn(this.windowRef.location.pathname);
|
|
310
302
|
}
|
|
303
|
+
yield this.tryLoadUserProfile();
|
|
304
|
+
yield this.routeToRequestedUrl();
|
|
311
305
|
});
|
|
312
306
|
}
|
|
313
307
|
getIssuer() {
|
|
@@ -334,10 +328,6 @@ class AuthService {
|
|
|
334
328
|
var _a;
|
|
335
329
|
return (_a = this.oauthService.getAccessToken()) !== null && _a !== void 0 ? _a : null;
|
|
336
330
|
}
|
|
337
|
-
getAccessTokenPayload() {
|
|
338
|
-
const token = this.getAccessToken();
|
|
339
|
-
return token ? jwtDecode(token) : null;
|
|
340
|
-
}
|
|
341
331
|
getRefreshToken() {
|
|
342
332
|
var _a;
|
|
343
333
|
return (_a = this.oauthService.getRefreshToken()) !== null && _a !== void 0 ? _a : null;
|
|
@@ -372,7 +362,7 @@ class AuthService {
|
|
|
372
362
|
}
|
|
373
363
|
routeToRequestedUrl() {
|
|
374
364
|
return __awaiter(this, void 0, void 0, function* () {
|
|
375
|
-
if (!this.oauthService.state)
|
|
365
|
+
if (!this.oauthService.state || !this.oauthService.hasValidAccessToken())
|
|
376
366
|
return;
|
|
377
367
|
yield this.router.navigateByUrl(decodeURIComponent(this.oauthService.state));
|
|
378
368
|
});
|
|
@@ -386,10 +376,39 @@ class AuthService {
|
|
|
386
376
|
this.windowRef.location.assign(uri);
|
|
387
377
|
this.isRedirecting$$.next(true);
|
|
388
378
|
}
|
|
379
|
+
tryRefreshToken() {
|
|
380
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
381
|
+
if (!this.authConfig.refreshTokenOnInit || !this.getRefreshToken())
|
|
382
|
+
return;
|
|
383
|
+
yield this.oauthService.refreshToken();
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
tryLoadUserProfile() {
|
|
387
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
388
|
+
if (!this.authConfig.loadUserProfile || !this.oauthService.hasValidAccessToken())
|
|
389
|
+
return;
|
|
390
|
+
yield this.loadUserProfile().catch(() => null);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
assertAudience(clientId) {
|
|
394
|
+
var _a;
|
|
395
|
+
const tokenClientId = (_a = this.getIdentityClaims()) === null || _a === void 0 ? void 0 : _a.aud;
|
|
396
|
+
if (!clientId || !tokenClientId || clientId === tokenClientId)
|
|
397
|
+
return;
|
|
398
|
+
this.signOut(true);
|
|
399
|
+
}
|
|
400
|
+
updateSilentRefresh(enabled) {
|
|
401
|
+
if (enabled) {
|
|
402
|
+
this.oauthService.setupAutomaticSilentRefresh();
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
this.oauthService.stopAutomaticRefresh();
|
|
406
|
+
}
|
|
407
|
+
}
|
|
389
408
|
}
|
|
390
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
391
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
|
392
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
409
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
410
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
411
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthService, decorators: [{
|
|
393
412
|
type: Injectable,
|
|
394
413
|
args: [{ providedIn: 'root' }]
|
|
395
414
|
}], ctorParameters: function () { return []; } });
|
|
@@ -400,12 +419,12 @@ let AuthActionsComponent = class AuthActionsComponent {
|
|
|
400
419
|
this.claims = null;
|
|
401
420
|
}
|
|
402
421
|
};
|
|
403
|
-
AuthActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
404
|
-
AuthActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.
|
|
422
|
+
AuthActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
423
|
+
AuthActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AuthActionsComponent, isStandalone: true, selector: "odx-auth-actions", inputs: { claims: "claims" }, ngImport: i0, template: "<odx-list>\n <a data-testid=\"odx-auth-user-profile-link\" odxListItem [href]=\"url\" rel=\"noopener\" target=\"_blank\" *ngIf=\"claims?.userProfileUrl as url\">\n <odx-icon name=\"user-administration\" iconSet=\"core\" odxListPrefix></odx-icon>\n {{ 'userProfileLink' | odxTranslate | async }}\n </a>\n</odx-list>\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: ListModule }, { kind: "component", type: i2.ListComponent, selector: "odx-list", inputs: ["multiple"] }, { kind: "component", type: i2.ListItemComponent, selector: "[odxListItem]", inputs: ["danger", "selected"] }, { kind: "component", type: i3.IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "pipe", type: TranslatePipe, name: "odxTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
405
424
|
AuthActionsComponent = __decorate([
|
|
406
425
|
CSSComponent('auth-actions')
|
|
407
426
|
], AuthActionsComponent);
|
|
408
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
427
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthActionsComponent, decorators: [{
|
|
409
428
|
type: Component,
|
|
410
429
|
args: [{ standalone: true, selector: 'odx-auth-actions', imports: [CoreModule, ListModule, TranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<odx-list>\n <a data-testid=\"odx-auth-user-profile-link\" odxListItem [href]=\"url\" rel=\"noopener\" target=\"_blank\" *ngIf=\"claims?.userProfileUrl as url\">\n <odx-icon name=\"user-administration\" iconSet=\"core\" odxListPrefix></odx-icon>\n {{ 'userProfileLink' | odxTranslate | async }}\n </a>\n</odx-list>\n" }]
|
|
411
430
|
}], propDecorators: { claims: [{
|
|
@@ -415,7 +434,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
415
434
|
class AuthLoadingScreenComponent {
|
|
416
435
|
constructor() {
|
|
417
436
|
this.authConfig = injectAuthConfig();
|
|
418
|
-
this.icon$ = inject(AuthService).isRedirecting$.pipe(
|
|
437
|
+
this.icon$ = inject(AuthService).isRedirecting$.pipe(distinctUntilChanged(), map((isRedirecting) => (isRedirecting ? 'link-external' : 'user')));
|
|
419
438
|
}
|
|
420
439
|
static initialize(authService, dynamicViewService) {
|
|
421
440
|
authService.isLoading$.subscribe((isLoading) => {
|
|
@@ -431,9 +450,9 @@ class AuthLoadingScreenComponent {
|
|
|
431
450
|
}
|
|
432
451
|
}
|
|
433
452
|
AuthLoadingScreenComponent.instance = null;
|
|
434
|
-
AuthLoadingScreenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
435
|
-
AuthLoadingScreenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.
|
|
436
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
453
|
+
AuthLoadingScreenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthLoadingScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
454
|
+
AuthLoadingScreenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AuthLoadingScreenComponent, isStandalone: true, selector: "div.odx-auth-loading-screen", host: { properties: { "@hostAnimation": "true" } }, ngImport: i0, template: "<div class=\"odx-auth-loading-screen__content\" odxLayout=\"grid 12 horizontal-center vertical-center gap-small\">\n <odx-logo size=\"large\"></odx-logo>\n <odx-circular-progress class=\"odx-auth-loading-screen__spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\"></odx-icon>\n </odx-circular-progress>\n <p class=\"odx-auth-loading-screen__message\" *ngIf=\"authConfig.loadingScreenMessage as content\">\n <ng-template [odxDynamicView]=\"content\"></ng-template>\n </p>\n</div>\n", styles: ["@keyframes odx-auth-loading-screen-animation{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%)}}.odx-auth-loading-screen{--odx-c-highlight: var(--odx-c-primary);background-color:var(--odx-c-background-content);position:fixed;z-index:var(--odx-v-layer-5);inset:0}.odx-auth-loading-screen__content{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;animation:odx-auth-loading-screen-animation .75s ease}.odx-auth-loading-screen__message{text-align:center}.odx-auth-loading-screen__spinner{position:relative}.odx-auth-loading-screen__spinner .odx-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "component", type: CircularProgressComponent, selector: "odx-circular-progress", inputs: ["stroke", "size", "value"] }, { kind: "directive", type: DynamicViewDirective, selector: "ng-template[odxDynamicView]", inputs: ["odxDynamicView", "odxDynamicViewInjector", "odxDynamicViewContext"] }], animations: [trigger('hostAnimation', [transition(':leave', useAnimation(fadeOut()))])], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
455
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthLoadingScreenComponent, decorators: [{
|
|
437
456
|
type: Component,
|
|
438
457
|
args: [{ standalone: true, selector: 'div.odx-auth-loading-screen', imports: [CommonModule, ButtonComponent, IconComponent, LogoDirective, CircularProgressComponent, DynamicViewDirective], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
439
458
|
'[@hostAnimation]': 'true',
|
|
@@ -448,14 +467,14 @@ class AuthActionDirective {
|
|
|
448
467
|
}
|
|
449
468
|
ngAfterViewInit() {
|
|
450
469
|
this.loadingSpinnerDirective.autoColor = true;
|
|
451
|
-
this.authService.isRedirecting$.pipe(this.takeUntilDestroyed()).subscribe(() => {
|
|
452
|
-
this.loadingSpinnerDirective.isLoading =
|
|
470
|
+
this.authService.isRedirecting$.pipe(this.takeUntilDestroyed()).subscribe((isRedirecting) => {
|
|
471
|
+
this.loadingSpinnerDirective.isLoading = isRedirecting;
|
|
453
472
|
});
|
|
454
473
|
}
|
|
455
474
|
}
|
|
456
|
-
AuthActionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
457
|
-
AuthActionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
458
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
475
|
+
AuthActionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
476
|
+
AuthActionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: AuthActionDirective, ngImport: i0 });
|
|
477
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthActionDirective, decorators: [{
|
|
459
478
|
type: Directive
|
|
460
479
|
}] });
|
|
461
480
|
|
|
@@ -470,9 +489,9 @@ class SignInDirective extends AuthActionDirective {
|
|
|
470
489
|
this.afterSignIn.next();
|
|
471
490
|
}
|
|
472
491
|
}
|
|
473
|
-
SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
474
|
-
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
475
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
492
|
+
SignInDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SignInDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
493
|
+
SignInDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1$1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
494
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SignInDirective, decorators: [{
|
|
476
495
|
type: Directive,
|
|
477
496
|
args: [{
|
|
478
497
|
standalone: true,
|
|
@@ -498,9 +517,9 @@ class SignOutDirective extends AuthActionDirective {
|
|
|
498
517
|
this.afterSignOut.next();
|
|
499
518
|
}
|
|
500
519
|
}
|
|
501
|
-
SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
502
|
-
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
503
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
520
|
+
SignOutDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SignOutDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
521
|
+
SignOutDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1$1.LoadingSpinnerDirective }], ngImport: i0 });
|
|
522
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SignOutDirective, decorators: [{
|
|
504
523
|
type: Directive,
|
|
505
524
|
args: [{
|
|
506
525
|
standalone: true,
|
|
@@ -526,9 +545,9 @@ class AuthComponent {
|
|
|
526
545
|
};
|
|
527
546
|
}
|
|
528
547
|
}
|
|
529
|
-
AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
530
|
-
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.
|
|
531
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
548
|
+
AuthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
549
|
+
AuthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AuthComponent, isStandalone: true, selector: "odx-auth", providers: [provideTranslations(translations)], ngImport: i0, template: "<odx-action-group>\n <ng-template [ngrxLet]=\"{ idClaims: authService.identityClaims$, isAuthenticated: authService.isAuthenticated$ }\" let-vm>\n <ng-template [ngIf]=\"vm.isAuthenticated\" [ngIfElse]=\"notAuthenticated\">\n <button odxButton [odxDropdown]=\"userProfileMenu\" [odxDropdownOptions]=\"dropdownOptions\" data-testid=\"odx-auth-user-profile-button\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\"></ng-template>\n </button>\n <ng-template #userProfileMenu>\n <odx-area-header class=\"odx-padding-x-12\" size=\"small\">\n <ng-template [ngTemplateOutlet]=\"userAvatar\" ngProjectAs=\"odx-avatar\"></ng-template>\n {{ vm.idClaims?.username }}\n <odx-area-header-subtitle>\n {{ vm.idClaims?.email }}\n </odx-area-header-subtitle>\n </odx-area-header>\n <ng-content></ng-content>\n <odx-auth-actions [claims]=\"vm.idClaims\"></odx-auth-actions>\n <div class=\"odx-margin-top-12\" odxLayout=\"flex vertical-center\">\n <odx-logo odxLayout=\"auto\" class=\"odx-margin-left-12 odx-margin-right-auto\"></odx-logo>\n <button odxButton odxAuthSignOut variant=\"ghost\" data-testid=\"odx-auth-sign-out-button\">\n {{ 'signOutButtonText' | odxTranslate | async }}\n <odx-icon name=\"logout\" alignRight></odx-icon>\n </button>\n </div>\n </ng-template>\n </ng-template>\n <ng-template #notAuthenticated>\n <button class=\"odx-auth-sign-in\" odxButton odxAuthSignIn variant=\"secondary\" data-testid=\"odx-auth-sign-in-button\">\n <odx-icon name=\"user\" alignLeft></odx-icon>\n {{ 'signInButtonText' | odxTranslate | async }}\n </button>\n </ng-template>\n <ng-template #userAvatar>\n <odx-avatar class=\"odx-auth-user-avatar\">\n {{ vm.idClaims?.initials ?? '' }}\n </odx-avatar>\n </ng-template>\n </ng-template>\n</odx-action-group>\n", styles: [".odx-auth-user-profile .odx-dropdown__inner>.odx-area-header{max-width:max(360px,25vw);min-width:296px}.odx-auth-actions{display:block;margin-top:calc(var(--odx-vertical-rythm-base-size) * .5);margin-bottom:calc(var(--odx-vertical-rythm-base-size) * .5);margin-right:calc(var(--odx-vertical-rythm-base-size) * .25);margin-left:calc(var(--odx-vertical-rythm-base-size) * .25)}\n"], dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "directive", type: i2$1.LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "ngmodule", type: AreaHeaderModule }, { kind: "component", type: i3$1.AreaHeaderComponent, selector: "odx-area-header", inputs: ["size"] }, { kind: "directive", type: i3$1.AreaHeaderSubtitleDirective, selector: "odx-area-header-subtitle" }, { kind: "component", type: i4.AvatarComponent, selector: "odx-avatar", inputs: ["size", "variant"] }, { kind: "component", type: i5.ActionGroupComponent, selector: "odx-action-group", inputs: ["reverse"] }, { kind: "component", type: i6.ButtonComponent, selector: "button[odxButton], a[odxButton]", inputs: ["variant", "size"] }, { kind: "component", type: i3.IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "directive", type: i8.DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: HeaderModule }, { kind: "directive", type: LogoDirective, selector: "odx-logo", inputs: ["size", "variant"] }, { kind: "directive", type: SignInDirective, selector: "[odxButton][odxAuthSignIn]", outputs: ["odxAuthSignIn"] }, { kind: "directive", type: SignOutDirective, selector: "[odxButton][odxAuthSignOut]", outputs: ["odxAuthSignOut"] }, { kind: "ngmodule", type: LoadingSpinnerModule }, { kind: "component", type: AuthActionsComponent, selector: "odx-auth-actions", inputs: ["claims"] }, { kind: "pipe", type: TranslatePipe, name: "odxTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
550
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthComponent, decorators: [{
|
|
532
551
|
type: Component,
|
|
533
552
|
args: [{ standalone: true, selector: 'odx-auth', imports: [
|
|
534
553
|
CoreModule,
|
|
@@ -562,9 +581,9 @@ class AuthDirective {
|
|
|
562
581
|
});
|
|
563
582
|
}
|
|
564
583
|
}
|
|
565
|
-
AuthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
566
|
-
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
567
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
584
|
+
AuthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
585
|
+
AuthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: AuthDirective, isStandalone: true, selector: "ng-template[odxAuth]", inputs: { authorizationHandler: ["odxAuth", "authorizationHandler"], elseTemplate: ["odxAuthElse", "elseTemplate"] }, hostDirectives: [{ directive: i1.NgIf }], ngImport: i0 });
|
|
586
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthDirective, decorators: [{
|
|
568
587
|
type: Directive,
|
|
569
588
|
args: [{
|
|
570
589
|
standalone: true,
|
|
@@ -606,10 +625,10 @@ function authGuard(authorizedHandler, redirectTo) {
|
|
|
606
625
|
const modules = [AuthComponent, AuthDirective, SignInDirective, SignOutDirective];
|
|
607
626
|
class AuthModule {
|
|
608
627
|
}
|
|
609
|
-
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
610
|
-
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
|
611
|
-
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
|
612
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
628
|
+
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
629
|
+
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: AuthModule, imports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective], exports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective] });
|
|
630
|
+
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthModule, imports: [AuthComponent] });
|
|
631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AuthModule, decorators: [{
|
|
613
632
|
type: NgModule,
|
|
614
633
|
args: [{
|
|
615
634
|
imports: [...modules],
|
|
@@ -628,17 +647,6 @@ const coreIdentityPlugin = () => {
|
|
|
628
647
|
};
|
|
629
648
|
};
|
|
630
649
|
|
|
631
|
-
const loadingScreenPlugin = () => {
|
|
632
|
-
const { enableLoadingScreen, showRedirectOverlay } = injectAuthConfig();
|
|
633
|
-
const dynamicViewService = inject(DynamicViewService);
|
|
634
|
-
return (authService) => {
|
|
635
|
-
if (enableLoadingScreen || showRedirectOverlay) {
|
|
636
|
-
AuthLoadingScreenComponent.initialize(authService, dynamicViewService);
|
|
637
|
-
}
|
|
638
|
-
return of({});
|
|
639
|
-
};
|
|
640
|
-
};
|
|
641
|
-
|
|
642
650
|
const userProfileUrlPlugin = () => {
|
|
643
651
|
const { environment, userProfileUrl } = injectAuthConfig();
|
|
644
652
|
return () => {
|
|
@@ -662,14 +670,12 @@ function initializeAuthErrorHandlers() {
|
|
|
662
670
|
authService.errors$.pipe(tap((error) => handler(error))).subscribe();
|
|
663
671
|
}
|
|
664
672
|
function initalizeAuthConfig() {
|
|
665
|
-
|
|
666
|
-
const { clientId, scopes, redirectPath, environment, postLogoutRedirectUrl, issuer, timeoutFactor, discoveryUrl } = injectAuthConfig();
|
|
673
|
+
const { clientId, scopes, redirectPath, environment, postLogoutRedirectUrl, issuer, timeoutFactor, discoveryUrl, enableLoadingScreen } = injectAuthConfig();
|
|
667
674
|
const authService = inject(AuthService);
|
|
668
675
|
const origin = inject(WindowRef).getOrigin();
|
|
669
676
|
const scope = Array.from(new Set(DEFAULT_AUTH_SCOPES.concat(scopes !== null && scopes !== void 0 ? scopes : []))).join(' ');
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
authService.signOut(true);
|
|
677
|
+
if (enableLoadingScreen) {
|
|
678
|
+
AuthLoadingScreenComponent.initialize(authService, inject(DynamicViewService));
|
|
673
679
|
}
|
|
674
680
|
return () => authService.initialize({
|
|
675
681
|
clientId,
|
|
@@ -712,7 +718,7 @@ function provideAuth(config) {
|
|
|
712
718
|
},
|
|
713
719
|
{
|
|
714
720
|
provide: ODX_AUTH_CORE_PLUGINS,
|
|
715
|
-
useValue: [coreIdentityPlugin,
|
|
721
|
+
useValue: [coreIdentityPlugin, userProfileUrlPlugin],
|
|
716
722
|
},
|
|
717
723
|
]);
|
|
718
724
|
}
|
|
@@ -739,5 +745,5 @@ function unauthGuard(authorizedHandler, redirectTo) {
|
|
|
739
745
|
* Generated bundle index. Do not edit.
|
|
740
746
|
*/
|
|
741
747
|
|
|
742
|
-
export { AuthActionDirective, AuthActionsComponent, AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthHttpCache, AuthLoadingScreenComponent, AuthModule, AuthPluginManager, AuthService, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, DEFAULT_USER_PROFILE_URLS, ODX_AUTH_CORE_PLUGINS, ODX_AUTH_ERROR_HANDLERS, ODX_AUTH_HTTP_CACHE_STORAGE, ODX_AUTH_PLUGINS, SignInDirective, SignOutDirective, authGuard, configureInterceptor, coreIdentityPlugin, createInitials, handleAuthError, handleOAuthEvent, initalizeAuthConfig, initializeAuthErrorHandlers, injectAuthConfig,
|
|
748
|
+
export { AuthActionDirective, AuthActionsComponent, AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthHttpCache, AuthLoadingScreenComponent, AuthModule, AuthPluginManager, AuthService, DEFAULT_AUTH_SCOPES, DEFAULT_ISSUERS, DEFAULT_USER_PROFILE_URLS, ODX_AUTH_CORE_PLUGINS, ODX_AUTH_ERROR_HANDLERS, ODX_AUTH_HTTP_CACHE_STORAGE, ODX_AUTH_PLUGINS, SignInDirective, SignOutDirective, authGuard, configureInterceptor, coreIdentityPlugin, createInitials, handleAuthError, handleOAuthEvent, initalizeAuthConfig, initializeAuthErrorHandlers, injectAuthConfig, offlineAuthErrorHandler, provideAuth, provideAuthConfig, resolveEmail, resolveUsername, unauthGuard, userProfileUrlPlugin };
|
|
743
749
|
//# sourceMappingURL=odx-auth.mjs.map
|