@acorex-platform/module-auth-server 0.0.15 → 2.0.0-next.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/contracts/src/commands.keys.d.ts +10 -0
  2. package/contracts/src/commands.keys.js +11 -1
  3. package/contracts/src/commands.keys.js.map +1 -1
  4. package/contracts/src/index.d.ts +1 -1
  5. package/contracts/src/index.js +1 -1
  6. package/contracts/src/index.js.map +1 -1
  7. package/contracts/src/menu.keys.js.map +1 -1
  8. package/contracts/src/permission.keys.d.ts +12 -2
  9. package/contracts/src/permission.keys.js +12 -3
  10. package/contracts/src/permission.keys.js.map +1 -1
  11. package/contracts/src/queries.keys.d.ts +6 -0
  12. package/contracts/src/queries.keys.js +12 -0
  13. package/contracts/src/queries.keys.js.map +1 -0
  14. package/contracts/src/root-config.d.ts +9 -0
  15. package/contracts/src/root-config.js +9 -0
  16. package/contracts/src/root-config.js.map +1 -1
  17. package/contracts/src/settings.keys.d.ts +55 -2
  18. package/contracts/src/settings.keys.js +92 -2
  19. package/contracts/src/settings.keys.js.map +1 -1
  20. package/package.json +19 -13
  21. package/server/src/index.js.map +1 -0
  22. package/server/src/lib/auth-lockout-settings.service.d.ts +9 -0
  23. package/server/src/lib/auth-lockout-settings.service.js +51 -0
  24. package/server/src/lib/auth-lockout-settings.service.js.map +1 -0
  25. package/server/src/lib/auth-max-device-sessions-settings.service.d.ts +8 -0
  26. package/server/src/lib/auth-max-device-sessions-settings.service.js +48 -0
  27. package/server/src/lib/auth-max-device-sessions-settings.service.js.map +1 -0
  28. package/server/src/lib/auth-server.module.js +53 -0
  29. package/server/src/lib/auth-server.module.js.map +1 -0
  30. package/server/src/lib/inactive-session/auth-device-session-activity.interceptor.d.ts +14 -0
  31. package/server/src/lib/inactive-session/auth-device-session-activity.interceptor.js +77 -0
  32. package/server/src/lib/inactive-session/auth-device-session-activity.interceptor.js.map +1 -0
  33. package/server/src/lib/inactive-session/auth-inactive-session-termination-purge.command.d.ts +7 -0
  34. package/server/src/lib/inactive-session/auth-inactive-session-termination-purge.command.js +39 -0
  35. package/server/src/lib/inactive-session/auth-inactive-session-termination-purge.command.js.map +1 -0
  36. package/server/src/lib/inactive-session/auth-inactive-session-termination-settings.service.d.ts +9 -0
  37. package/server/src/lib/inactive-session/auth-inactive-session-termination-settings.service.js +57 -0
  38. package/server/src/lib/inactive-session/auth-inactive-session-termination-settings.service.js.map +1 -0
  39. package/server/src/lib/inactive-session/auth-inactive-session-termination.service.d.ts +18 -0
  40. package/server/src/lib/inactive-session/auth-inactive-session-termination.service.js +120 -0
  41. package/server/src/lib/inactive-session/auth-inactive-session-termination.service.js.map +1 -0
  42. package/server/src/lib/queries/list-connected-captcha-providers.query.d.ts +12 -0
  43. package/server/src/lib/queries/list-connected-captcha-providers.query.js +96 -0
  44. package/server/src/lib/queries/list-connected-captcha-providers.query.js.map +1 -0
  45. package/contracts/src/datasource.keys.d.ts +0 -4
  46. package/contracts/src/datasource.keys.js +0 -10
  47. package/contracts/src/datasource.keys.js.map +0 -1
  48. package/src/index.js.map +0 -1
  49. package/src/lib/auth-server.module.js +0 -15
  50. package/src/lib/auth-server.module.js.map +0 -1
  51. /package/{src → server/src}/index.d.ts +0 -0
  52. /package/{src → server/src}/index.js +0 -0
  53. /package/{src → server/src}/lib/auth-server.module.d.ts +0 -0
@@ -12,9 +12,19 @@ export declare const AXMAuthCommandKeys: {
12
12
  };
13
13
  readonly Security: {
14
14
  readonly ChangePassword: "auth:change-password";
15
+ readonly ManageTwoFactor: "auth:manage-two-factor";
15
16
  readonly SetPinCode: "auth:set-pin-code";
16
17
  readonly RemovePinCode: "auth:remove-pin-code";
17
18
  readonly ViewLoginHistory: "auth:view-login-history";
18
19
  readonly EditSignature: "auth:edit-signature";
19
20
  };
21
+ readonly Onboarding: {
22
+ readonly Welcome: "auth:welcome-onboarding";
23
+ };
24
+ readonly Account: {
25
+ /** Opens `/auth/account/waiting-room` (e.g. from membership-invite inbox action). */
26
+ readonly OpenWaitingRoom: "auth:open-waiting-room";
27
+ };
20
28
  };
29
+ /** Scheduled purge of DeviceSessions idle past the InactiveSessionTermination setting. */
30
+ export declare const AXM_AUTH_INACTIVE_SESSION_TERMINATION_PURGE_COMMAND_KEY: "auth.inactive-session.terminate";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  //#region ---- Command keys ----
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.AXMAuthCommandKeys = void 0;
4
+ exports.AXM_AUTH_INACTIVE_SESSION_TERMINATION_PURGE_COMMAND_KEY = exports.AXMAuthCommandKeys = void 0;
5
5
  exports.AXMAuthCommandKeys = {
6
6
  Profile: {
7
7
  Show: 'auth:profile',
@@ -16,11 +16,21 @@ exports.AXMAuthCommandKeys = {
16
16
  },
17
17
  Security: {
18
18
  ChangePassword: 'auth:change-password',
19
+ ManageTwoFactor: 'auth:manage-two-factor',
19
20
  SetPinCode: 'auth:set-pin-code',
20
21
  RemovePinCode: 'auth:remove-pin-code',
21
22
  ViewLoginHistory: 'auth:view-login-history',
22
23
  EditSignature: 'auth:edit-signature',
23
24
  },
25
+ Onboarding: {
26
+ Welcome: 'auth:welcome-onboarding',
27
+ },
28
+ Account: {
29
+ /** Opens `/auth/account/waiting-room` (e.g. from membership-invite inbox action). */
30
+ OpenWaitingRoom: 'auth:open-waiting-room',
31
+ },
24
32
  };
33
+ /** Scheduled purge of DeviceSessions idle past the InactiveSessionTermination setting. */
34
+ exports.AXM_AUTH_INACTIVE_SESSION_TERMINATION_PURGE_COMMAND_KEY = 'auth.inactive-session.terminate';
25
35
  //#endregion
26
36
  //# sourceMappingURL=commands.keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/server/contracts/src/commands.keys.ts"],"names":[],"mappings":";AAAA,gCAAgC;;;AAEnB,QAAA,kBAAkB,GAAG;IAChC,OAAO,EAAE;QACP,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,mBAAmB;QAChC,eAAe,EAAE,wBAAwB;QACzC,UAAU,EAAE,0BAA0B;KACvC;IACD,OAAO,EAAE;QACP,OAAO,EAAE,cAAc;QACvB,YAAY,EAAE,oBAAoB;QAClC,UAAU,EAAE,kBAAkB;KAC/B;IACD,QAAQ,EAAE;QACR,cAAc,EAAE,sBAAsB;QACtC,UAAU,EAAE,mBAAmB;QAC/B,aAAa,EAAE,sBAAsB;QACrC,gBAAgB,EAAE,yBAAyB;QAC3C,aAAa,EAAE,qBAAqB;KACrC;CACO,CAAC;AAEX,YAAY"}
1
+ {"version":3,"file":"commands.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/contracts/src/commands.keys.ts"],"names":[],"mappings":";AAAA,gCAAgC;;;AAEnB,QAAA,kBAAkB,GAAG;IAChC,OAAO,EAAE;QACP,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,mBAAmB;QAChC,eAAe,EAAE,wBAAwB;QACzC,UAAU,EAAE,0BAA0B;KACvC;IACD,OAAO,EAAE;QACP,OAAO,EAAE,cAAc;QACvB,YAAY,EAAE,oBAAoB;QAClC,UAAU,EAAE,kBAAkB;KAC/B;IACD,QAAQ,EAAE;QACR,cAAc,EAAE,sBAAsB;QACtC,eAAe,EAAE,wBAAwB;QACzC,UAAU,EAAE,mBAAmB;QAC/B,aAAa,EAAE,sBAAsB;QACrC,gBAAgB,EAAE,yBAAyB;QAC3C,aAAa,EAAE,qBAAqB;KACrC;IACD,UAAU,EAAE;QACV,OAAO,EAAE,yBAAyB;KACnC;IACD,OAAO,EAAE;QACP,qFAAqF;QACrF,eAAe,EAAE,wBAAwB;KAC1C;CACO,CAAC;AAEX,0FAA0F;AAC7E,QAAA,uDAAuD,GAClE,iCAA0C,CAAC;AAE7C,YAAY"}
@@ -1,6 +1,6 @@
1
1
  export * from './commands.keys';
2
- export * from './datasource.keys';
3
2
  export * from './menu.keys';
4
3
  export * from './permission.keys';
4
+ export * from './queries.keys';
5
5
  export * from './root-config';
6
6
  export * from './settings.keys';
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
5
  tslib_1.__exportStar(require("./commands.keys"), exports);
6
- tslib_1.__exportStar(require("./datasource.keys"), exports);
7
6
  tslib_1.__exportStar(require("./menu.keys"), exports);
8
7
  tslib_1.__exportStar(require("./permission.keys"), exports);
8
+ tslib_1.__exportStar(require("./queries.keys"), exports);
9
9
  tslib_1.__exportStar(require("./root-config"), exports);
10
10
  tslib_1.__exportStar(require("./settings.keys"), exports);
11
11
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/server/contracts/src/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;AAEpC,0DAAgC;AAChC,4DAAkC;AAClC,sDAA4B;AAC5B,4DAAkC;AAClC,wDAA8B;AAC9B,0DAAgC;AAEhC,YAAY"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/contracts/src/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;AAEpC,0DAAgC;AAChC,sDAA4B;AAC5B,4DAAkC;AAClC,yDAA+B;AAC/B,wDAA8B;AAC9B,0DAAgC;AAEhC,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"menu.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/server/contracts/src/menu.keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,EAAW,CAAC"}
1
+ {"version":3,"file":"menu.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/contracts/src/menu.keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,EAAW,CAAC"}
@@ -1,5 +1,15 @@
1
+ /**
2
+ * Auth stub — maps legacy Management to Administration Access.
3
+ * Prefer {@link AXPAdministrationPermissionKeys} from security-management contracts when wiring real checks.
4
+ */
5
+ export declare const AXPAdministrationPermissionKeys: {
6
+ readonly Access: "Administration:Permission:Access";
7
+ };
8
+ /**
9
+ * @deprecated Prefer Administration Access / conceptual keys.
10
+ */
1
11
  export declare const AXMPermissionsKeys: {
2
- Auth: {
3
- Management: string;
12
+ readonly Auth: {
13
+ readonly Management: "Administration:Permission:Access";
4
14
  };
5
15
  };
@@ -1,10 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AXMPermissionsKeys = void 0;
3
+ exports.AXMPermissionsKeys = exports.AXPAdministrationPermissionKeys = void 0;
4
+ /**
5
+ * Auth stub — maps legacy Management to Administration Access.
6
+ * Prefer {@link AXPAdministrationPermissionKeys} from security-management contracts when wiring real checks.
7
+ */
8
+ exports.AXPAdministrationPermissionKeys = {
9
+ Access: 'Administration:Permission:Access',
10
+ };
11
+ /**
12
+ * @deprecated Prefer Administration Access / conceptual keys.
13
+ */
4
14
  exports.AXMPermissionsKeys = {
5
15
  Auth: {
6
- Management: 'Auth:Permission:Management',
7
- // TODO: Add permission keys when permissions are defined
16
+ Management: exports.AXPAdministrationPermissionKeys.Access,
8
17
  },
9
18
  };
10
19
  //# sourceMappingURL=permission.keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"permission.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/server/contracts/src/permission.keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;IAChC,IAAI,EAAE;QACJ,UAAU,EAAE,4BAA4B;QACxC,yDAAyD;KAC1D;CACF,CAAC"}
1
+ {"version":3,"file":"permission.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/contracts/src/permission.keys.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,+BAA+B,GAAG;IAC7C,MAAM,EAAE,kCAAkC;CAClC,CAAC;AAEX;;GAEG;AACU,QAAA,kBAAkB,GAAG;IAChC,IAAI,EAAE;QACJ,UAAU,EAAE,uCAA+B,CAAC,MAAM;KACnD;CACO,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const AXMAuthQueryKeys: {
2
+ readonly Captcha: {
3
+ /** Connected captcha IntegrationConnections for platform Default Captcha Provider select. */
4
+ readonly ListConnectedProviders: "Auth:Query:Captcha.ListConnectedProviders";
5
+ };
6
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ //#region ---- Query keys ----
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AXMAuthQueryKeys = void 0;
5
+ exports.AXMAuthQueryKeys = {
6
+ Captcha: {
7
+ /** Connected captcha IntegrationConnections for platform Default Captcha Provider select. */
8
+ ListConnectedProviders: 'Auth:Query:Captcha.ListConnectedProviders',
9
+ },
10
+ };
11
+ //#endregion
12
+ //# sourceMappingURL=queries.keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/contracts/src/queries.keys.ts"],"names":[],"mappings":";AAAA,8BAA8B;;;AAEjB,QAAA,gBAAgB,GAAG;IAC9B,OAAO,EAAE;QACP,6FAA6F;QAC7F,sBAAsB,EAAE,2CAA2C;KACpE;CACO,CAAC;AAEX,YAAY"}
@@ -9,4 +9,13 @@ export declare const RootConfig: {
9
9
  readonly title: "@auth:module.title";
10
10
  readonly icon: "fa-light fa-shield-keyhole";
11
11
  };
12
+ /**
13
+ * Platform schedule: revoke DeviceSessions idle longer than
14
+ * {@link AXPAuthSettings.InactiveSessionTermination} (user override → tenant default).
15
+ * Cron every minute so the 1-minute option is testable.
16
+ */
17
+ readonly inactiveSessionTermination: {
18
+ readonly providerKey: "auth";
19
+ readonly defaultCron: "* * * * *";
20
+ };
12
21
  };
@@ -13,5 +13,14 @@ exports.RootConfig = {
13
13
  title: '@auth:module.title',
14
14
  icon: 'fa-light fa-shield-keyhole',
15
15
  },
16
+ /**
17
+ * Platform schedule: revoke DeviceSessions idle longer than
18
+ * {@link AXPAuthSettings.InactiveSessionTermination} (user override → tenant default).
19
+ * Cron every minute so the 1-minute option is testable.
20
+ */
21
+ inactiveSessionTermination: {
22
+ providerKey: 'auth',
23
+ defaultCron: '* * * * *',
24
+ },
16
25
  };
17
26
  //# sourceMappingURL=root-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"root-config.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/server/contracts/src/root-config.ts"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;CACf,CAAC;AAEW,QAAA,UAAU,GAAG;IACxB,MAAM;IACN,MAAM,EAAE;QACN,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,MAAM,CAAC,MAAM;QACnB,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,4BAA4B;KACnC;CACO,CAAC"}
1
+ {"version":3,"file":"root-config.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/contracts/src/root-config.ts"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;CACf,CAAC;AAEW,QAAA,UAAU,GAAG;IACxB,MAAM;IACN,MAAM,EAAE;QACN,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,MAAM,CAAC,MAAM;QACnB,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,4BAA4B;KACnC;IACD;;;;OAIG;IACH,0BAA0B,EAAE;QAC1B,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,WAAW;KACzB;CACO,CAAC"}
@@ -1,12 +1,32 @@
1
+ import type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';
1
2
  export declare enum AXPAuthSettings {
2
- TwoFactorAuth = "Auth:Setting:Authentication.TwoFactorAuth",
3
+ /** User-scoped: login requires verified authenticator enrollment when true. */
4
+ UserTwoFactorEnabled = "Auth:Setting:User.TwoFactor.Enabled",
3
5
  PasswordComplexity = "Auth:Setting:Authentication.PasswordComplexity",
4
6
  PasswordExpiryDays = "Auth:Setting:Authentication.PasswordExpiryDays",
5
7
  MaxLoginAttempts = "Auth:Setting:Authentication.MaxLoginAttempts",
6
8
  LockoutDuration = "Auth:Setting:Authentication.LockoutDuration",
9
+ CaptchaAttemptThreshold = "Auth:Setting:Authentication.CaptchaAttemptThreshold",
10
+ /**
11
+ * Platform: Integration provider id used for login captcha
12
+ * (e.g. `google-recaptcha`). Empty = captcha disabled until selected.
13
+ */
14
+ DefaultCaptchaProvider = "Auth:Setting:Authentication.DefaultCaptchaProvider",
15
+ /** Platform sign-in page branding (multi-language string). */
16
+ SignInPageSlogan = "Auth:Setting:SignInPage.Slogan",
17
+ SignInPageDescription = "Auth:Setting:SignInPage.Description",
18
+ /** Platform sign-up policy. */
19
+ SignUpEnabled = "Auth:Setting:SignUp.Enabled",
20
+ SignUpUrl = "Auth:Setting:SignUp.Url",
21
+ /** Platform sign-in credential UX + default strategy. */
22
+ SignInCredentialType = "Auth:Setting:SignIn.CredentialType",
23
+ SignInDefaultStrategy = "Auth:Setting:SignIn.DefaultStrategy",
7
24
  LockWhenIdleEnabled = "Auth:Setting:SessionManagement.LockWhenIdleEnabled",
8
25
  LockWhenIdleMinutes = "Auth:Setting:SessionManagement.LockWhenIdleMinutes",
9
- InactiveSessionTermination = "Auth:Setting:SessionManagement.InactiveSessionTermination"
26
+ InactiveSessionTermination = "Auth:Setting:SessionManagement.InactiveSessionTermination",
27
+ MaxActiveDeviceSessions = "Auth:Setting:SessionManagement.MaxActiveDeviceSessions",
28
+ /** User-scoped welcome onboarding progress blob. */
29
+ OnboardingWelcome = "Auth:Setting:Onboarding.Welcome"
10
30
  }
11
31
  export declare const AXPAuthInactiveSessionTerminationOptions: {
12
32
  readonly OneWeek: "oneWeek";
@@ -15,3 +35,36 @@ export declare const AXPAuthInactiveSessionTerminationOptions: {
15
35
  readonly SixMonths: "sixMonths";
16
36
  };
17
37
  export type AXPAuthInactiveSessionTerminationValue = (typeof AXPAuthInactiveSessionTerminationOptions)[keyof typeof AXPAuthInactiveSessionTerminationOptions];
38
+ /** Shared select options for settings UI + Active Sessions modal (i18n title keys). */
39
+ export declare const AXP_AUTH_INACTIVE_SESSION_TERMINATION_OPTION_DEFINITIONS: ReadonlyArray<{
40
+ id: AXPAuthInactiveSessionTerminationValue;
41
+ titleKey: string;
42
+ }>;
43
+ /** Inactivity window for each stored termination option. */
44
+ export declare const AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS: Record<AXPAuthInactiveSessionTerminationValue, number>;
45
+ export declare const AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS: {
46
+ readonly "Auth:Setting:SessionManagement.InactiveSessionTermination": "oneMonth";
47
+ };
48
+ export declare function isAuthInactiveSessionTerminationValue(value: unknown): value is AXPAuthInactiveSessionTerminationValue;
49
+ export declare function resolveAuthInactiveSessionTerminationDurationMs(value: unknown): number;
50
+ /** Stored values for {@link AXPAuthSettings.SignInCredentialType}. */
51
+ export declare const AXPAuthCredentialTypeOptions: {
52
+ readonly UsernamePassword: "UsernamePassword";
53
+ readonly UsernameEmailPassword: "UsernameEmailPassword";
54
+ readonly EmailPassword: "EmailPassword";
55
+ readonly MobilePassword: "MobilePassword";
56
+ readonly EmailCode: "EmailCode";
57
+ readonly MobileCode: "MobileCode";
58
+ };
59
+ export type AXPAuthCredentialTypeValue = (typeof AXPAuthCredentialTypeOptions)[keyof typeof AXPAuthCredentialTypeOptions];
60
+ export declare const AXP_AUTH_LOCKOUT_SETTING_DEFAULTS: {
61
+ readonly "Auth:Setting:Authentication.MaxLoginAttempts": 5;
62
+ readonly "Auth:Setting:Authentication.LockoutDuration": 3;
63
+ readonly "Auth:Setting:Authentication.CaptchaAttemptThreshold": 1;
64
+ readonly "Auth:Setting:Authentication.DefaultCaptchaProvider": "";
65
+ };
66
+ export declare const AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS: {
67
+ readonly "Auth:Setting:SessionManagement.MaxActiveDeviceSessions": 0;
68
+ };
69
+ export declare const AXP_AUTH_SIGN_IN_PAGE_SLOGAN_DEFAULT: AXPMultiLanguageString;
70
+ export declare const AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT: AXPMultiLanguageString;
@@ -1,16 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AXPAuthInactiveSessionTerminationOptions = exports.AXPAuthSettings = void 0;
3
+ exports.AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT = exports.AXP_AUTH_SIGN_IN_PAGE_SLOGAN_DEFAULT = exports.AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS = exports.AXP_AUTH_LOCKOUT_SETTING_DEFAULTS = exports.AXPAuthCredentialTypeOptions = exports.AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS = exports.AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS = exports.AXP_AUTH_INACTIVE_SESSION_TERMINATION_OPTION_DEFINITIONS = exports.AXPAuthInactiveSessionTerminationOptions = exports.AXPAuthSettings = void 0;
4
+ exports.isAuthInactiveSessionTerminationValue = isAuthInactiveSessionTerminationValue;
5
+ exports.resolveAuthInactiveSessionTerminationDurationMs = resolveAuthInactiveSessionTerminationDurationMs;
6
+ //#region ----- Auth setting keys -----
4
7
  var AXPAuthSettings;
5
8
  (function (AXPAuthSettings) {
6
- AXPAuthSettings["TwoFactorAuth"] = "Auth:Setting:Authentication.TwoFactorAuth";
9
+ /** User-scoped: login requires verified authenticator enrollment when true. */
10
+ AXPAuthSettings["UserTwoFactorEnabled"] = "Auth:Setting:User.TwoFactor.Enabled";
7
11
  AXPAuthSettings["PasswordComplexity"] = "Auth:Setting:Authentication.PasswordComplexity";
8
12
  AXPAuthSettings["PasswordExpiryDays"] = "Auth:Setting:Authentication.PasswordExpiryDays";
9
13
  AXPAuthSettings["MaxLoginAttempts"] = "Auth:Setting:Authentication.MaxLoginAttempts";
10
14
  AXPAuthSettings["LockoutDuration"] = "Auth:Setting:Authentication.LockoutDuration";
15
+ AXPAuthSettings["CaptchaAttemptThreshold"] = "Auth:Setting:Authentication.CaptchaAttemptThreshold";
16
+ /**
17
+ * Platform: Integration provider id used for login captcha
18
+ * (e.g. `google-recaptcha`). Empty = captcha disabled until selected.
19
+ */
20
+ AXPAuthSettings["DefaultCaptchaProvider"] = "Auth:Setting:Authentication.DefaultCaptchaProvider";
21
+ /** Platform sign-in page branding (multi-language string). */
22
+ AXPAuthSettings["SignInPageSlogan"] = "Auth:Setting:SignInPage.Slogan";
23
+ AXPAuthSettings["SignInPageDescription"] = "Auth:Setting:SignInPage.Description";
24
+ /** Platform sign-up policy. */
25
+ AXPAuthSettings["SignUpEnabled"] = "Auth:Setting:SignUp.Enabled";
26
+ AXPAuthSettings["SignUpUrl"] = "Auth:Setting:SignUp.Url";
27
+ /** Platform sign-in credential UX + default strategy. */
28
+ AXPAuthSettings["SignInCredentialType"] = "Auth:Setting:SignIn.CredentialType";
29
+ AXPAuthSettings["SignInDefaultStrategy"] = "Auth:Setting:SignIn.DefaultStrategy";
11
30
  AXPAuthSettings["LockWhenIdleEnabled"] = "Auth:Setting:SessionManagement.LockWhenIdleEnabled";
12
31
  AXPAuthSettings["LockWhenIdleMinutes"] = "Auth:Setting:SessionManagement.LockWhenIdleMinutes";
13
32
  AXPAuthSettings["InactiveSessionTermination"] = "Auth:Setting:SessionManagement.InactiveSessionTermination";
33
+ AXPAuthSettings["MaxActiveDeviceSessions"] = "Auth:Setting:SessionManagement.MaxActiveDeviceSessions";
34
+ /** User-scoped welcome onboarding progress blob. */
35
+ AXPAuthSettings["OnboardingWelcome"] = "Auth:Setting:Onboarding.Welcome";
14
36
  })(AXPAuthSettings || (exports.AXPAuthSettings = AXPAuthSettings = {}));
15
37
  exports.AXPAuthInactiveSessionTerminationOptions = {
16
38
  OneWeek: 'oneWeek',
@@ -18,4 +40,72 @@ exports.AXPAuthInactiveSessionTerminationOptions = {
18
40
  ThreeMonths: 'threeMonths',
19
41
  SixMonths: 'sixMonths',
20
42
  };
43
+ /** Shared select options for settings UI + Active Sessions modal (i18n title keys). */
44
+ exports.AXP_AUTH_INACTIVE_SESSION_TERMINATION_OPTION_DEFINITIONS = [
45
+ {
46
+ id: exports.AXPAuthInactiveSessionTerminationOptions.OneWeek,
47
+ titleKey: '@auth:settings.session.terminate-old-sessions.options.one-week',
48
+ },
49
+ {
50
+ id: exports.AXPAuthInactiveSessionTerminationOptions.OneMonth,
51
+ titleKey: '@auth:settings.session.terminate-old-sessions.options.one-month',
52
+ },
53
+ {
54
+ id: exports.AXPAuthInactiveSessionTerminationOptions.ThreeMonths,
55
+ titleKey: '@auth:settings.session.terminate-old-sessions.options.three-months',
56
+ },
57
+ {
58
+ id: exports.AXPAuthInactiveSessionTerminationOptions.SixMonths,
59
+ titleKey: '@auth:settings.session.terminate-old-sessions.options.six-months',
60
+ },
61
+ ];
62
+ const MS_MINUTE = 60000;
63
+ const MS_DAY = 24 * 60 * MS_MINUTE;
64
+ /** Inactivity window for each stored termination option. */
65
+ exports.AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS = {
66
+ [exports.AXPAuthInactiveSessionTerminationOptions.OneWeek]: 7 * MS_DAY,
67
+ [exports.AXPAuthInactiveSessionTerminationOptions.OneMonth]: 30 * MS_DAY,
68
+ [exports.AXPAuthInactiveSessionTerminationOptions.ThreeMonths]: 90 * MS_DAY,
69
+ [exports.AXPAuthInactiveSessionTerminationOptions.SixMonths]: 180 * MS_DAY,
70
+ };
71
+ exports.AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS = {
72
+ [AXPAuthSettings.InactiveSessionTermination]: exports.AXPAuthInactiveSessionTerminationOptions.OneMonth,
73
+ };
74
+ function isAuthInactiveSessionTerminationValue(value) {
75
+ return (typeof value === 'string' &&
76
+ Object.values(exports.AXPAuthInactiveSessionTerminationOptions).includes(value));
77
+ }
78
+ function resolveAuthInactiveSessionTerminationDurationMs(value) {
79
+ if (isAuthInactiveSessionTerminationValue(value)) {
80
+ return exports.AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS[value];
81
+ }
82
+ return exports.AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS[exports.AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS[AXPAuthSettings.InactiveSessionTermination]];
83
+ }
84
+ /** Stored values for {@link AXPAuthSettings.SignInCredentialType}. */
85
+ exports.AXPAuthCredentialTypeOptions = {
86
+ UsernamePassword: 'UsernamePassword',
87
+ UsernameEmailPassword: 'UsernameEmailPassword',
88
+ EmailPassword: 'EmailPassword',
89
+ MobilePassword: 'MobilePassword',
90
+ EmailCode: 'EmailCode',
91
+ MobileCode: 'MobileCode',
92
+ };
93
+ exports.AXP_AUTH_LOCKOUT_SETTING_DEFAULTS = {
94
+ [AXPAuthSettings.MaxLoginAttempts]: 5,
95
+ [AXPAuthSettings.LockoutDuration]: 3,
96
+ [AXPAuthSettings.CaptchaAttemptThreshold]: 1,
97
+ [AXPAuthSettings.DefaultCaptchaProvider]: '',
98
+ };
99
+ exports.AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS = {
100
+ [AXPAuthSettings.MaxActiveDeviceSessions]: 0,
101
+ };
102
+ exports.AXP_AUTH_SIGN_IN_PAGE_SLOGAN_DEFAULT = {
103
+ 'en-US': 'Welcome',
104
+ 'fa-IR': 'خوش آمدید',
105
+ };
106
+ exports.AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT = {
107
+ 'en-US': 'Sign in to continue to your applications.',
108
+ 'fa-IR': 'برای ادامه به برنامه‌های خود وارد شوید.',
109
+ };
110
+ //#endregion
21
111
  //# sourceMappingURL=settings.keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/server/contracts/src/settings.keys.ts"],"names":[],"mappings":";;;AAAA,IAAY,eASX;AATD,WAAY,eAAe;IACzB,8EAA2D,CAAA;IAC3D,wFAAqE,CAAA;IACrE,wFAAqE,CAAA;IACrE,oFAAiE,CAAA;IACjE,kFAA+D,CAAA;IAC/D,6FAA0E,CAAA;IAC1E,6FAA0E,CAAA;IAC1E,2GAAwF,CAAA;AAC1F,CAAC,EATW,eAAe,+BAAf,eAAe,QAS1B;AAEY,QAAA,wCAAwC,GAAG;IACtD,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;CACd,CAAC"}
1
+ {"version":3,"file":"settings.keys.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/contracts/src/settings.keys.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,29 +1,35 @@
1
1
  {
2
2
  "name": "@acorex-platform/module-auth-server",
3
- "version": "0.0.15",
3
+ "version": "2.0.0-next.42",
4
4
  "type": "commonjs",
5
- "main": "./src/index.js",
6
- "types": "./src/index.d.ts",
5
+ "main": "./server/src/index.js",
6
+ "types": "./server/src/index.d.ts",
7
7
  "peerDependencies": {
8
+ "@acorex-platform/framework-server": "2.0.0-next.42",
9
+ "@acorex-platform/framework-shared": "2.0.0-next.42",
10
+ "@acorex-platform/module-auth-client": "2.0.0-next.42",
11
+ "@acorex-platform/module-integration-management-client": "2.0.0-next.42",
12
+ "@acorex-platform/module-settings-management-client": "2.0.0-next.42",
13
+ "@acorex-platform/module-settings-management-server": "2.0.0-next.42",
8
14
  "@nestjs/common": "^11.0.0",
9
- "@acorex-platform/module-common-server": "0.0.15",
10
- "@nestjs/passport": "^11.0.0",
11
- "passport": "^0.7.0",
12
- "passport-local": "^1.0.0",
13
- "passport-jwt": "^4.0.1",
14
- "@nestjs/jwt": "^11.0.0",
15
15
  "@nestjs/config": "^11.0.0",
16
+ "@nestjs/core": "^11.0.0",
17
+ "@nestjs/jwt": "^11.0.0",
18
+ "@nestjs/passport": "^11.0.0",
16
19
  "bcrypt": "^5.1.1",
17
- "uuid": "^10.0.0",
18
20
  "cookie-parser": "^1.4.6",
19
21
  "express": "^4.19.2",
20
- "@acorex-platform/module-security-management-server": "0.0.15"
22
+ "passport": "^0.7.0",
23
+ "passport-jwt": "^4.0.1",
24
+ "passport-local": "^1.0.0",
25
+ "rxjs": "^7.8.0",
26
+ "uuid": "^10.0.0"
21
27
  },
22
28
  "exports": {
23
29
  "./package.json": "./package.json",
24
30
  ".": {
25
- "types": "./src/index.d.ts",
26
- "default": "./src/index.js"
31
+ "types": "./server/src/index.d.ts",
32
+ "default": "./server/src/index.js"
27
33
  },
28
34
  "./contracts": {
29
35
  "types": "./contracts/src/index.d.ts",
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/modules/auth/server/src/index.ts"],"names":[],"mappings":";;;AAAA,mEAAyC"}
@@ -0,0 +1,9 @@
1
+ import { type OnModuleInit } from '@nestjs/common';
2
+ import { type AuthLockoutPolicy } from '@acorex-platform/framework-server/security';
3
+ import { SettingsManagementStoreService } from '@acorex-platform/module-settings-management-server';
4
+ export declare class AuthLockoutSettingsService implements OnModuleInit {
5
+ private readonly settingsStore;
6
+ constructor(settingsStore: SettingsManagementStoreService);
7
+ onModuleInit(): void;
8
+ resolve(): Promise<AuthLockoutPolicy>;
9
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthLockoutSettingsService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const security_1 = require("@acorex-platform/framework-server/security");
7
+ const module_settings_management_server_1 = require("@acorex-platform/module-settings-management-server");
8
+ const module_auth_contracts_1 = require("@acorex-platform/module-auth-client/contracts");
9
+ //#region ----- Auth lockout settings -----
10
+ let AuthLockoutSettingsService = class AuthLockoutSettingsService {
11
+ constructor(settingsStore) {
12
+ this.settingsStore = settingsStore;
13
+ }
14
+ onModuleInit() {
15
+ (0, security_1.configureAuthLockoutPolicyResolver)(() => this.resolve());
16
+ }
17
+ resolve() {
18
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
19
+ var _a;
20
+ const document = yield this.settingsStore.findByPartition({ scope: 'P', documentId: 'P' });
21
+ const platform = (_a = document === null || document === void 0 ? void 0 : document.values) !== null && _a !== void 0 ? _a : {};
22
+ const defaults = module_auth_contracts_1.AXP_AUTH_LOCKOUT_SETTING_DEFAULTS;
23
+ return {
24
+ maxLoginAttempts: coercePositiveInt(platform[module_auth_contracts_1.AXPAuthSettings.MaxLoginAttempts], defaults[module_auth_contracts_1.AXPAuthSettings.MaxLoginAttempts]),
25
+ lockoutDurationMinutes: coercePositiveInt(platform[module_auth_contracts_1.AXPAuthSettings.LockoutDuration], defaults[module_auth_contracts_1.AXPAuthSettings.LockoutDuration]),
26
+ captchaAttemptThreshold: coercePositiveInt(platform[module_auth_contracts_1.AXPAuthSettings.CaptchaAttemptThreshold], defaults[module_auth_contracts_1.AXPAuthSettings.CaptchaAttemptThreshold]),
27
+ defaultCaptchaProvider: coerceProviderId(platform[module_auth_contracts_1.AXPAuthSettings.DefaultCaptchaProvider], defaults[module_auth_contracts_1.AXPAuthSettings.DefaultCaptchaProvider]),
28
+ };
29
+ });
30
+ }
31
+ };
32
+ exports.AuthLockoutSettingsService = AuthLockoutSettingsService;
33
+ exports.AuthLockoutSettingsService = AuthLockoutSettingsService = tslib_1.__decorate([
34
+ (0, common_1.Injectable)(),
35
+ tslib_1.__metadata("design:paramtypes", [module_settings_management_server_1.SettingsManagementStoreService])
36
+ ], AuthLockoutSettingsService);
37
+ function coercePositiveInt(value, fallback) {
38
+ const parsed = typeof value === 'number' ? value : Number(value);
39
+ if (!Number.isFinite(parsed) || parsed < 1) {
40
+ return fallback;
41
+ }
42
+ return Math.floor(parsed);
43
+ }
44
+ function coerceProviderId(value, fallback) {
45
+ if (typeof value === 'string') {
46
+ return value.trim();
47
+ }
48
+ return fallback;
49
+ }
50
+ //#endregion
51
+ //# sourceMappingURL=auth-lockout-settings.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-lockout-settings.service.js","sourceRoot":"","sources":["../../../../../../libs/modules/auth/server/src/lib/auth-lockout-settings.service.ts"],"names":[],"mappings":";;;;AAAA,2CAA+D;AAC/D,yEAGoD;AACpD,0GAAoG;AACpG,kFAGgD;AAEhD,2CAA2C;AAGpC,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACrC,YAA6B,aAA6C;QAA7C,kBAAa,GAAb,aAAa,CAAgC;IAAG,CAAC;IAE9E,YAAY;QACV,IAAA,6CAAkC,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3D,CAAC;IAEK,OAAO;;;YACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;YAC3F,MAAM,QAAQ,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,mCAAI,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,yDAAiC,CAAC;YAEnD,OAAO;gBACL,gBAAgB,EAAE,iBAAiB,CACjC,QAAQ,CAAC,uCAAe,CAAC,gBAAgB,CAAC,EAC1C,QAAQ,CAAC,uCAAe,CAAC,gBAAgB,CAAC,CAC3C;gBACD,sBAAsB,EAAE,iBAAiB,CACvC,QAAQ,CAAC,uCAAe,CAAC,eAAe,CAAC,EACzC,QAAQ,CAAC,uCAAe,CAAC,eAAe,CAAC,CAC1C;gBACD,uBAAuB,EAAE,iBAAiB,CACxC,QAAQ,CAAC,uCAAe,CAAC,uBAAuB,CAAC,EACjD,QAAQ,CAAC,uCAAe,CAAC,uBAAuB,CAAC,CAClD;gBACD,sBAAsB,EAAE,gBAAgB,CACtC,QAAQ,CAAC,uCAAe,CAAC,sBAAsB,CAAC,EAChD,QAAQ,CAAC,uCAAe,CAAC,sBAAsB,CAAC,CACjD;aACF,CAAC;QACJ,CAAC;KAAA;CACF,CAAA;AA/BY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAU,GAAE;6CAEiC,kEAA8B;GAD/D,0BAA0B,CA+BtC;AAED,SAAS,iBAAiB,CAAC,KAAc,EAAE,QAAgB;IACzD,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3C,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc,EAAE,QAAgB;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,YAAY"}
@@ -0,0 +1,8 @@
1
+ import { type OnModuleInit } from '@nestjs/common';
2
+ import { SettingsManagementStoreService } from '@acorex-platform/module-settings-management-server';
3
+ export declare class AuthMaxDeviceSessionsSettingsService implements OnModuleInit {
4
+ private readonly settingsStore;
5
+ constructor(settingsStore: SettingsManagementStoreService);
6
+ onModuleInit(): void;
7
+ resolve(tenantId: string): Promise<number>;
8
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthMaxDeviceSessionsSettingsService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const security_1 = require("@acorex-platform/framework-server/security");
7
+ const module_settings_management_server_1 = require("@acorex-platform/module-settings-management-server");
8
+ const module_auth_contracts_1 = require("@acorex-platform/module-auth-client/contracts");
9
+ //#region ----- Auth max active device sessions settings -----
10
+ let AuthMaxDeviceSessionsSettingsService = class AuthMaxDeviceSessionsSettingsService {
11
+ constructor(settingsStore) {
12
+ this.settingsStore = settingsStore;
13
+ }
14
+ onModuleInit() {
15
+ (0, security_1.configureAuthMaxDeviceSessionsPolicyResolver)((tenantId) => this.resolve(tenantId));
16
+ }
17
+ resolve(tenantId) {
18
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
19
+ var _a;
20
+ const tid = tenantId === null || tenantId === void 0 ? void 0 : tenantId.trim();
21
+ if (!tid) {
22
+ return module_auth_contracts_1.AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS[module_auth_contracts_1.AXPAuthSettings.MaxActiveDeviceSessions];
23
+ }
24
+ const document = yield this.settingsStore.findByPartition({
25
+ scope: 'T',
26
+ documentId: `T:${tid}`,
27
+ tenantId: tid,
28
+ });
29
+ const values = (_a = document === null || document === void 0 ? void 0 : document.values) !== null && _a !== void 0 ? _a : {};
30
+ const defaults = module_auth_contracts_1.AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS;
31
+ return coerceNonNegativeInt(values[module_auth_contracts_1.AXPAuthSettings.MaxActiveDeviceSessions], defaults[module_auth_contracts_1.AXPAuthSettings.MaxActiveDeviceSessions]);
32
+ });
33
+ }
34
+ };
35
+ exports.AuthMaxDeviceSessionsSettingsService = AuthMaxDeviceSessionsSettingsService;
36
+ exports.AuthMaxDeviceSessionsSettingsService = AuthMaxDeviceSessionsSettingsService = tslib_1.__decorate([
37
+ (0, common_1.Injectable)(),
38
+ tslib_1.__metadata("design:paramtypes", [module_settings_management_server_1.SettingsManagementStoreService])
39
+ ], AuthMaxDeviceSessionsSettingsService);
40
+ function coerceNonNegativeInt(value, fallback) {
41
+ const parsed = typeof value === 'number' ? value : Number(value);
42
+ if (!Number.isFinite(parsed) || parsed < 0) {
43
+ return fallback;
44
+ }
45
+ return Math.floor(parsed);
46
+ }
47
+ //#endregion
48
+ //# sourceMappingURL=auth-max-device-sessions-settings.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-max-device-sessions-settings.service.js","sourceRoot":"","sources":["../../../../../../libs/modules/auth/server/src/lib/auth-max-device-sessions-settings.service.ts"],"names":[],"mappings":";;;;AAAA,2CAA+D;AAC/D,yEAA0G;AAC1G,0GAAoG;AACpG,kFAGgD;AAEhD,8DAA8D;AAGvD,IAAM,oCAAoC,GAA1C,MAAM,oCAAoC;IAC/C,YAA6B,aAA6C;QAA7C,kBAAa,GAAb,aAAa,CAAgC;IAAG,CAAC;IAE9E,YAAY;QACV,IAAA,uDAA4C,EAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrF,CAAC;IAEK,OAAO,CAAC,QAAgB;;;YAC5B,MAAM,GAAG,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,CAAC;YAC7B,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,OAAO,4EAAoD,CAAC,uCAAe,CAAC,uBAAuB,CAAC,CAAC;YACvG,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC;gBACxD,KAAK,EAAE,GAAG;gBACV,UAAU,EAAE,KAAK,GAAG,EAAE;gBACtB,QAAQ,EAAE,GAAG;aACd,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,mCAAI,EAAE,CAAC;YACtC,MAAM,QAAQ,GAAG,4EAAoD,CAAC;YAEtE,OAAO,oBAAoB,CACzB,MAAM,CAAC,uCAAe,CAAC,uBAAuB,CAAC,EAC/C,QAAQ,CAAC,uCAAe,CAAC,uBAAuB,CAAC,CAClD,CAAC;QACJ,CAAC;KAAA;CACF,CAAA;AA1BY,oFAAoC;+CAApC,oCAAoC;IADhD,IAAA,mBAAU,GAAE;6CAEiC,kEAA8B;GAD/D,oCAAoC,CA0BhD;AAED,SAAS,oBAAoB,CAAC,KAAc,EAAE,QAAgB;IAC5D,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3C,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED,YAAY"}