@owox/idp-owox 0.8.0-next-20250924101714 → 0.8.0-next-20250924115234

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -50,9 +50,27 @@ IDP_OWOX_MYSQL_PASSWORD=your-secret
50
50
  IDP_OWOX_MYSQL_DB=idp_owox
51
51
  # Optional
52
52
  IDP_OWOX_MYSQL_CONNECTION_LIMIT=10
53
- IDP_OWOX_MYSQL_SSL={"rejectUnauthorized":true}
53
+ IDP_OWOX_MYSQL_SSL=
54
54
  ```
55
55
 
56
+ #### MySQL SSL
57
+
58
+ `IDP_OWOX_MYSQL_SSL` enables TLS for MySQL (mysql2). Supported formats:
59
+
60
+ - Boolean-like (strings)
61
+ - `true` → `{}` (enable TLS with default options: `rejectUnauthorized: true`)
62
+ - `false` or empty → no `ssl` field (TLS disabled)
63
+
64
+ - JSON object (forwarded to mysql2 TLS options)
65
+ - Strict CA verification:
66
+ - `{"rejectUnauthorized": true}`
67
+ - Custom CA bundle (inline PEM):
68
+ - `{"rejectUnauthorized": true, "ca": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----\\n"}`
69
+ - Mutual TLS (client cert + key):
70
+ - `{"rejectUnauthorized": true, "cert": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----\\n", "key": "-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n"}`
71
+ - Minimum TLS version (TLS 1.2):
72
+ - `{"minVersion": "TLSv1.2", "rejectUnauthorized": true}`
73
+
56
74
  ### 3. Authentication Flow
57
75
 
58
76
  1. Sign In: User is redirected to OWOX Platform sign-in page (`IDP_OWOX_PLATFORM_SIGN_IN_URL`)
@@ -20,7 +20,7 @@ class MysqlAuthorizationStore {
20
20
  database: this.config.database,
21
21
  waitForConnections: true,
22
22
  connectionLimit: this.config.connectionLimit ?? 10,
23
- ssl: this.config.ssl,
23
+ ...(this.config.ssl === undefined ? {} : { ssl: this.config.ssl }),
24
24
  });
25
25
  await this.getPool().query(`
26
26
  CREATE TABLE IF NOT EXISTS auth_states (
package/dist/config.d.ts CHANGED
@@ -50,6 +50,7 @@ export declare const DbEnvSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"IDP_OWOX
50
50
  } | {
51
51
  type: "mysql";
52
52
  mysql: {
53
+ ssl?: string | import("mysql2/promise").SslOptions | undefined;
53
54
  type: "mysql";
54
55
  host: string;
55
56
  port: number | undefined;
@@ -57,7 +58,6 @@ export declare const DbEnvSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"IDP_OWOX
57
58
  password: string;
58
59
  database: string;
59
60
  connectionLimit: number | undefined;
60
- ssl: string | import("mysql2/promise").SslOptions | undefined;
61
61
  };
62
62
  sqlite?: undefined;
63
63
  }, {
@@ -85,6 +85,7 @@ export declare function loadDbConfigFromEnv(env?: NodeJS.ProcessEnv): {
85
85
  } | {
86
86
  type: "mysql";
87
87
  mysql: {
88
+ ssl?: string | import("mysql2/promise").SslOptions | undefined;
88
89
  type: "mysql";
89
90
  host: string;
90
91
  port: number | undefined;
@@ -92,7 +93,6 @@ export declare function loadDbConfigFromEnv(env?: NodeJS.ProcessEnv): {
92
93
  password: string;
93
94
  database: string;
94
95
  connectionLimit: number | undefined;
95
- ssl: string | import("mysql2/promise").SslOptions | undefined;
96
96
  };
97
97
  sqlite?: undefined;
98
98
  };
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,IAAI,CAAC;AAmEpB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CtB,CAAC;AAEH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB;;;;;;;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CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,aAAa,CAgB5F"}
package/dist/config.js CHANGED
@@ -11,6 +11,7 @@ const ms_1 = __importDefault(require("ms"));
11
11
  const env_paths_1 = __importDefault(require("env-paths"));
12
12
  const path_1 = require("path");
13
13
  const fs_1 = require("fs");
14
+ const internal_helpers_1 = require("@owox/internal-helpers");
14
15
  const zMsString = zod_1.z
15
16
  .string()
16
17
  .refine((s) => (0, ms_1.default)(s) !== undefined, {
@@ -21,15 +22,6 @@ const parseCommaString = zod_1.z.string().transform(s => s
21
22
  .split(',')
22
23
  .map(x => x.trim())
23
24
  .filter(Boolean));
24
- function normalizeSsl(input) {
25
- if (input == null || input === false)
26
- return undefined;
27
- if (input === true)
28
- return {};
29
- if (typeof input === 'string')
30
- return input;
31
- return undefined;
32
- }
33
25
  function getSqliteDefaultDbPath() {
34
26
  const paths = (0, env_paths_1.default)('owox', { suffix: '' });
35
27
  const dbPath = (0, path_1.join)(paths.data, 'sqlite', 'idp-owox.db');
@@ -81,15 +73,7 @@ exports.DbEnvSchema = DbEnvRaw.transform(e => {
81
73
  const connectionLimit = e.IDP_OWOX_MYSQL_CONNECTION_LIMIT
82
74
  ? Number(e.IDP_OWOX_MYSQL_CONNECTION_LIMIT)
83
75
  : undefined;
84
- let sslRaw = undefined;
85
- if (e.IDP_OWOX_MYSQL_SSL) {
86
- try {
87
- sslRaw = JSON.parse(e.IDP_OWOX_MYSQL_SSL);
88
- }
89
- catch {
90
- sslRaw = e.IDP_OWOX_MYSQL_SSL;
91
- }
92
- }
76
+ const ssl = (0, internal_helpers_1.parseMysqlSslEnv)(e.IDP_OWOX_MYSQL_SSL);
93
77
  return {
94
78
  type: 'mysql',
95
79
  mysql: {
@@ -100,7 +84,7 @@ exports.DbEnvSchema = DbEnvRaw.transform(e => {
100
84
  password: e.IDP_OWOX_MYSQL_PASSWORD,
101
85
  database: e.IDP_OWOX_MYSQL_DB,
102
86
  connectionLimit,
103
- ssl: normalizeSsl(sslRaw),
87
+ ...(ssl === undefined ? {} : { ssl }),
104
88
  },
105
89
  };
106
90
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owox/idp-owox",
3
- "version": "0.8.0-next-20250924101714",
3
+ "version": "0.8.0-next-20250924115234",
4
4
  "description": "Identity Provider implementation from OWOX",
5
5
  "author": "OWOX",
6
6
  "license": "ELv2",
@@ -21,7 +21,8 @@
21
21
  "prepublishOnly": "npm audit && npm run lint && npm run typecheck"
22
22
  },
23
23
  "dependencies": {
24
- "@owox/idp-protocol": "0.8.0-next-20250924101714",
24
+ "@owox/idp-protocol": "0.8.0-next-20250924115234",
25
+ "@owox/internal-helpers": "0.8.0-next-20250924115234",
25
26
  "pkce-challenge": "^5.0.0",
26
27
  "cookie-parser": "^1.4.7",
27
28
  "env-paths": "^3.0.0",