@odx/auth 12.0.0 → 13.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.
- package/CHANGELOG.md +22 -0
- package/esm2022/lib/auth.component.mjs +3 -3
- package/esm2022/lib/auth.config.mjs +2 -2
- package/esm2022/lib/auth.directive.mjs +3 -3
- package/esm2022/lib/auth.guard.mjs +1 -1
- package/esm2022/lib/auth.interceptor.mjs +4 -2
- package/esm2022/lib/auth.module.mjs +4 -4
- package/esm2022/lib/auth.providers.mjs +1 -1
- package/esm2022/lib/auth.service.mjs +5 -5
- package/esm2022/lib/components/auth-actions/auth-actions.component.mjs +6 -5
- package/esm2022/lib/components/auth-loading-screen/auth-loading-screen.component.mjs +4 -4
- package/esm2022/lib/directives/auth-action.directive.mjs +3 -3
- package/esm2022/lib/directives/sign-in.directive.mjs +3 -3
- package/esm2022/lib/directives/sign-out.directive.mjs +3 -3
- package/esm2022/lib/helpers/create-inititals.mjs +1 -1
- package/esm2022/lib/helpers/handle-auth-error.mjs +1 -1
- package/esm2022/lib/helpers/resolve-email.mjs +1 -1
- package/esm2022/lib/helpers/resolve-username.mjs +1 -1
- package/esm2022/lib/helpers/set-http-auth-header.mjs +1 -1
- package/esm2022/lib/models/auth-plugin-manager.mjs +4 -4
- package/esm2022/lib/models/offline-auth-error-handler.mjs +1 -1
- package/esm2022/lib/unauth.guard.mjs +1 -1
- package/esm2022/plugins/service-connect/lib/helpers/build-service-connect-url.mjs +1 -1
- package/esm2022/plugins/service-connect/lib/helpers/service-connect-plugin-factory.mjs +7 -5
- package/esm2022/plugins/service-connect/lib/service-connect-rights.directive.mjs +3 -3
- package/fesm2022/odx-auth-plugins-service-connect.mjs +9 -7
- package/fesm2022/odx-auth-plugins-service-connect.mjs.map +1 -1
- package/fesm2022/odx-auth.mjs +37 -36
- package/fesm2022/odx-auth.mjs.map +1 -1
- package/lib/auth.interceptor.d.ts +2 -1
- package/package.json +4 -5
|
@@ -14,4 +14,4 @@ export function resolveUsername(claims) {
|
|
|
14
14
|
}
|
|
15
15
|
return '';
|
|
16
16
|
}
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzb2x2ZS11c2VybmFtZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYXV0aC9zcmMvbGliL2hlbHBlcnMvcmVzb2x2ZS11c2VybmFtZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFOUMsTUFBTSxVQUFVLGVBQWUsQ0FBQyxNQUFpQztJQUMvRCxJQUFJLFFBQVEsQ0FBQyxNQUFNLENBQUMsV0FBVyxDQUFDLENBQUMsSUFBSSxRQUFRLENBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxDQUFDLEVBQUUsQ0FBQztRQUNsRSxPQUFPLEdBQUcsTUFBTSxDQUFDLFdBQVcsQ0FBQyxJQUFJLE1BQU0sQ0FBQyxVQUFVLENBQUMsRUFBRSxDQUFDO0lBQ3hELENBQUM7SUFDRCxJQUFJLFFBQVEsQ0FBQyxNQUFNLENBQUMsWUFBWSxDQUFDLENBQUMsSUFBSSxRQUFRLENBQUMsTUFBTSxDQUFDLGFBQWEsQ0FBQyxDQUFDLEVBQUUsQ0FBQztRQUN0RSxPQUFPLEdBQUcsTUFBTSxDQUFDLFlBQVksQ0FBQyxJQUFJLE1BQU0sQ0FBQyxhQUFhLENBQUMsRUFBRSxDQUFDO0lBQzVELENBQUM7SUFDRCxJQUFJLFFBQVEsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBRSxDQUFDO1FBQzdCLE9BQU8sTUFBTSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3hC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FBfSEVBREVSIH0gZnJvbSAnLi4vYXV0aC5jb25maWcnO1xuXG5leHBvcnQgZnVuY3Rpb24gc2V0SHR0cEF1dGhIZWFkZXI8UiBleHRlbmRzIEh0dHBSZXF1ZXN0PFQ+IHwgUmVxdWVzdCwgVD4ocmVxOiBSLCB0b2tlbj86IHN0cmluZyB8IG51bGwpOiBSIHtcbiAgaWYgKCF0b2tlbikgcmV0dXJuIHJlcTtcbiAgY29uc3QgaGVhZGVyID0gYEJlYXJlciAke3Rva2VufWA7XG4gIGlmIChyZXEgaW5zdGFuY2VvZiBIdHRwUmVxdWVzdCkge1xuICAgIHJldHVybiByZXEuY2xvbmUoeyBoZWFkZXJzOiByZXEuaGVhZGVycy5zZXQoQVVUSF9IVFRQX0hFQURFUiwgaGVhZGVyKSB9KSBhcyBSO1xuICB9XG4gIHJlcS5oZWFkZXJzLnNldChBVVRIX0hUVFBfSEVBREVSLCBoZWFkZXIpO1xuXG4gIHJldHVybiByZXE7XG59XG4iXX0=
|
|
@@ -39,11 +39,11 @@ export class AuthPluginManager {
|
|
|
39
39
|
runPlugin(authService, plugin) {
|
|
40
40
|
return plugin(authService).pipe(isNumber(this.authConfig.pluginTimeout) ? timeout(Math.max(0, this.authConfig.pluginTimeout)) : tap(), catchError((error) => this.handlePluginError(error)));
|
|
41
41
|
}
|
|
42
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
43
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
42
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthPluginManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
43
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthPluginManager, providedIn: 'root' }); }
|
|
44
44
|
}
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthPluginManager, decorators: [{
|
|
46
46
|
type: Injectable,
|
|
47
47
|
args: [{ providedIn: 'root' }]
|
|
48
48
|
}] });
|
|
49
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aC1wbHVnaW4tbWFuYWdlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYXV0aC9zcmMvbGliL21vZGVscy9hdXRoLXBsdWdpbi1tYW5hZ2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ25ELE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUM5QyxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxlQUFlLEVBQUUsVUFBVSxFQUFFLGFBQWEsRUFBRSxvQkFBb0IsRUFBRSxNQUFNLEVBQUUsR0FBRyxFQUFjLEVBQUUsRUFBRSxLQUFLLEVBQUUsU0FBUyxFQUFFLElBQUksRUFBRSxHQUFHLEVBQUUsT0FBTyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBQzNKLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ2xELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSw4QkFBOEIsRUFBRSxNQUFNLG1CQUFtQixDQUFDOztBQVNyRixNQUFNLE9BQU8saUJBQWlCO0lBRDlCO1FBRW1CLGVBQVUsR0FBRyxnQkFBZ0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IHtcbiAgICB0cnkge1xuICAgICAgdGhpcy5wbHVnaW5zRXJyb3JIYW5kbGVyPy4oZXJyb3IpO1xuICAgIH0gY2F0Y2gge1xuICAgICAgLy9cbiAgICB9XG5cbiAgICByZXR1cm4gb2Yoe30gYXMgT2R4QXV0aC5BdXRoUGx1Z2luUmVzdWx0KTtcbiAgfVxuXG4gIHByaXZhdGUgcnVuUGx1Z2luKGF1dGhTZXJ2aWNlOiBBdXRoU2VydmljZSwgcGx1Z2luOiBBdXRoUGx1Z2luKTogUmV0dXJuVHlwZTxBdXRoUGx1Z2luPiB7XG4gICAgcmV0dXJuIHBsdWdpbihhdXRoU2VydmljZSkucGlwZShcbiAgICAgIGlzTnVtYmVyKHRoaXMuYXV0aENvbmZpZy5wbHVnaW5UaW1lb3V0KSA/IHRpbWVvdXQoTWF0aC5tYXgoMCwgdGhpcy5hdXRoQ29uZmlnLnBsdWdpblRpbWVvdXQpKSA6IHRhcCgpLFxuICAgICAgY2F0Y2hFcnJvcigoZXJyb3IpID0+IHRoaXMuaGFuZGxlUGx1Z2luRXJyb3IoZXJyb3IpKSxcbiAgICApO1xuICB9XG59XG4iXX0=
|
|
@@ -4,4 +4,4 @@ export const offlineAuthErrorHandler = (error) => {
|
|
|
4
4
|
}
|
|
5
5
|
throw error;
|
|
6
6
|
};
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib2ZmbGluZS1hdXRoLWVycm9yLWhhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2F1dGgvc3JjL2xpYi9tb2RlbHMvb2ZmbGluZS1hdXRoLWVycm9yLWhhbmRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsTUFBTSxDQUFDLE1BQU0sdUJBQXVCLEdBQXVCLENBQUMsS0FBSyxFQUFFLEVBQUU7SUFDbkUsSUFBSSxLQUFLLENBQUMsSUFBSSxLQUFLLCtCQUErQixJQUFLLEtBQUssQ0FBQyxNQUE0QixFQUFFLE1BQU0sS0FBSyxHQUFHLEVBQUUsQ0FBQztRQUMxRyxPQUFPO0lBQ1QsQ0FBQztJQUNELE1BQU0sS0FBSyxDQUFDO0FBQ2QsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSHR0cEVycm9yUmVzcG9uc2UgfSBmcm9tICdAYW5ndWxhci9jb21tb24vaHR0cCc7XG5pbXBvcnQgeyBBdXRoRXJyb3JIYW5kbGVyRm4gfSBmcm9tICcuLi9hdXRoLmNvbmZpZyc7XG5cbmV4cG9ydCBjb25zdCBvZmZsaW5lQXV0aEVycm9ySGFuZGxlcjogQXV0aEVycm9ySGFuZGxlckZuID0gKGVycm9yKSA9PiB7XG4gIGlmIChlcnJvci50eXBlID09PSAnZGlzY292ZXJ5X2RvY3VtZW50X2xvYWRfZXJyb3InICYmIChlcnJvci5yZWFzb24gYXMgSHR0cEVycm9yUmVzcG9uc2UpPy5zdGF0dXMgPT09IDUwNCkge1xuICAgIHJldHVybjtcbiAgfVxuICB0aHJvdyBlcnJvcjtcbn07XG4iXX0=
|
|
@@ -27,4 +27,4 @@ export function unauthGuard(authorizedHandler, redirectTo, isExternal = false) {
|
|
|
27
27
|
}), take(1));
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5hdXRoLmd1YXJkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9hdXRoL3NyYy9saWIvdW5hdXRoLmd1YXJkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBT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Ubz86IGFueVtdIHwgc3RyaW5nLCBpc0V4dGVybmFsID0gZmFsc2UpOiBDYW5BY3RpdmF0ZUZuIHtcbiAgcmV0dXJuIChfKSA9PiB7XG4gICAgY29uc3QgYXV0aFNlcnZpY2UgPSBpbmplY3QoQXV0aFNlcnZpY2UpO1xuICAgIGNvbnN0IHJvdXRlciA9IGluamVjdChSb3V0ZXIsIHsgb3B0aW9uYWw6IHRydWUgfSk7XG4gICAgY29uc3Qgd2luZG93UmVmID0gaW5qZWN0KFdpbmRvd1JlZik7XG5cbiAgICByZXR1cm4gYXV0aFNlcnZpY2UuaXNBdXRoZW50aWNhdGVkJC5waXBlKFxuICAgICAgbWFwKCgpID0+ICFhdXRoU2VydmljZS5pc0F1dGhvcml6ZWQoYXV0aG9yaXplZEhhbmRsZXIpKSxcbiAgICAgIHRhcCgoaXNVbmF1dGhvcml6ZWQpID0+IHtcbiAgICAgICAgaWYgKGlzVW5hdXRob3JpemVkIHx8ICFyb3V0ZXIpIHJldHVybjtcbiAgICAgICAgaWYgKGlzU3RyaW5nKHJlZGlyZWN0VG8pKSB7XG4gICAgICAgICAgaWYgKGlzRXh0ZXJuYWwpIHtcbiAgICAgICAgICAgIHdpbmRvd1JlZi5sb2NhdGlvbi5hc3NpZ24ocmVkaXJlY3RUbyk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJvdXRlci5uYXZpZ2F0ZUJ5VXJsKHJlZGlyZWN0VG8pO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChBcnJheS5pc0FycmF5KHJlZGlyZWN0VG8pKSB7XG4gICAgICAgICAgcm91dGVyLm5hdmlnYXRlKHJlZGlyZWN0VG8pO1xuICAgICAgICB9XG4gICAgICB9KSxcbiAgICAgIHRha2UoMSksXG4gICAgKTtcbiAgfTtcbn1cbiJdfQ==
|
|
@@ -6,4 +6,4 @@ export function buildServiceConnectUrl(environment, ...endpoints) {
|
|
|
6
6
|
}
|
|
7
7
|
return buildUrl(environment.custom, ...endpoints);
|
|
8
8
|
}
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQtc2VydmljZS1jb25uZWN0LXVybC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYXV0aC9wbHVnaW5zL3NlcnZpY2UtY29ubmVjdC9zcmMvbGliL2hlbHBlcnMvYnVpbGQtc2VydmljZS1jb25uZWN0LXVybC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLFFBQVEsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXhELE9BQU8sRUFBNkIsMkJBQTJCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUVuRyxNQUFNLFVBQVUsc0JBQXNCLENBQUMsV0FBd0QsRUFBRSxHQUFHLFNBQW1CO0lBQ3JILElBQUksUUFBUSxDQUFDLFdBQVcsQ0FBQyxFQUFFLENBQUM7UUFDMUIsT0FBTyxRQUFRLENBQUMsMkJBQTJCLENBQUMsV0FBVyxDQUFDLEVBQUUsR0FBRyxTQUFTLENBQUMsQ0FBQztJQUMxRSxDQUFDO0lBQ0QsT0FBTyxRQUFRLENBQUMsV0FBVyxDQUFDLE1BQU0sRUFBRSxHQUFHLFNBQVMsQ0FBQyxDQUFDO0FBQ3BELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBidWlsZFVybCwgaXNTdHJpbmcgfSBmcm9tICdAb2R4L2FuZ3VsYXIvdXRpbHMnO1xuaW1wb3J0IHsgQXV0aEVudmlyb25tZW50IH0gZnJvbSAnQG9keC9hdXRoJztcbmltcG9ydCB7IFNlcnZpY2VDb25uZWN0RW52aXJvbm1lbnQsIFNlcnZpY2VDb25ubmVjdEVudmlyb25tZW50cyB9IGZyb20gJy4uL3NlcnZpY2UtY29ubmVjdC5jb25maWcnO1xuXG5leHBvcnQgZnVuY3Rpb24gYnVpbGRTZXJ2aWNlQ29ubmVjdFVybChlbnZpcm9ubWVudDogU2VydmljZUNvbm5lY3RFbnZpcm9ubWVudCB8IEF1dGhFbnZpcm9ubWVudCwgLi4uZW5kcG9pbnRzOiBzdHJpbmdbXSk6IHN0cmluZyB7XG4gIGlmIChpc1N0cmluZyhlbnZpcm9ubWVudCkpIHtcbiAgICByZXR1cm4gYnVpbGRVcmwoU2VydmljZUNvbm5uZWN0RW52aXJvbm1lbnRzW2Vudmlyb25tZW50XSwgLi4uZW5kcG9pbnRzKTtcbiAgfVxuICByZXR1cm4gYnVpbGRVcmwoZW52aXJvbm1lbnQuY3VzdG9tLCAuLi5lbmRwb2ludHMpO1xufVxuIl19
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HttpClient } from '@angular/common/http';
|
|
1
|
+
import { HttpClient, HttpContext } from '@angular/common/http';
|
|
2
2
|
import { inject } from '@angular/core';
|
|
3
|
-
import { injectAuthConfig } from '@odx/auth';
|
|
4
|
-
import { map } from 'rxjs';
|
|
3
|
+
import { injectAuthConfig, requireAuthentication } from '@odx/auth';
|
|
4
|
+
import { defer, map } from 'rxjs';
|
|
5
5
|
import { buildServiceConnectUrl } from './build-service-connect-url';
|
|
6
6
|
export function serviceConnectPluginFactory(options) {
|
|
7
7
|
return (pluginOptions) => () => {
|
|
@@ -10,7 +10,9 @@ export function serviceConnectPluginFactory(options) {
|
|
|
10
10
|
const httpClient = inject(HttpClient);
|
|
11
11
|
const url = buildServiceConnectUrl(pluginOptions?.environment ?? environment, ...options.endpoint);
|
|
12
12
|
const parseResponse = (dto) => options.parseResponse(dto) ?? options.defaultValue ?? {};
|
|
13
|
-
return () =>
|
|
13
|
+
return () => defer(() => httpClient.get(url, {
|
|
14
|
+
context: new HttpContext().set(requireAuthentication, true),
|
|
15
|
+
})).pipe(map((dto) => parseResponse(dto)));
|
|
14
16
|
};
|
|
15
17
|
}
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS1jb25uZWN0LXBsdWdpbi1mYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9hdXRoL3BsdWdpbnMvc2VydmljZS1jb25uZWN0L3NyYy9saWIvaGVscGVycy9zZXJ2aWNlLWNvbm5lY3QtcGx1Z2luLWZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxXQUFXLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUMvRCxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3ZDLE9BQU8sRUFBcUIsZ0JBQWdCLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFDdkYsT0FBTyxFQUFFLEtBQUssRUFBRSxHQUFHLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFFbEMsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFlckUsTUFBTSxVQUFVLDJCQUEyQixDQUFnQixPQUFnRDtJQUN6RyxPQUFPLENBQUMsYUFBYSxFQUFFLEVBQUUsQ0FBQyxHQUFHLEVBQUU7UUFDN0IsT0FBTyxDQUFDLEtBQUssRUFBRSxDQUFDLGFBQWEsQ0FBQyxDQUFDO1FBQy9CLE1BQU0sRUFBRSxXQUFXLEVBQUUsR0FBRyxnQkFBZ0IsRUFBRSxDQUFDO1FBQzNDLE1BQU0sVUFBVSxHQUFHLE1BQU0sQ0FBQyxVQUFVLENBQUMsQ0FBQztRQUN0QyxNQUFNLEdBQUcsR0FBRyxzQkFBc0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b25maWcoKTtcbiAgICBjb25zdCBodHRwQ2xpZW50ID0gaW5qZWN0KEh0dHBDbGllbnQpO1xuICAgIGNvbnN0IHVybCA9IGJ1aWxkU2VydmljZUNvbm5lY3RVcmwocGx1Z2luT3B0aW9ucz8uZW52aXJvbm1lbnQgPz8gZW52aXJvbm1lbnQsIC4uLm9wdGlvbnMuZW5kcG9pbnQpO1xuICAgIGNvbnN0IHBhcnNlUmVzcG9uc2UgPSAoZHRvOiBEdG8gfCBudWxsKSA9PiBvcHRpb25zLnBhcnNlUmVzcG9uc2UoZHRvKSA/PyBvcHRpb25zLmRlZmF1bHRWYWx1ZSA/PyB7fTtcblxuICAgIHJldHVybiAoKSA9PlxuICAgICAgZGVmZXIoKCkgPT5cbiAgICAgICAgaHR0cENsaWVudC5nZXQ8RHRvPih1cmwsIHtcbiAgICAgICAgICBjb250ZXh0OiBuZXcgSHR0cENvbnRleHQoKS5zZXQocmVxdWlyZUF1dGhlbnRpY2F0aW9uLCB0cnVlKSxcbiAgICAgICAgfSksXG4gICAgICApLnBpcGUobWFwKChkdG8pID0+IHBhcnNlUmVzcG9uc2UoZHRvKSkpO1xuICB9O1xufVxuIl19
|
|
@@ -10,10 +10,10 @@ export class ServiceConnectRightsDirective {
|
|
|
10
10
|
set rolesOrRights(value) {
|
|
11
11
|
this.authDirective.authorizationHandler = hasRolesOrRightsHandler(value ?? []);
|
|
12
12
|
}
|
|
13
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
14
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
13
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ServiceConnectRightsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
14
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.12", type: ServiceConnectRightsDirective, isStandalone: true, selector: "ng-template[odxAuthServiceConnectRights]", inputs: { rolesOrRights: ["odxAuthServiceConnectRights", "rolesOrRights"] }, hostDirectives: [{ directive: i1.AuthDirective, inputs: ["odxAuthElse", "odxAuthServiceConnectRightsElse"] }], ngImport: i0 }); }
|
|
15
15
|
}
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ServiceConnectRightsDirective, decorators: [{
|
|
17
17
|
type: Directive,
|
|
18
18
|
args: [{
|
|
19
19
|
standalone: true,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isString, buildUrl, getLanguageCode } from '@odx/angular/utils';
|
|
2
2
|
import * as i1 from '@odx/auth';
|
|
3
|
-
import { AuthEnvironment, injectAuthConfig, AuthDirective, authGuard } from '@odx/auth';
|
|
4
|
-
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { AuthEnvironment, injectAuthConfig, requireAuthentication, AuthDirective, authGuard } from '@odx/auth';
|
|
4
|
+
import { HttpClient, HttpContext } from '@angular/common/http';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { inject, Directive, Input } from '@angular/core';
|
|
7
|
-
import { map } from 'rxjs';
|
|
7
|
+
import { defer, map } from 'rxjs';
|
|
8
8
|
|
|
9
9
|
const ServiceConnnectEnvironments = {
|
|
10
10
|
[AuthEnvironment.DEV]: 'https://api.test.connect.draeger.com',
|
|
@@ -44,7 +44,9 @@ function serviceConnectPluginFactory(options) {
|
|
|
44
44
|
const httpClient = inject(HttpClient);
|
|
45
45
|
const url = buildServiceConnectUrl(pluginOptions?.environment ?? environment, ...options.endpoint);
|
|
46
46
|
const parseResponse = (dto) => options.parseResponse(dto) ?? options.defaultValue ?? {};
|
|
47
|
-
return () =>
|
|
47
|
+
return () => defer(() => httpClient.get(url, {
|
|
48
|
+
context: new HttpContext().set(requireAuthentication, true),
|
|
49
|
+
})).pipe(map((dto) => parseResponse(dto)));
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -55,10 +57,10 @@ class ServiceConnectRightsDirective {
|
|
|
55
57
|
set rolesOrRights(value) {
|
|
56
58
|
this.authDirective.authorizationHandler = hasRolesOrRightsHandler(value ?? []);
|
|
57
59
|
}
|
|
58
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
59
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
60
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ServiceConnectRightsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
61
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.12", type: ServiceConnectRightsDirective, isStandalone: true, selector: "ng-template[odxAuthServiceConnectRights]", inputs: { rolesOrRights: ["odxAuthServiceConnectRights", "rolesOrRights"] }, hostDirectives: [{ directive: i1.AuthDirective, inputs: ["odxAuthElse", "odxAuthServiceConnectRightsElse"] }], ngImport: i0 }); }
|
|
60
62
|
}
|
|
61
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ServiceConnectRightsDirective, decorators: [{
|
|
62
64
|
type: Directive,
|
|
63
65
|
args: [{
|
|
64
66
|
standalone: true,
|
|
@@ -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/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\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 { HttpClient } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { AuthPluginFactory, injectAuthConfig } from '@odx/auth';\nimport { 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 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 () => httpClient.get<Dto>(url).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[], 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\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\nexport const serviceConnectUserLanguagePlugin = serviceConnectPluginFactory<GetServiceConnectUserResponseDto>({\n endpoint: [ServiceConnectEndpoints.user],\n parseResponse: (res) => {\n const preferredLanguage = res?.preferred_language ?? res?.language_code ? getLanguageCode(res.preferred_language ?? res.language_code) : undefined;\n\n return { preferredLanguage };\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,oBAAo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AA,QAAQ,EAAE,0CAA0C;AACpD,oBAAA,cAAc,EAAE;AACd,wBAAA;AACE,4BAAA,SAAS,EAAE,aAAa;4BACxB,MAAM,EAAE,CAAC,6CAA6C,CAAC;AACxD,yBAAA;AACF,qBAAA;AACF,iBAAA,CAAA;8BAKY,aAAa,EAAA,CAAA;sBADvB,KAAK;uBAAC,6BAA6B,CAAA;;;ACbtC;AACM,SAAU,yBAAyB,CAAC,aAA4B,EAAE,UAA2B,EAAE,UAAU,GAAG,KAAK,EAAA;IACrH,OAAO,SAAS,CAAC,uBAAuB,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACnF;;ACMO,MAAM,0BAA0B,GAAG,2BAA2B,CAAqC;AACxG,IAAA,QAAQ,EAAE,CAAC,uBAAuB,CAAC,UAAU,CAAC;AAC9C,IAAA,aAAa,EAAE,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC;AACvD,IAAA,YAAY,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;AAC7B,CAAA;;ACZM,MAAM,gCAAgC,GAAG,2BAA2B,CAAmC;AAC5G,IAAA,QAAQ,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC;AACxC,IAAA,aAAa,EAAE,CAAC,GAAG,KAAI;QACrB,MAAM,iBAAiB,GAAG,GAAG,EAAE,kBAAkB,IAAI,GAAG,EAAE,aAAa,GAAG,eAAe,CAAC,GAAG,CAAC,kBAAkB,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;QAEnJ,OAAO,EAAE,iBAAiB,EAAE,CAAC;KAC9B;AACF,CAAA;;ACZD;;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/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\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 { 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\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@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[], 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\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\nexport const serviceConnectUserLanguagePlugin = serviceConnectPluginFactory<GetServiceConnectUserResponseDto>({\n endpoint: [ServiceConnectEndpoints.user],\n parseResponse: (res) => {\n const preferredLanguage = res?.preferred_language ?? res?.language_code ? getLanguageCode(res.preferred_language ?? res.language_code) : undefined;\n\n return { preferredLanguage };\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,GA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AG,SAAS,CAAC;QAEnJ,OAAO,EAAE,iBAAiB,EAAE,CAAC;KAC9B;AACF,CAAA;;ACZD;;AAEG;;;;"}
|
package/fesm2022/odx-auth.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { TranslatePipe, provideTranslations } from '@odx/angular/internal/transl
|
|
|
13
13
|
import { buildUrl, isString, matchUrl, injectElement, isNumber, isNonEmptyString, createConfigTokens, untilDestroyed, Position } from '@odx/angular/utils';
|
|
14
14
|
import { OAuthErrorEvent, provideOAuthClient, OAuthStorage, OAuthService } from 'angular-oauth2-oidc';
|
|
15
15
|
import { filter, switchMap, mergeMap, map, of, tap, BehaviorSubject, distinctUntilChanged, share, combineLatest, take, timeout, catchError, fromEvent, startWith, shareReplay, merge, EMPTY } from 'rxjs';
|
|
16
|
-
import { HttpRequest, provideHttpClient, withInterceptors, HttpErrorResponse } from '@angular/common/http';
|
|
16
|
+
import { HttpRequest, HttpContextToken, provideHttpClient, withInterceptors, HttpErrorResponse } from '@angular/common/http';
|
|
17
17
|
import { Router } from '@angular/router';
|
|
18
18
|
import { deepmerge } from 'deepmerge-ts';
|
|
19
19
|
import { DynamicViewDirective, DynamicViewService } from '@odx/angular/cdk/dynamic-view';
|
|
@@ -119,10 +119,11 @@ function setHttpAuthHeader(req, token) {
|
|
|
119
119
|
|
|
120
120
|
const AuthEnvironment = Environment;
|
|
121
121
|
|
|
122
|
+
const requireAuthentication = new HttpContextToken(() => false);
|
|
122
123
|
const authInterceptor = (req, next) => {
|
|
123
124
|
const { allowedUrls, requireSignInForRequests } = injectAuthConfig();
|
|
124
125
|
const isUrlAllowed = allowedUrls.some((allowedUrl) => matchUrl(req.url, allowedUrl));
|
|
125
|
-
if (!isUrlAllowed) {
|
|
126
|
+
if (!isUrlAllowed && !req.context.get(requireAuthentication)) {
|
|
126
127
|
return next(req);
|
|
127
128
|
}
|
|
128
129
|
return inject(AuthService).prepareAuthRequest$(req, requireSignInForRequests).pipe(mergeMap(next));
|
|
@@ -135,13 +136,13 @@ let AuthActionsComponent = class AuthActionsComponent {
|
|
|
135
136
|
this.element = injectElement();
|
|
136
137
|
this.claims = null;
|
|
137
138
|
}
|
|
138
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
139
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
139
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
140
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", 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" }, { kind: "component", type: i2.ListItemComponent, selector: "odx-list-item, [odxListItem]", inputs: ["danger", "variant", "muted", "selected"] }, { kind: "component", type: i3.IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet", "identifier"] }, { kind: "pipe", type: TranslatePipe, name: "odxTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
140
141
|
};
|
|
141
142
|
AuthActionsComponent = __decorate([
|
|
142
143
|
CSSComponent('auth-actions')
|
|
143
144
|
], AuthActionsComponent);
|
|
144
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
145
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthActionsComponent, decorators: [{
|
|
145
146
|
type: Component,
|
|
146
147
|
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" }]
|
|
147
148
|
}], propDecorators: { claims: [{
|
|
@@ -165,10 +166,10 @@ class AuthLoadingScreenComponent {
|
|
|
165
166
|
}
|
|
166
167
|
});
|
|
167
168
|
}
|
|
168
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
169
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
169
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthLoadingScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
170
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", 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\" />\n <odx-circular-progress class=\"odx-auth-loading-screen__spinner\" value=\"-1\" size=\"medium\" stroke=\"3\">\n <odx-icon [name]=\"icon$ | async\" iconSet=\"core\" />\n </odx-circular-progress>\n <p class=\"odx-auth-loading-screen__message\" *ngIf=\"authConfig.loadingScreenMessage as content\">\n <ng-template [odxDynamicView]=\"content\" />\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);inset:0;position:fixed;z-index:var(--odx-v-layer-6)}.odx-auth-loading-screen__content{animation:odx-auth-loading-screen-animation .75s ease;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.odx-auth-loading-screen__message{text-align:center}.odx-auth-loading-screen__spinner{position:relative}.odx-auth-loading-screen__spinner .odx-icon{left:50%;position:absolute;top: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", "identifier"] }, { 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 }); }
|
|
170
171
|
}
|
|
171
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
172
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthLoadingScreenComponent, decorators: [{
|
|
172
173
|
type: Component,
|
|
173
174
|
args: [{ standalone: true, selector: 'div.odx-auth-loading-screen', imports: [CommonModule, ButtonComponent, IconComponent, LogoDirective, CircularProgressComponent, DynamicViewDirective], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
174
175
|
'[@hostAnimation]': 'true',
|
|
@@ -330,10 +331,10 @@ class AuthPluginManager {
|
|
|
330
331
|
runPlugin(authService, plugin) {
|
|
331
332
|
return plugin(authService).pipe(isNumber(this.authConfig.pluginTimeout) ? timeout(Math.max(0, this.authConfig.pluginTimeout)) : tap(), catchError((error) => this.handlePluginError(error)));
|
|
332
333
|
}
|
|
333
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
334
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
334
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthPluginManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
335
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthPluginManager, providedIn: 'root' }); }
|
|
335
336
|
}
|
|
336
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
337
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthPluginManager, decorators: [{
|
|
337
338
|
type: Injectable,
|
|
338
339
|
args: [{ providedIn: 'root' }]
|
|
339
340
|
}] });
|
|
@@ -486,13 +487,13 @@ class AuthService {
|
|
|
486
487
|
this.oauthService.stopAutomaticRefresh();
|
|
487
488
|
}
|
|
488
489
|
}
|
|
489
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
490
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
490
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
491
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, providedIn: 'root' }); }
|
|
491
492
|
}
|
|
492
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
493
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, decorators: [{
|
|
493
494
|
type: Injectable,
|
|
494
495
|
args: [{ providedIn: 'root' }]
|
|
495
|
-
}], ctorParameters:
|
|
496
|
+
}], ctorParameters: () => [] });
|
|
496
497
|
|
|
497
498
|
function userLanguageLoader(languageSelector = (claims) => claims?.preferredLanguage) {
|
|
498
499
|
return () => {
|
|
@@ -517,7 +518,7 @@ const { AuthDefaultConfig, AuthConfig, injectAuthConfig, provideAuthConfig } = c
|
|
|
517
518
|
redirectPath: 'login/callback',
|
|
518
519
|
allowedUrls: [],
|
|
519
520
|
timeoutFactor: 0.75,
|
|
520
|
-
maxOfflineTime: 24 * 60 * 60,
|
|
521
|
+
maxOfflineTime: 24 * 60 * 60, // 1 day
|
|
521
522
|
loadUserProfile: false,
|
|
522
523
|
errorHandler: (error) => {
|
|
523
524
|
throw error;
|
|
@@ -557,10 +558,10 @@ class AuthActionDirective {
|
|
|
557
558
|
this.loadingSpinnerDirective.isLoading = isRedirecting;
|
|
558
559
|
});
|
|
559
560
|
}
|
|
560
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
561
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
561
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
562
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.12", type: AuthActionDirective, ngImport: i0 }); }
|
|
562
563
|
}
|
|
563
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
564
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthActionDirective, decorators: [{
|
|
564
565
|
type: Directive
|
|
565
566
|
}] });
|
|
566
567
|
|
|
@@ -574,10 +575,10 @@ class SignInDirective extends AuthActionDirective {
|
|
|
574
575
|
this.authService.signIn();
|
|
575
576
|
this.afterSignIn.next();
|
|
576
577
|
}
|
|
577
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
578
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
578
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SignInDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
579
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.12", type: SignInDirective, isStandalone: true, selector: "[odxButton][odxAuthSignIn]", outputs: { afterSignIn: "odxAuthSignIn" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1$1.LoadingSpinnerDirective }], ngImport: i0 }); }
|
|
579
580
|
}
|
|
580
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
581
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SignInDirective, decorators: [{
|
|
581
582
|
type: Directive,
|
|
582
583
|
args: [{
|
|
583
584
|
standalone: true,
|
|
@@ -602,10 +603,10 @@ class SignOutDirective extends AuthActionDirective {
|
|
|
602
603
|
this.authService.signOut();
|
|
603
604
|
this.afterSignOut.next();
|
|
604
605
|
}
|
|
605
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
606
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
606
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SignOutDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
607
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.12", type: SignOutDirective, isStandalone: true, selector: "[odxButton][odxAuthSignOut]", outputs: { afterSignOut: "odxAuthSignOut" }, host: { listeners: { "click": "handleClick()" } }, usesInheritance: true, hostDirectives: [{ directive: i1$1.LoadingSpinnerDirective }], ngImport: i0 }); }
|
|
607
608
|
}
|
|
608
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
609
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SignOutDirective, decorators: [{
|
|
609
610
|
type: Directive,
|
|
610
611
|
args: [{
|
|
611
612
|
standalone: true,
|
|
@@ -630,10 +631,10 @@ class AuthComponent {
|
|
|
630
631
|
containerClass: 'odx-auth-user-profile',
|
|
631
632
|
};
|
|
632
633
|
}
|
|
633
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
634
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
634
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
635
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", 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", "identifier"] }, { 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 }); }
|
|
635
636
|
}
|
|
636
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthComponent, decorators: [{
|
|
637
638
|
type: Component,
|
|
638
639
|
args: [{ standalone: true, selector: 'odx-auth', imports: [
|
|
639
640
|
CoreModule,
|
|
@@ -666,10 +667,10 @@ class AuthDirective {
|
|
|
666
667
|
this.ngIfDirective.ngIf = this.authService.isAuthorized(handler);
|
|
667
668
|
});
|
|
668
669
|
}
|
|
669
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
670
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
670
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
671
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.12", type: AuthDirective, isStandalone: true, selector: "ng-template[odxAuth]", inputs: { authorizationHandler: ["odxAuth", "authorizationHandler"], elseTemplate: ["odxAuthElse", "elseTemplate"] }, hostDirectives: [{ directive: i1.NgIf }], ngImport: i0 }); }
|
|
671
672
|
}
|
|
672
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
673
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthDirective, decorators: [{
|
|
673
674
|
type: Directive,
|
|
674
675
|
args: [{
|
|
675
676
|
standalone: true,
|
|
@@ -716,11 +717,11 @@ function authGuard(authorizedHandler, redirectTo, isExternal = false) {
|
|
|
716
717
|
|
|
717
718
|
const modules = [AuthComponent, AuthDirective, SignInDirective, SignOutDirective];
|
|
718
719
|
class AuthModule {
|
|
719
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
720
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
721
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
720
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
721
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: AuthModule, imports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective], exports: [AuthComponent, AuthDirective, SignInDirective, SignOutDirective] }); }
|
|
722
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthModule, imports: [AuthComponent] }); }
|
|
722
723
|
}
|
|
723
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
724
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthModule, decorators: [{
|
|
724
725
|
type: NgModule,
|
|
725
726
|
args: [{
|
|
726
727
|
imports: [...modules],
|
|
@@ -756,5 +757,5 @@ function unauthGuard(authorizedHandler, redirectTo, isExternal = false) {
|
|
|
756
757
|
* Generated bundle index. Do not edit.
|
|
757
758
|
*/
|
|
758
759
|
|
|
759
|
-
export { AUTH_HTTP_HEADER, AuthActionDirective, AuthActionsComponent, AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthEnvironment, AuthLoadingScreenComponent, AuthModule, AuthPluginManager, AuthService, ODX_AUTH_CORE_PLUGINS, ODX_AUTH_DEFAULT_SCOPES, ODX_AUTH_ERROR_HANDLERS, ODX_AUTH_HOSTS, ODX_AUTH_PLUGINS, ODX_AUTH_PLUGINS_ERROR_HANDLER, ODX_AUTH_USER_PROFILE_HOSTS, SignInDirective, SignOutDirective, authGuard, authInterceptor, coreDebugPlugin, coreIdentityPlugin, createAuthHostUrl, createInitials, handleAuthError, handleOAuthEvent, initalizeAuthConfig, initializeAuthErrorHandlers, injectAuthConfig, offlineAuthErrorHandler, provideAuth, provideAuthConfig, provideAuthLogger, resolveEmail, resolveUsername, setHttpAuthHeader, unauthGuard, userLanguageLoader, userProfileUrlPlugin };
|
|
760
|
+
export { AUTH_HTTP_HEADER, AuthActionDirective, AuthActionsComponent, AuthComponent, AuthConfig, AuthDefaultConfig, AuthDirective, AuthEnvironment, AuthLoadingScreenComponent, AuthModule, AuthPluginManager, AuthService, ODX_AUTH_CORE_PLUGINS, ODX_AUTH_DEFAULT_SCOPES, ODX_AUTH_ERROR_HANDLERS, ODX_AUTH_HOSTS, ODX_AUTH_PLUGINS, ODX_AUTH_PLUGINS_ERROR_HANDLER, ODX_AUTH_USER_PROFILE_HOSTS, SignInDirective, SignOutDirective, authGuard, authInterceptor, coreDebugPlugin, coreIdentityPlugin, createAuthHostUrl, createInitials, handleAuthError, handleOAuthEvent, initalizeAuthConfig, initializeAuthErrorHandlers, injectAuthConfig, offlineAuthErrorHandler, provideAuth, provideAuthConfig, provideAuthLogger, requireAuthentication, resolveEmail, resolveUsername, setHttpAuthHeader, unauthGuard, userLanguageLoader, userProfileUrlPlugin };
|
|
760
761
|
//# sourceMappingURL=odx-auth.mjs.map
|