@acorex-platform/extension-ldap-client 0.0.37

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.
@@ -0,0 +1,33 @@
1
+ //#region ---- Module Config ----
2
+ const config = {
3
+ i18n: 'extensions-ldap',
4
+ module: 'ldap-extension',
5
+ };
6
+ const RootConfig = {
7
+ config,
8
+ module: {
9
+ name: config.module,
10
+ icon: 'fa-solid fa-network-wired',
11
+ },
12
+ };
13
+ //#endregion
14
+
15
+ var AXELdapCommandKeys;
16
+ (function (AXELdapCommandKeys) {
17
+ AXELdapCommandKeys["SignIn"] = "LdapExtension:SignIn";
18
+ })(AXELdapCommandKeys || (AXELdapCommandKeys = {}));
19
+
20
+ var AXELdapQueryKeys;
21
+ (function (AXELdapQueryKeys) {
22
+ AXELdapQueryKeys["GetLoginAvailability"] = "LdapExtension:GetLoginAvailability";
23
+ })(AXELdapQueryKeys || (AXELdapQueryKeys = {}));
24
+
25
+ //#region ---- LDAP sign-in contracts ----
26
+ //#endregion
27
+
28
+ /**
29
+ * Generated bundle index. Do not edit.
30
+ */
31
+
32
+ export { AXELdapCommandKeys, AXELdapQueryKeys, RootConfig };
33
+ //# sourceMappingURL=acorex-platform-extension-ldap-client-contracts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-extension-ldap-client-contracts.mjs","sources":["../../../../libs/extensions/ldap/contracts/src/root-config.ts","../../../../libs/extensions/ldap/contracts/src/commands.keys.ts","../../../../libs/extensions/ldap/contracts/src/queries.keys.ts","../../../../libs/extensions/ldap/contracts/src/ldap.types.ts","../../../../libs/extensions/ldap/contracts/src/acorex-platform-extension-ldap-client-contracts.ts"],"sourcesContent":["//#region ---- Module Config ----\n\nconst config = {\n i18n: 'extensions-ldap',\n module: 'ldap-extension',\n};\n\nexport const RootConfig = {\n config,\n module: {\n name: config.module,\n icon: 'fa-solid fa-network-wired',\n },\n};\n\n//#endregion\n","export enum AXELdapCommandKeys {\n SignIn = 'LdapExtension:SignIn',\n}\n","export enum AXELdapQueryKeys {\n GetLoginAvailability = 'LdapExtension:GetLoginAvailability',\n}\n","//#region ---- LDAP sign-in contracts ----\n\nexport interface AXELdapSignInRequest {\n username: string;\n password: string;\n rememberMe?: boolean;\n}\n\nexport interface AXELdapLoginAvailabilityDto {\n enabled: boolean;\n title?: string | null;\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;AAEA,MAAM,MAAM,GAAG;AACb,IAAA,IAAI,EAAE,iBAAiB;AACvB,IAAA,MAAM,EAAE,gBAAgB;CACzB;AAEM,MAAM,UAAU,GAAG;IACxB,MAAM;AACN,IAAA,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,MAAM;AACnB,QAAA,IAAI,EAAE,2BAA2B;AAClC,KAAA;;AAGH;;ICfY;AAAZ,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,sBAA+B;AACjC,CAAC,EAFW,kBAAkB,KAAlB,kBAAkB,GAAA,EAAA,CAAA,CAAA;;ICAlB;AAAZ,CAAA,UAAY,gBAAgB,EAAA;AAC1B,IAAA,gBAAA,CAAA,sBAAA,CAAA,GAAA,oCAA2D;AAC7D,CAAC,EAFW,gBAAgB,KAAhB,gBAAgB,GAAA,EAAA,CAAA,CAAA;;ACA5B;AAaA;;ACbA;;AAEG;;"}
@@ -0,0 +1,152 @@
1
+ import * as i1 from '@acorex/components/button';
2
+ import { AXButtonModule } from '@acorex/components/button';
3
+ import * as i2 from '@acorex/components/decorators';
4
+ import { AXDecoratorModule } from '@acorex/components/decorators';
5
+ import * as i3 from '@acorex/components/loading';
6
+ import { AXLoadingModule } from '@acorex/components/loading';
7
+ import { AXToastService } from '@acorex/components/toast';
8
+ import * as i5 from '@acorex/core/translation';
9
+ import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
10
+ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
11
+ import { AXPHomePageService } from '@acorex-platform/framework-client/common';
12
+ import * as i4 from '@angular/common';
13
+ import { CommonModule } from '@angular/common';
14
+ import * as i0 from '@angular/core';
15
+ import { inject, signal, ChangeDetectionStrategy, Component } from '@angular/core';
16
+ import { Router, ActivatedRoute } from '@angular/router';
17
+ import { firstValueFrom } from 'rxjs';
18
+
19
+ //#region ---- Imports ----
20
+ //#endregion
21
+ //#region ---- LDAP platform login slot ----
22
+ /**
23
+ * Button-only LDAP login (same layout as Google).
24
+ * Uses username / password / remember-me from the primary login form above the slot.
25
+ */
26
+ class AXELdapPlatformLoginSlotComponent {
27
+ constructor() {
28
+ //#region ----- Services & Dependencies -----
29
+ this.sessionService = inject(AXPSessionService);
30
+ this.toastService = inject(AXToastService);
31
+ this.translationService = inject(AXTranslationService);
32
+ this.router = inject(Router);
33
+ this.activateRoute = inject(ActivatedRoute);
34
+ this.homePageService = inject(AXPHomePageService);
35
+ //#endregion
36
+ //#region ----- State Signals -----
37
+ this.isLoading = signal(false, /* @ts-ignore */
38
+ ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
39
+ }
40
+ //#endregion
41
+ //#region ----- Event Handlers -----
42
+ async handleLdapSignIn() {
43
+ const credentials = this.readPrimaryLoginCredentials();
44
+ if (!credentials.username || !credentials.password) {
45
+ this.toastService.show({
46
+ color: 'warning',
47
+ content: await this.translationService.translateAsync('@auth:authentication.ldap-credentials-required'),
48
+ timeOut: 5000,
49
+ });
50
+ return;
51
+ }
52
+ this.isLoading.set(true);
53
+ try {
54
+ this.sessionService.setStrategy('ldap');
55
+ await this.sessionService.signin({
56
+ strategy: 'ldap',
57
+ username: credentials.username,
58
+ password: credentials.password,
59
+ rememberMe: credentials.rememberMe,
60
+ });
61
+ const isAuthenticated = await firstValueFrom(this.sessionService.isAuthenticated$);
62
+ if (!isAuthenticated) {
63
+ throw new Error('LDAP authentication failed after signin');
64
+ }
65
+ const redirectUrl = this.activateRoute.snapshot.queryParams['redirectUrl'];
66
+ await this.navigateAfterAuth(redirectUrl);
67
+ }
68
+ catch (error) {
69
+ const message = error instanceof Error ? error.message : 'LDAP sign-in failed.';
70
+ this.toastService.show({
71
+ color: 'danger',
72
+ content: message,
73
+ timeOut: 6000,
74
+ });
75
+ this.clearPrimaryPassword();
76
+ }
77
+ finally {
78
+ this.isLoading.set(false);
79
+ }
80
+ }
81
+ //#endregion
82
+ //#region ----- Primary form helpers -----
83
+ /** Reads values from the shared password login form (`#username` / `#password`). */
84
+ readPrimaryLoginCredentials() {
85
+ const form = document.querySelector('.axp-auth-form');
86
+ const usernameInput = this.findFormInput(form, ['#username input', '#username', 'input[name="username"]', 'input[autocomplete="username"]']);
87
+ const passwordInput = this.findFormInput(form, [
88
+ '#password input',
89
+ '#password',
90
+ 'input[name="password"]',
91
+ 'input[autocomplete="current-password"]',
92
+ 'input[type="password"]',
93
+ ]);
94
+ const rememberInput = this.findFormInput(form, ['ax-check-box input[type="checkbox"]', 'input[type="checkbox"]']);
95
+ return {
96
+ username: (usernameInput?.value ?? '').trim(),
97
+ password: passwordInput?.value ?? '',
98
+ rememberMe: rememberInput?.checked === true,
99
+ };
100
+ }
101
+ clearPrimaryPassword() {
102
+ const form = document.querySelector('.axp-auth-form');
103
+ const passwordInput = this.findFormInput(form, [
104
+ '#password input',
105
+ '#password',
106
+ 'input[name="password"]',
107
+ 'input[autocomplete="current-password"]',
108
+ 'input[type="password"]',
109
+ ]);
110
+ if (passwordInput) {
111
+ passwordInput.value = '';
112
+ passwordInput.dispatchEvent(new Event('input', { bubbles: true }));
113
+ passwordInput.dispatchEvent(new Event('change', { bubbles: true }));
114
+ }
115
+ }
116
+ findFormInput(root, selectors) {
117
+ const scope = root ?? document;
118
+ for (const selector of selectors) {
119
+ const el = scope.querySelector(selector);
120
+ if (el instanceof HTMLInputElement) {
121
+ return el;
122
+ }
123
+ }
124
+ return null;
125
+ }
126
+ //#endregion
127
+ //#region ----- Navigation -----
128
+ async navigateAfterAuth(redirectUrl) {
129
+ if (this.sessionService.tenant?.id == null) {
130
+ await this.router.navigate(['/auth/account/tenant-chooser']);
131
+ return;
132
+ }
133
+ if (this.sessionService.application?.id == null) {
134
+ await this.router.navigate(['/auth/account/app-chooser']);
135
+ return;
136
+ }
137
+ if (redirectUrl) {
138
+ await this.router.navigate([redirectUrl]);
139
+ return;
140
+ }
141
+ await this.homePageService.navigateTo();
142
+ }
143
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapPlatformLoginSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
144
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXELdapPlatformLoginSlotComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<ax-button\n class=\"w-full mt-2\"\n text=\"{{ '@auth:authentication.with-ldap' | translate | async }}\"\n [color]=\"'default'\"\n id=\"ldap-platform-login\"\n (onClick)=\"handleLdapSignIn()\"\n [disabled]=\"isLoading()\"\n>\n <ax-prefix>\n <i class=\"fa-solid fa-network-wired\"></i>\n </ax-prefix>\n @if (isLoading()) {\n <ax-loading></ax-loading>\n }\n</ax-button>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "component", type: i3.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
145
+ }
146
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapPlatformLoginSlotComponent, decorators: [{
147
+ type: Component,
148
+ args: [{ changeDetection: ChangeDetectionStrategy.Eager, imports: [CommonModule, AXButtonModule, AXDecoratorModule, AXLoadingModule, AXTranslationModule], template: "<ax-button\n class=\"w-full mt-2\"\n text=\"{{ '@auth:authentication.with-ldap' | translate | async }}\"\n [color]=\"'default'\"\n id=\"ldap-platform-login\"\n (onClick)=\"handleLdapSignIn()\"\n [disabled]=\"isLoading()\"\n>\n <ax-prefix>\n <i class=\"fa-solid fa-network-wired\"></i>\n </ax-prefix>\n @if (isLoading()) {\n <ax-loading></ax-loading>\n }\n</ax-button>\n" }]
149
+ }] });
150
+
151
+ export { AXELdapPlatformLoginSlotComponent };
152
+ //# sourceMappingURL=acorex-platform-extension-ldap-client-ldap-platform-login-slot.component-Chybz4v5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-extension-ldap-client-ldap-platform-login-slot.component-Chybz4v5.mjs","sources":["../../../../libs/extensions/ldap/client/src/lib/platform-auth/ldap-platform-login-slot.component.ts","../../../../libs/extensions/ldap/client/src/lib/platform-auth/ldap-platform-login-slot.component.html"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPHomePageService } from '@acorex-platform/framework-client/common';\nimport { CommonModule } from '@angular/common';\nimport { Component, inject, signal, ChangeDetectionStrategy } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { firstValueFrom } from 'rxjs';\n\n//#endregion\n\n//#region ---- Types ----\n\ninterface PrimaryLoginCredentials {\n username: string;\n password: string;\n rememberMe: boolean;\n}\n\n//#endregion\n\n//#region ---- LDAP platform login slot ----\n\n/**\n * Button-only LDAP login (same layout as Google).\n * Uses username / password / remember-me from the primary login form above the slot.\n */\n@Component({\n templateUrl: './ldap-platform-login-slot.component.html',\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [CommonModule, AXButtonModule, AXDecoratorModule, AXLoadingModule, AXTranslationModule],\n})\nexport class AXELdapPlatformLoginSlotComponent {\n //#region ----- Services & Dependencies -----\n\n private readonly sessionService = inject(AXPSessionService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly router = inject(Router);\n private readonly activateRoute = inject(ActivatedRoute);\n private readonly homePageService = inject(AXPHomePageService);\n\n //#endregion\n\n //#region ----- State Signals -----\n\n protected isLoading = signal(false);\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected async handleLdapSignIn(): Promise<void> {\n const credentials = this.readPrimaryLoginCredentials();\n if (!credentials.username || !credentials.password) {\n this.toastService.show({\n color: 'warning',\n content: await this.translationService.translateAsync(\n '@auth:authentication.ldap-credentials-required',\n ),\n timeOut: 5000,\n });\n return;\n }\n\n this.isLoading.set(true);\n try {\n this.sessionService.setStrategy('ldap');\n await this.sessionService.signin({\n strategy: 'ldap',\n username: credentials.username,\n password: credentials.password,\n rememberMe: credentials.rememberMe,\n });\n\n const isAuthenticated = await firstValueFrom(this.sessionService.isAuthenticated$);\n if (!isAuthenticated) {\n throw new Error('LDAP authentication failed after signin');\n }\n\n const redirectUrl = this.activateRoute.snapshot.queryParams['redirectUrl'];\n await this.navigateAfterAuth(redirectUrl);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'LDAP sign-in failed.';\n this.toastService.show({\n color: 'danger',\n content: message,\n timeOut: 6000,\n });\n this.clearPrimaryPassword();\n } finally {\n this.isLoading.set(false);\n }\n }\n\n //#endregion\n\n //#region ----- Primary form helpers -----\n\n /** Reads values from the shared password login form (`#username` / `#password`). */\n private readPrimaryLoginCredentials(): PrimaryLoginCredentials {\n const form = document.querySelector('.axp-auth-form');\n const usernameInput = this.findFormInput(form, ['#username input', '#username', 'input[name=\"username\"]', 'input[autocomplete=\"username\"]']);\n const passwordInput = this.findFormInput(form, [\n '#password input',\n '#password',\n 'input[name=\"password\"]',\n 'input[autocomplete=\"current-password\"]',\n 'input[type=\"password\"]',\n ]);\n const rememberInput = this.findFormInput(form, ['ax-check-box input[type=\"checkbox\"]', 'input[type=\"checkbox\"]']);\n\n return {\n username: (usernameInput?.value ?? '').trim(),\n password: passwordInput?.value ?? '',\n rememberMe: rememberInput?.checked === true,\n };\n }\n\n private clearPrimaryPassword(): void {\n const form = document.querySelector('.axp-auth-form');\n const passwordInput = this.findFormInput(form, [\n '#password input',\n '#password',\n 'input[name=\"password\"]',\n 'input[autocomplete=\"current-password\"]',\n 'input[type=\"password\"]',\n ]);\n if (passwordInput) {\n passwordInput.value = '';\n passwordInput.dispatchEvent(new Event('input', { bubbles: true }));\n passwordInput.dispatchEvent(new Event('change', { bubbles: true }));\n }\n }\n\n private findFormInput(root: Element | null, selectors: string[]): HTMLInputElement | null {\n const scope: ParentNode = root ?? document;\n for (const selector of selectors) {\n const el = scope.querySelector(selector);\n if (el instanceof HTMLInputElement) {\n return el;\n }\n }\n return null;\n }\n\n //#endregion\n\n //#region ----- Navigation -----\n\n private async navigateAfterAuth(redirectUrl?: string): Promise<void> {\n if (this.sessionService.tenant?.id == null) {\n await this.router.navigate(['/auth/account/tenant-chooser']);\n return;\n }\n\n if (this.sessionService.application?.id == null) {\n await this.router.navigate(['/auth/account/app-chooser']);\n return;\n }\n\n if (redirectUrl) {\n await this.router.navigate([redirectUrl]);\n return;\n }\n\n await this.homePageService.navigateTo();\n }\n\n //#endregion\n}\n\n//#endregion\n","<ax-button\n class=\"w-full mt-2\"\n text=\"{{ '@auth:authentication.with-ldap' | translate | async }}\"\n [color]=\"'default'\"\n id=\"ldap-platform-login\"\n (onClick)=\"handleLdapSignIn()\"\n [disabled]=\"isLoading()\"\n>\n <ax-prefix>\n <i class=\"fa-solid fa-network-wired\"></i>\n </ax-prefix>\n @if (isLoading()) {\n <ax-loading></ax-loading>\n }\n</ax-button>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAwBA;AAEA;AAEA;;;AAGG;MAMU,iCAAiC,CAAA;AAL9C,IAAA,WAAA,GAAA;;AAQmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC;;;QAMnD,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,KAAK;sFAAC;AA4HpC,IAAA;;;AAtHW,IAAA,MAAM,gBAAgB,GAAA;AAC9B,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,2BAA2B,EAAE;QACtD,IAAI,CAAC,WAAW,CAAC,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;AAClD,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;AACrB,gBAAA,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CACnD,gDAAgD,CACjD;AACD,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA,CA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 from '@acorex-platform/framework-client/auth';
2
+ import { AXPAuthStrategy, AXPSessionService, TimeUtil, AXPAuthModule } from '@acorex-platform/framework-client/auth';
3
+ import * as i1 from '@acorex-platform/framework-client/core';
4
+ import { AUTH_LOGIN_EXTERNAL_PROVIDERS_SLOT } from '@acorex-platform/module-auth-client';
5
+ import * as i0 from '@angular/core';
6
+ import { inject, Injectable, NgModule } from '@angular/core';
7
+ import { runtimeCommandPayloadData, runtimeQueryPayloadData } from '@acorex-platform/framework-shared/core';
8
+ import { AXPCommandService, AXPQueryService } from '@acorex-platform/framework-client/runtime';
9
+ import { commandMessageTextForError } from '@acorex-platform/framework-client/common';
10
+ import { AUTH_LOGOUT_DEFAULT, AUTH_REFRESH_DEFAULT, AUTH_UPDATE_SESSION_DEFAULT } from '@acorex-platform/framework-shared/runtime';
11
+ import { AXELdapCommandKeys, AXELdapQueryKeys } from '@acorex-platform/extension-ldap-client/contracts';
12
+
13
+ //#region ---- Imports ----
14
+ class AXELdapAuthApiError extends Error {
15
+ constructor(message, apiError, status) {
16
+ super(message);
17
+ this.apiError = apiError;
18
+ this.status = status;
19
+ this.name = 'AXELdapAuthApiError';
20
+ }
21
+ }
22
+ //#endregion
23
+ //#region ---- LDAP platform auth strategy ----
24
+ class AXELdapPlatformAuthStrategy extends AXPAuthStrategy {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.commandService = inject(AXPCommandService);
28
+ this.sessionService = inject(AXPSessionService);
29
+ }
30
+ get name() {
31
+ return 'ldap';
32
+ }
33
+ async signin(credentials) {
34
+ const result = await this.executeAuthCommand(AXELdapCommandKeys.SignIn, {
35
+ username: credentials.username,
36
+ password: credentials.password,
37
+ ...(credentials.rememberMe === true ? { rememberMe: true } : { rememberMe: false }),
38
+ });
39
+ return this.toSignInResult(result);
40
+ }
41
+ async signout() {
42
+ try {
43
+ await this.commandService.execute(AUTH_LOGOUT_DEFAULT, {});
44
+ }
45
+ catch {
46
+ // Ignore logout network errors; client session is cleared regardless.
47
+ }
48
+ }
49
+ async refreshToken(context) {
50
+ const result = await this.executeAuthCommand(AUTH_REFRESH_DEFAULT, {});
51
+ return this.toSignInResult(result, context);
52
+ }
53
+ async updateToken(params) {
54
+ if (!this.sessionService.hasSessionCredentials()) {
55
+ throw new Error('Access session not found');
56
+ }
57
+ const tenant = params['tenant'];
58
+ const application = params['application'];
59
+ const result = await this.executeAuthCommand(AUTH_UPDATE_SESSION_DEFAULT, {
60
+ tenantId: params['tenantId'] ?? tenant?.id,
61
+ applicationId: params['applicationId'] ?? application?.id,
62
+ tenant,
63
+ application,
64
+ });
65
+ return this.toSignInResult(result, {
66
+ user: params['user'] ?? this.sessionService.user,
67
+ tenant: tenant ?? null,
68
+ application: application ?? null,
69
+ });
70
+ }
71
+ async executeAuthCommand(key, input) {
72
+ const result = await this.commandService.execute(key, input);
73
+ const data = runtimeCommandPayloadData(result);
74
+ if (data == null) {
75
+ const message = commandMessageTextForError(result?.message?.text) || 'LDAP authentication failed';
76
+ const details = result?.message?.details &&
77
+ typeof result.message.details === 'object' &&
78
+ !Array.isArray(result.message.details)
79
+ ? result.message.details
80
+ : {};
81
+ throw new AXELdapAuthApiError(message, {
82
+ message,
83
+ ...(typeof result?.message?.code === 'string'
84
+ ? { code: result.message.code, error: result.message.code }
85
+ : {}),
86
+ ...details,
87
+ }, typeof details.status === 'number'
88
+ ? details.status
89
+ : undefined);
90
+ }
91
+ return data;
92
+ }
93
+ toSignInResult(result, context) {
94
+ return {
95
+ succeed: true,
96
+ data: {
97
+ accessToken: result.accessToken,
98
+ refreshToken: result.refreshToken,
99
+ expiresIn: this.parseExpiresIn(result.expiresIn),
100
+ user: result.user,
101
+ tenant: this.mergeTenant(this.mapTenant(result.tenant), context?.tenant ?? null),
102
+ application: this.mergeApplication(this.mapApplication(result.application), context?.application ?? null),
103
+ },
104
+ };
105
+ }
106
+ mergeTenant(mapped, contextTenant) {
107
+ if (!mapped && !contextTenant) {
108
+ return null;
109
+ }
110
+ if (!mapped) {
111
+ return contextTenant;
112
+ }
113
+ if (!contextTenant) {
114
+ return mapped;
115
+ }
116
+ return {
117
+ ...contextTenant,
118
+ ...mapped,
119
+ title: mapped.title && mapped.title !== mapped.id ? mapped.title : contextTenant.title || mapped.title,
120
+ name: mapped.name && mapped.name !== mapped.id ? mapped.name : contextTenant.name || mapped.name,
121
+ };
122
+ }
123
+ mergeApplication(mapped, contextApplication) {
124
+ if (!mapped && !contextApplication) {
125
+ return null;
126
+ }
127
+ if (!mapped) {
128
+ return contextApplication;
129
+ }
130
+ if (!contextApplication) {
131
+ return mapped;
132
+ }
133
+ return {
134
+ ...contextApplication,
135
+ ...mapped,
136
+ edition: mapped.edition ?? contextApplication.edition,
137
+ version: mapped.version ?? contextApplication.version,
138
+ logoUrl: mapped.logoUrl ?? contextApplication.logoUrl,
139
+ description: mapped.description ?? contextApplication.description,
140
+ };
141
+ }
142
+ mapTenant(tenant) {
143
+ if (!tenant?.id) {
144
+ return null;
145
+ }
146
+ return {
147
+ id: tenant.id,
148
+ name: tenant.name ?? tenant.id,
149
+ title: tenant.title ?? tenant.name ?? tenant.id,
150
+ };
151
+ }
152
+ mapApplication(application) {
153
+ if (!application?.id) {
154
+ return null;
155
+ }
156
+ return {
157
+ id: application.id,
158
+ name: application.name ?? application.id,
159
+ title: application.title ?? application.name,
160
+ };
161
+ }
162
+ parseExpiresIn(expiresIn) {
163
+ if (!expiresIn) {
164
+ return null;
165
+ }
166
+ const match = /^(\d+)([smhd])$/i.exec(expiresIn.trim());
167
+ if (!match) {
168
+ return null;
169
+ }
170
+ const value = Number(match[1]);
171
+ const unit = match[2].toLowerCase();
172
+ const multipliers = { s: 1, m: 60, h: 3600, d: 86400 };
173
+ return TimeUtil.calculateExpireInDate(value * multipliers[unit]);
174
+ }
175
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapPlatformAuthStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
176
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapPlatformAuthStrategy }); }
177
+ }
178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapPlatformAuthStrategy, decorators: [{
179
+ type: Injectable
180
+ }] });
181
+
182
+ //#region ---- Imports ----
183
+ //#endregion
184
+ //#region ---- LDAP login availability ----
185
+ class AXELdapPlatformLoginAvailabilityService {
186
+ constructor() {
187
+ this.queryService = inject(AXPQueryService);
188
+ this.cached = null;
189
+ }
190
+ async isEnabled() {
191
+ const availability = await this.loadAvailability();
192
+ return availability.enabled;
193
+ }
194
+ async getTitle() {
195
+ const availability = await this.loadAvailability();
196
+ return availability.title ?? null;
197
+ }
198
+ async loadAvailability() {
199
+ if (this.cached) {
200
+ return this.cached;
201
+ }
202
+ try {
203
+ const result = await this.queryService.fetch(AXELdapQueryKeys.GetLoginAvailability, undefined);
204
+ const data = runtimeQueryPayloadData(result);
205
+ this.cached = data ?? { enabled: false };
206
+ return this.cached;
207
+ }
208
+ catch {
209
+ this.cached = { enabled: false };
210
+ return this.cached;
211
+ }
212
+ }
213
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapPlatformLoginAvailabilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
214
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapPlatformLoginAvailabilityService }); }
215
+ }
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapPlatformLoginAvailabilityService, decorators: [{
217
+ type: Injectable
218
+ }] });
219
+
220
+ //#region ---- Imports ----
221
+ //#endregion
222
+ //#region ---- Module ----
223
+ /**
224
+ * LDAP / Active Directory platform login extension.
225
+ * Uses server-side directory bind via `LdapExtension:SignIn` (does not alter `Auth:SignIn` / user-pass).
226
+ */
227
+ class AXELdapExtensionModule {
228
+ constructor(registry, ldapLogin) {
229
+ registry.register(AUTH_LOGIN_EXTERNAL_PROVIDERS_SLOT, {
230
+ name: 'ldap-platform-login',
231
+ priority: 5,
232
+ loadComponent: () => import('./acorex-platform-extension-ldap-client-ldap-platform-login-slot.component-Chybz4v5.mjs').then((component) => component.AXELdapPlatformLoginSlotComponent),
233
+ condition: () => ldapLogin.isEnabled(),
234
+ });
235
+ }
236
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapExtensionModule, deps: [{ token: i1.AXPComponentSlotRegistryService }, { token: AXELdapPlatformLoginAvailabilityService }], target: i0.ɵɵFactoryTarget.NgModule }); }
237
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXELdapExtensionModule, imports: [i3.AXPAuthModule] }); }
238
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapExtensionModule, providers: [AXELdapPlatformLoginAvailabilityService], imports: [AXPAuthModule.forChild({ strategies: [AXELdapPlatformAuthStrategy] })] }); }
239
+ }
240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXELdapExtensionModule, decorators: [{
241
+ type: NgModule,
242
+ args: [{
243
+ imports: [AXPAuthModule.forChild({ strategies: [AXELdapPlatformAuthStrategy] })],
244
+ providers: [AXELdapPlatformLoginAvailabilityService],
245
+ }]
246
+ }], ctorParameters: () => [{ type: i1.AXPComponentSlotRegistryService }, { type: AXELdapPlatformLoginAvailabilityService }] });
247
+
248
+ /**
249
+ * Generated bundle index. Do not edit.
250
+ */
251
+
252
+ export { AXELdapAuthApiError, AXELdapExtensionModule, AXELdapPlatformAuthStrategy, AXELdapPlatformLoginAvailabilityService };
253
+ //# sourceMappingURL=acorex-platform-extension-ldap-client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-extension-ldap-client.mjs","sources":["../../../../libs/extensions/ldap/client/src/lib/platform-auth/ldap-platform-auth.strategy.ts","../../../../libs/extensions/ldap/client/src/lib/platform-auth/ldap-platform-login-availability.service.ts","../../../../libs/extensions/ldap/client/src/lib/ldap-extension.module.ts","../../../../libs/extensions/ldap/client/src/acorex-platform-extension-ldap-client.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport {\n runtimeCommandPayloadData,\n type AXPMultiLanguageString,\n} from '@acorex-platform/framework-shared/core';\nimport {\n AXPApplication,\n AXPAuthStrategy,\n AXPBaseCredentials,\n AXPSessionContext,\n AXPSessionService,\n AXPSignInResult,\n AXPTenant,\n AXPUser,\n TimeUtil,\n} from '@acorex-platform/framework-client/auth';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { commandMessageTextForError } from '@acorex-platform/framework-client/common';\nimport {\n AUTH_LOGOUT_DEFAULT,\n AUTH_REFRESH_DEFAULT,\n AUTH_UPDATE_SESSION_DEFAULT,\n} from '@acorex-platform/framework-shared/runtime';\nimport { AXELdapCommandKeys } from '@acorex-platform/extension-ldap-client/contracts';\nimport { Injectable, inject } from '@angular/core';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface AXELdapCredentials extends AXPBaseCredentials {\n username: string;\n password: string;\n rememberMe?: boolean;\n}\n\ninterface AuthTokenResponseDto {\n accessToken: string;\n refreshToken: string;\n expiresIn?: string;\n user: AXPUser;\n tenant?: { id: string; name?: string; title?: AXPMultiLanguageString } | null;\n application?: { id: string; name?: string; title?: AXPMultiLanguageString } | null;\n}\n\nexport class AXELdapAuthApiError extends Error {\n constructor(\n message: string,\n readonly apiError?: Record<string, unknown>,\n readonly status?: number,\n ) {\n super(message);\n this.name = 'AXELdapAuthApiError';\n }\n}\n\n//#endregion\n\n//#region ---- LDAP platform auth strategy ----\n\n@Injectable()\nexport class AXELdapPlatformAuthStrategy extends AXPAuthStrategy {\n private readonly commandService = inject(AXPCommandService);\n private readonly sessionService = inject(AXPSessionService);\n\n get name(): string {\n return 'ldap';\n }\n\n async signin(credentials: AXELdapCredentials): Promise<AXPSignInResult> {\n const result = await this.executeAuthCommand<AuthTokenResponseDto>(AXELdapCommandKeys.SignIn, {\n username: credentials.username,\n password: credentials.password,\n ...(credentials.rememberMe === true ? { rememberMe: true } : { rememberMe: false }),\n });\n\n return this.toSignInResult(result);\n }\n\n async signout(): Promise<void> {\n try {\n await this.commandService.execute(AUTH_LOGOUT_DEFAULT, {});\n } catch {\n // Ignore logout network errors; client session is cleared regardless.\n }\n }\n\n async refreshToken(context: AXPSessionContext): Promise<AXPSignInResult> {\n const result = await this.executeAuthCommand<AuthTokenResponseDto>(AUTH_REFRESH_DEFAULT, {});\n return this.toSignInResult(result, context);\n }\n\n override async updateToken(params: { [key: string]: unknown }): Promise<AXPSignInResult> {\n if (!this.sessionService.hasSessionCredentials()) {\n throw new Error('Access session not found');\n }\n\n const tenant = params['tenant'] as AXPTenant | undefined;\n const application = params['application'] as AXPApplication | undefined;\n\n const result = await this.executeAuthCommand<AuthTokenResponseDto>(AUTH_UPDATE_SESSION_DEFAULT, {\n tenantId: params['tenantId'] ?? tenant?.id,\n applicationId: params['applicationId'] ?? application?.id,\n tenant,\n application,\n });\n\n return this.toSignInResult(result, {\n user: (params['user'] as AXPUser) ?? this.sessionService.user,\n tenant: tenant ?? null,\n application: application ?? null,\n });\n }\n\n private async executeAuthCommand<T>(key: string, input: unknown): Promise<T> {\n const result = await this.commandService.execute<unknown, T>(key, input);\n const data = runtimeCommandPayloadData(result);\n if (data == null) {\n const message = commandMessageTextForError(result?.message?.text) || 'LDAP authentication failed';\n const details =\n result?.message?.details &&\n typeof result.message.details === 'object' &&\n !Array.isArray(result.message.details)\n ? (result.message.details as Record<string, unknown>)\n : {};\n throw new AXELdapAuthApiError(\n message,\n {\n message,\n ...(typeof result?.message?.code === 'string'\n ? { code: result.message.code, error: result.message.code }\n : {}),\n ...details,\n },\n typeof (details as { status?: unknown }).status === 'number'\n ? (details as { status: number }).status\n : undefined,\n );\n }\n\n return data;\n }\n\n private toSignInResult(result: AuthTokenResponseDto, context?: Partial<AXPSessionContext>): AXPSignInResult {\n return {\n succeed: true,\n data: {\n accessToken: result.accessToken,\n refreshToken: result.refreshToken,\n expiresIn: this.parseExpiresIn(result.expiresIn),\n user: result.user,\n tenant: this.mergeTenant(this.mapTenant(result.tenant), context?.tenant ?? null),\n application: this.mergeApplication(this.mapApplication(result.application), context?.application ?? null),\n },\n };\n }\n\n private mergeTenant(mapped: AXPTenant | null, contextTenant: AXPTenant | null): AXPTenant | null {\n if (!mapped && !contextTenant) {\n return null;\n }\n if (!mapped) {\n return contextTenant;\n }\n if (!contextTenant) {\n return mapped;\n }\n return {\n ...contextTenant,\n ...mapped,\n title: mapped.title && mapped.title !== mapped.id ? mapped.title : contextTenant.title || mapped.title,\n name: mapped.name && mapped.name !== mapped.id ? mapped.name : contextTenant.name || mapped.name,\n };\n }\n\n private mergeApplication(\n mapped: AXPApplication | null,\n contextApplication: AXPApplication | null,\n ): AXPApplication | null {\n if (!mapped && !contextApplication) {\n return null;\n }\n if (!mapped) {\n return contextApplication;\n }\n if (!contextApplication) {\n return mapped;\n }\n return {\n ...contextApplication,\n ...mapped,\n edition: mapped.edition ?? contextApplication.edition,\n version: mapped.version ?? contextApplication.version,\n logoUrl: mapped.logoUrl ?? contextApplication.logoUrl,\n description: mapped.description ?? contextApplication.description,\n };\n }\n\n private mapTenant(\n tenant?: { id: string; name?: string; title?: AXPMultiLanguageString } | null,\n ): AXPTenant | null {\n if (!tenant?.id) {\n return null;\n }\n return {\n id: tenant.id,\n name: tenant.name ?? tenant.id,\n title: tenant.title ?? tenant.name ?? tenant.id,\n };\n }\n\n private mapApplication(\n application?: { id: string; name?: string; title?: AXPMultiLanguageString } | null,\n ): AXPApplication | null {\n if (!application?.id) {\n return null;\n }\n return {\n id: application.id,\n name: application.name ?? application.id,\n title: application.title ?? application.name,\n };\n }\n\n private parseExpiresIn(expiresIn?: string): string | null {\n if (!expiresIn) {\n return null;\n }\n const match = /^(\\d+)([smhd])$/i.exec(expiresIn.trim());\n if (!match) {\n return null;\n }\n const value = Number(match[1]);\n const unit = match[2].toLowerCase();\n const multipliers: Record<string, number> = { s: 1, m: 60, h: 3600, d: 86400 };\n return TimeUtil.calculateExpireInDate(value * multipliers[unit]);\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { runtimeQueryPayloadData } from '@acorex-platform/framework-shared/core';\nimport { AXPQueryService } from '@acorex-platform/framework-client/runtime';\nimport {\n AXELdapQueryKeys,\n type AXELdapLoginAvailabilityDto,\n} from '@acorex-platform/extension-ldap-client/contracts';\nimport { Injectable, inject } from '@angular/core';\n\n//#endregion\n\n//#region ---- LDAP login availability ----\n\n@Injectable()\nexport class AXELdapPlatformLoginAvailabilityService {\n private readonly queryService = inject(AXPQueryService);\n private cached: AXELdapLoginAvailabilityDto | null = null;\n\n async isEnabled(): Promise<boolean> {\n const availability = await this.loadAvailability();\n return availability.enabled;\n }\n\n async getTitle(): Promise<string | null> {\n const availability = await this.loadAvailability();\n return availability.title ?? null;\n }\n\n private async loadAvailability(): Promise<AXELdapLoginAvailabilityDto> {\n if (this.cached) {\n return this.cached;\n }\n\n try {\n const result = await this.queryService.fetch<void, AXELdapLoginAvailabilityDto>(\n AXELdapQueryKeys.GetLoginAvailability,\n undefined,\n );\n const data = runtimeQueryPayloadData(result);\n this.cached = data ?? { enabled: false };\n return this.cached;\n } catch {\n this.cached = { enabled: false };\n return this.cached;\n }\n }\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPAuthModule } from '@acorex-platform/framework-client/auth';\nimport { AXPComponentSlotRegistryService } from '@acorex-platform/framework-client/core';\nimport { AUTH_LOGIN_EXTERNAL_PROVIDERS_SLOT } from '@acorex-platform/module-auth-client';\nimport { NgModule } from '@angular/core';\nimport { AXELdapPlatformAuthStrategy } from './platform-auth/ldap-platform-auth.strategy';\nimport { AXELdapPlatformLoginAvailabilityService } from './platform-auth/ldap-platform-login-availability.service';\n\n//#endregion\n\n//#region ---- Module ----\n\n/**\n * LDAP / Active Directory platform login extension.\n * Uses server-side directory bind via `LdapExtension:SignIn` (does not alter `Auth:SignIn` / user-pass).\n */\n@NgModule({\n imports: [AXPAuthModule.forChild({ strategies: [AXELdapPlatformAuthStrategy] })],\n providers: [AXELdapPlatformLoginAvailabilityService],\n})\nexport class AXELdapExtensionModule {\n constructor(\n registry: AXPComponentSlotRegistryService,\n ldapLogin: AXELdapPlatformLoginAvailabilityService,\n ) {\n registry.register(AUTH_LOGIN_EXTERNAL_PROVIDERS_SLOT, {\n name: 'ldap-platform-login',\n priority: 5,\n loadComponent: () =>\n import('./platform-auth/ldap-platform-login-slot.component').then(\n (component) => component.AXELdapPlatformLoginSlotComponent,\n ),\n condition: () => ldapLogin.isEnabled(),\n });\n }\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.AXELdapPlatformLoginAvailabilityService"],"mappings":";;;;;;;;;;;;AAAA;AA8CM,MAAO,mBAAoB,SAAQ,KAAK,CAAA;AAC5C,IAAA,WAAA,CACE,OAAe,EACN,QAAkC,EAClC,MAAe,EAAA;QAExB,KAAK,CAAC,OAAO,CAAC;QAHL,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,MAAM,GAAN,MAAM;AAGf,QAAA,IAAI,CAAC,IAAI,GAAG,qBAAqB;IACnC;AACD;AAED;AAEA;AAGM,MAAO,2BAA4B,SAAQ,eAAe,CAAA;AADhE,IAAA,WAAA,GAAA;;AAEmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AA8K5D,IAAA;AA5KC,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,O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A,EAAA,KAAA,EAAAA,uCAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAtB,sBAAsB,EAAA,OAAA,EAAA,CAAA,EAAA,CAAA,aAAA,CAAA,EAAA,CAAA,CAAA;AAAtB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,aAFtB,CAAC,uCAAuC,CAAC,EAAA,OAAA,EAAA,CAD1C,aAAa,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAA,EAAA,CAAA,CAAA;;2FAGpE,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAC;oBAChF,SAAS,EAAE,CAAC,uCAAuC,CAAC;AACrD,iBAAA;;;ACpBD;;AAEG;;"}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@acorex-platform/extension-ldap-client",
3
+ "version": "0.0.37",
4
+ "sideEffects": false,
5
+ "peerDependencies": {
6
+ "@angular/common": "^21.0.0 || ^22.0.0",
7
+ "@angular/core": "^21.0.0 || ^22.0.0"
8
+ },
9
+ "dependencies": {
10
+ "tslib": "^2.3.0"
11
+ },
12
+ "module": "fesm2022/acorex-platform-extension-ldap-client.mjs",
13
+ "typings": "types/acorex-platform-extension-ldap-client.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./types/acorex-platform-extension-ldap-client.d.ts",
20
+ "default": "./fesm2022/acorex-platform-extension-ldap-client.mjs"
21
+ },
22
+ "./contracts": {
23
+ "types": "./types/acorex-platform-extension-ldap-client-contracts.d.ts",
24
+ "default": "./fesm2022/acorex-platform-extension-ldap-client-contracts.mjs"
25
+ }
26
+ },
27
+ "type": "module"
28
+ }
@@ -0,0 +1,31 @@
1
+ declare const RootConfig: {
2
+ config: {
3
+ i18n: string;
4
+ module: string;
5
+ };
6
+ module: {
7
+ name: string;
8
+ icon: string;
9
+ };
10
+ };
11
+
12
+ declare enum AXELdapCommandKeys {
13
+ SignIn = "LdapExtension:SignIn"
14
+ }
15
+
16
+ declare enum AXELdapQueryKeys {
17
+ GetLoginAvailability = "LdapExtension:GetLoginAvailability"
18
+ }
19
+
20
+ interface AXELdapSignInRequest {
21
+ username: string;
22
+ password: string;
23
+ rememberMe?: boolean;
24
+ }
25
+ interface AXELdapLoginAvailabilityDto {
26
+ enabled: boolean;
27
+ title?: string | null;
28
+ }
29
+
30
+ export { AXELdapCommandKeys, AXELdapQueryKeys, RootConfig };
31
+ export type { AXELdapLoginAvailabilityDto, AXELdapSignInRequest };
@@ -0,0 +1,59 @@
1
+ import { AXPComponentSlotRegistryService } from '@acorex-platform/framework-client/core';
2
+ import * as i0 from '@angular/core';
3
+ import * as i1 from '@acorex-platform/framework-client/auth';
4
+ import { AXPBaseCredentials, AXPAuthStrategy, AXPSignInResult, AXPSessionContext } from '@acorex-platform/framework-client/auth';
5
+
6
+ declare class AXELdapPlatformLoginAvailabilityService {
7
+ private readonly queryService;
8
+ private cached;
9
+ isEnabled(): Promise<boolean>;
10
+ getTitle(): Promise<string | null>;
11
+ private loadAvailability;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXELdapPlatformLoginAvailabilityService, never>;
13
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXELdapPlatformLoginAvailabilityService>;
14
+ }
15
+
16
+ /**
17
+ * LDAP / Active Directory platform login extension.
18
+ * Uses server-side directory bind via `LdapExtension:SignIn` (does not alter `Auth:SignIn` / user-pass).
19
+ */
20
+ declare class AXELdapExtensionModule {
21
+ constructor(registry: AXPComponentSlotRegistryService, ldapLogin: AXELdapPlatformLoginAvailabilityService);
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXELdapExtensionModule, never>;
23
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AXELdapExtensionModule, never, [typeof i1.AXPAuthModule], never>;
24
+ static ɵinj: i0.ɵɵInjectorDeclaration<AXELdapExtensionModule>;
25
+ }
26
+
27
+ interface AXELdapCredentials extends AXPBaseCredentials {
28
+ username: string;
29
+ password: string;
30
+ rememberMe?: boolean;
31
+ }
32
+ declare class AXELdapAuthApiError extends Error {
33
+ readonly apiError?: Record<string, unknown> | undefined;
34
+ readonly status?: number | undefined;
35
+ constructor(message: string, apiError?: Record<string, unknown> | undefined, status?: number | undefined);
36
+ }
37
+ declare class AXELdapPlatformAuthStrategy extends AXPAuthStrategy {
38
+ private readonly commandService;
39
+ private readonly sessionService;
40
+ get name(): string;
41
+ signin(credentials: AXELdapCredentials): Promise<AXPSignInResult>;
42
+ signout(): Promise<void>;
43
+ refreshToken(context: AXPSessionContext): Promise<AXPSignInResult>;
44
+ updateToken(params: {
45
+ [key: string]: unknown;
46
+ }): Promise<AXPSignInResult>;
47
+ private executeAuthCommand;
48
+ private toSignInResult;
49
+ private mergeTenant;
50
+ private mergeApplication;
51
+ private mapTenant;
52
+ private mapApplication;
53
+ private parseExpiresIn;
54
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXELdapPlatformAuthStrategy, never>;
55
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXELdapPlatformAuthStrategy>;
56
+ }
57
+
58
+ export { AXELdapAuthApiError, AXELdapExtensionModule, AXELdapPlatformAuthStrategy, AXELdapPlatformLoginAvailabilityService };
59
+ export type { AXELdapCredentials };