@mcp-abap-adt/auth-broker 3.0.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -1
- package/README.md +34 -312
- package/package.json +14 -41
- package/CONTRIBUTORS.md +0 -33
- package/dist/__tests__/helpers/configHelpers.d.ts +0 -59
- package/dist/__tests__/helpers/configHelpers.d.ts.map +0 -1
- package/dist/__tests__/helpers/configHelpers.js +0 -206
- package/dist/__tests__/helpers/netHelpers.d.ts +0 -3
- package/dist/__tests__/helpers/netHelpers.d.ts.map +0 -1
- package/dist/__tests__/helpers/netHelpers.js +0 -63
- package/dist/__tests__/helpers/testLogger.d.ts +0 -7
- package/dist/__tests__/helpers/testLogger.d.ts.map +0 -1
- package/dist/__tests__/helpers/testLogger.js +0 -54
- package/dist/bin/mcp-auth.js +0 -752
- package/dist/bin/mcp-sso.js +0 -825
- package/dist/bin/mcpSsoConfig.js +0 -566
- package/dist/bin/samlMetadata.js +0 -175
- package/dist/bin/workDir.js +0 -79
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration helpers for auth-broker tests
|
|
3
|
-
* Loads test configuration from test-config.yaml
|
|
4
|
-
*/
|
|
5
|
-
export interface TestConfig {
|
|
6
|
-
auth_broker?: {
|
|
7
|
-
paths?: {
|
|
8
|
-
service_keys_dir?: string;
|
|
9
|
-
sessions_dir?: string;
|
|
10
|
-
};
|
|
11
|
-
abap?: {
|
|
12
|
-
destination?: string;
|
|
13
|
-
expired_token?: string;
|
|
14
|
-
refresh_token?: string;
|
|
15
|
-
};
|
|
16
|
-
xsuaa?: {
|
|
17
|
-
btp_destination?: string;
|
|
18
|
-
mcp_destination?: string;
|
|
19
|
-
mcp_url?: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Load test configuration from YAML
|
|
25
|
-
* Uses test-config.yaml from tests/ directory
|
|
26
|
-
*/
|
|
27
|
-
export declare function loadTestConfig(): TestConfig;
|
|
28
|
-
/**
|
|
29
|
-
* Check if test config has real values (not placeholders)
|
|
30
|
-
*/
|
|
31
|
-
export declare function hasRealConfig(config: TestConfig, section: 'abap' | 'xsuaa'): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Get ABAP destination from config
|
|
34
|
-
*/
|
|
35
|
-
export declare function getAbapDestination(config?: TestConfig): string | null;
|
|
36
|
-
/**
|
|
37
|
-
* Get XSUAA destinations from config
|
|
38
|
-
*/
|
|
39
|
-
export declare function getXsuaaDestinations(config?: TestConfig): {
|
|
40
|
-
btp_destination: string | null;
|
|
41
|
-
mcp_url: string | null;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Get service keys directory from config
|
|
45
|
-
*/
|
|
46
|
-
export declare function getServiceKeysDir(config?: TestConfig): string | null;
|
|
47
|
-
/**
|
|
48
|
-
* Get sessions directory from config
|
|
49
|
-
*/
|
|
50
|
-
export declare function getSessionsDir(config?: TestConfig): string | null;
|
|
51
|
-
/**
|
|
52
|
-
* Get expired token from config (real expired token from YAML)
|
|
53
|
-
*/
|
|
54
|
-
export declare function getExpiredToken(config?: TestConfig): string | null;
|
|
55
|
-
/**
|
|
56
|
-
* Get refresh token from config (real refresh token from YAML)
|
|
57
|
-
*/
|
|
58
|
-
export declare function getRefreshToken(config?: TestConfig): string | null;
|
|
59
|
-
//# sourceMappingURL=configHelpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configHelpers.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/configHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE;YACN,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;SACvB,CAAC;QACF,IAAI,CAAC,EAAE;YACL,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,aAAa,CAAC,EAAE,MAAM,CAAC;YACvB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;QACF,KAAK,CAAC,EAAE;YACN,eAAe,CAAC,EAAE,MAAM,CAAC;YACzB,eAAe,CAAC,EAAE,MAAM,CAAC;YACzB,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,CAAC;CACH;AAkBD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,UAAU,CAyD3C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,MAAM,GAAG,OAAO,GACxB,OAAO,CAwBT;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAGrE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG;IACzD,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAOA;AAaD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CASpE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CASjE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAGlE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAGlE"}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Configuration helpers for auth-broker tests
|
|
4
|
-
* Loads test configuration from test-config.yaml
|
|
5
|
-
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.loadTestConfig = loadTestConfig;
|
|
41
|
-
exports.hasRealConfig = hasRealConfig;
|
|
42
|
-
exports.getAbapDestination = getAbapDestination;
|
|
43
|
-
exports.getXsuaaDestinations = getXsuaaDestinations;
|
|
44
|
-
exports.getServiceKeysDir = getServiceKeysDir;
|
|
45
|
-
exports.getSessionsDir = getSessionsDir;
|
|
46
|
-
exports.getExpiredToken = getExpiredToken;
|
|
47
|
-
exports.getRefreshToken = getRefreshToken;
|
|
48
|
-
const fs = __importStar(require("node:fs"));
|
|
49
|
-
const path = __importStar(require("node:path"));
|
|
50
|
-
const yaml = __importStar(require("js-yaml"));
|
|
51
|
-
let cachedConfig = null;
|
|
52
|
-
/**
|
|
53
|
-
* Find project root directory by looking for package.json
|
|
54
|
-
*/
|
|
55
|
-
function findProjectRoot() {
|
|
56
|
-
let currentDir = __dirname;
|
|
57
|
-
while (currentDir !== path.dirname(currentDir)) {
|
|
58
|
-
const packageJsonPath = path.join(currentDir, 'package.json');
|
|
59
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
60
|
-
return currentDir;
|
|
61
|
-
}
|
|
62
|
-
currentDir = path.dirname(currentDir);
|
|
63
|
-
}
|
|
64
|
-
// Fallback to process.cwd() if package.json not found
|
|
65
|
-
return process.cwd();
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Load test configuration from YAML
|
|
69
|
-
* Uses test-config.yaml from tests/ directory
|
|
70
|
-
*/
|
|
71
|
-
function loadTestConfig() {
|
|
72
|
-
if (cachedConfig) {
|
|
73
|
-
return cachedConfig;
|
|
74
|
-
}
|
|
75
|
-
// Find project root and load from tests/test-config.yaml
|
|
76
|
-
const projectRoot = findProjectRoot();
|
|
77
|
-
const configPath = path.resolve(projectRoot, 'tests', 'test-config.yaml');
|
|
78
|
-
const templatePath = path.resolve(projectRoot, 'tests', 'test-config.yaml.template');
|
|
79
|
-
if (process.env.TEST_VERBOSE) {
|
|
80
|
-
console.log(`[configHelpers] Project root: ${projectRoot}`);
|
|
81
|
-
console.log(`[configHelpers] Config path: ${configPath}`);
|
|
82
|
-
console.log(`[configHelpers] Config exists: ${fs.existsSync(configPath)}`);
|
|
83
|
-
}
|
|
84
|
-
if (fs.existsSync(configPath)) {
|
|
85
|
-
try {
|
|
86
|
-
const configContent = fs.readFileSync(configPath, 'utf8');
|
|
87
|
-
cachedConfig = yaml.load(configContent) || {};
|
|
88
|
-
if (process.env.TEST_VERBOSE) {
|
|
89
|
-
console.log(`[configHelpers] Loaded config:`, JSON.stringify(cachedConfig, null, 2));
|
|
90
|
-
}
|
|
91
|
-
return cachedConfig;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
console.warn(`Failed to load test config from ${configPath}:`, error);
|
|
95
|
-
return {};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (fs.existsSync(templatePath)) {
|
|
99
|
-
console.warn('⚠️ tests/test-config.yaml not found. Using template (all integration tests will be disabled).');
|
|
100
|
-
try {
|
|
101
|
-
const templateContent = fs.readFileSync(templatePath, 'utf8');
|
|
102
|
-
cachedConfig = yaml.load(templateContent) || {};
|
|
103
|
-
return cachedConfig;
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
console.warn(`Failed to load test config template from ${templatePath}:`, error);
|
|
107
|
-
return {};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
console.warn('⚠️ Test configuration files not found.');
|
|
111
|
-
console.warn('Please create tests/test-config.yaml with test parameters.');
|
|
112
|
-
return {};
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Check if test config has real values (not placeholders)
|
|
116
|
-
*/
|
|
117
|
-
function hasRealConfig(config, section) {
|
|
118
|
-
if (!config.auth_broker) {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
if (section === 'abap') {
|
|
122
|
-
const abap = config.auth_broker.abap;
|
|
123
|
-
if (!abap?.destination) {
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
// Check if destination is not a placeholder
|
|
127
|
-
return !abap.destination.includes('<') && !abap.destination.includes('>');
|
|
128
|
-
}
|
|
129
|
-
if (section === 'xsuaa') {
|
|
130
|
-
const xsuaa = config.auth_broker.xsuaa;
|
|
131
|
-
if (!xsuaa?.btp_destination || !xsuaa?.mcp_url) {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
// Check if values are not placeholders
|
|
135
|
-
return !xsuaa.btp_destination.includes('<') && !xsuaa.mcp_url.includes('<');
|
|
136
|
-
}
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Get ABAP destination from config
|
|
141
|
-
*/
|
|
142
|
-
function getAbapDestination(config) {
|
|
143
|
-
const cfg = config || loadTestConfig();
|
|
144
|
-
return cfg.auth_broker?.abap?.destination || null;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Get XSUAA destinations from config
|
|
148
|
-
*/
|
|
149
|
-
function getXsuaaDestinations(config) {
|
|
150
|
-
const cfg = config || loadTestConfig();
|
|
151
|
-
const xsuaa = cfg.auth_broker?.xsuaa;
|
|
152
|
-
return {
|
|
153
|
-
btp_destination: xsuaa?.btp_destination || null,
|
|
154
|
-
mcp_url: xsuaa?.mcp_url || null,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Expand tilde (~) to home directory
|
|
159
|
-
*/
|
|
160
|
-
function expandTilde(filePath) {
|
|
161
|
-
if (filePath.startsWith('~')) {
|
|
162
|
-
const os = require('node:os');
|
|
163
|
-
return path.join(os.homedir(), filePath.slice(1));
|
|
164
|
-
}
|
|
165
|
-
return filePath;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Get service keys directory from config
|
|
169
|
-
*/
|
|
170
|
-
function getServiceKeysDir(config) {
|
|
171
|
-
const cfg = config || loadTestConfig();
|
|
172
|
-
const dir = cfg.auth_broker?.paths?.service_keys_dir;
|
|
173
|
-
if (!dir) {
|
|
174
|
-
return null;
|
|
175
|
-
}
|
|
176
|
-
// Expand ~ and normalize path
|
|
177
|
-
const expanded = expandTilde(dir);
|
|
178
|
-
return path.resolve(expanded);
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Get sessions directory from config
|
|
182
|
-
*/
|
|
183
|
-
function getSessionsDir(config) {
|
|
184
|
-
const cfg = config || loadTestConfig();
|
|
185
|
-
const dir = cfg.auth_broker?.paths?.sessions_dir;
|
|
186
|
-
if (!dir) {
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
// Expand ~ and normalize path
|
|
190
|
-
const expanded = expandTilde(dir);
|
|
191
|
-
return path.resolve(expanded);
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Get expired token from config (real expired token from YAML)
|
|
195
|
-
*/
|
|
196
|
-
function getExpiredToken(config) {
|
|
197
|
-
const cfg = config || loadTestConfig();
|
|
198
|
-
return cfg.auth_broker?.abap?.expired_token || null;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Get refresh token from config (real refresh token from YAML)
|
|
202
|
-
*/
|
|
203
|
-
function getRefreshToken(config) {
|
|
204
|
-
const cfg = config || loadTestConfig();
|
|
205
|
-
return cfg.auth_broker?.abap?.refresh_token || null;
|
|
206
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"netHelpers.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/netHelpers.ts"],"names":[],"mappings":"AAEA,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAcxD;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAQ7D"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.getAvailablePort = getAvailablePort;
|
|
37
|
-
exports.canListenOnLocalhost = canListenOnLocalhost;
|
|
38
|
-
const net = __importStar(require("node:net"));
|
|
39
|
-
async function getAvailablePort() {
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
const server = net.createServer();
|
|
42
|
-
server.once('error', reject);
|
|
43
|
-
server.listen(0, '127.0.0.1', () => {
|
|
44
|
-
const address = server.address();
|
|
45
|
-
if (typeof address === 'object' && address?.port) {
|
|
46
|
-
const port = address.port;
|
|
47
|
-
server.close(() => resolve(port));
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
server.close(() => reject(new Error('Failed to acquire a port')));
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
async function canListenOnLocalhost() {
|
|
56
|
-
return new Promise((resolve) => {
|
|
57
|
-
const server = net.createServer();
|
|
58
|
-
server.once('error', () => resolve(false));
|
|
59
|
-
server.listen(0, '127.0.0.1', () => {
|
|
60
|
-
server.close(() => resolve(true));
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test logger with environment variable control
|
|
3
|
-
* Uses DefaultLogger from @mcp-abap-adt/logger for proper formatting
|
|
4
|
-
*/
|
|
5
|
-
import type { ILogger } from '@mcp-abap-adt/interfaces-utils';
|
|
6
|
-
export declare function createTestLogger(prefix?: string): ILogger;
|
|
7
|
-
//# sourceMappingURL=testLogger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testLogger.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/testLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAG9D,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,MAAe,GAAG,OAAO,CAmDjE"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Test logger with environment variable control
|
|
4
|
-
* Uses DefaultLogger from @mcp-abap-adt/logger for proper formatting
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.createTestLogger = createTestLogger;
|
|
8
|
-
const logger_1 = require("@mcp-abap-adt/logger");
|
|
9
|
-
function createTestLogger(prefix = 'TEST') {
|
|
10
|
-
// Check if logging is enabled - requires explicit enable
|
|
11
|
-
const isEnabled = () => {
|
|
12
|
-
// Explicitly disabled (support both short and long names)
|
|
13
|
-
if (process.env.DEBUG_BROKER === 'false' ||
|
|
14
|
-
process.env.DEBUG_AUTH_BROKER === 'false') {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
// Explicitly enabled (support both short and long names)
|
|
18
|
-
if (process.env.DEBUG_BROKER === 'true' ||
|
|
19
|
-
process.env.DEBUG_AUTH_BROKER === 'true' ||
|
|
20
|
-
process.env.DEBUG === 'true' ||
|
|
21
|
-
process.env.DEBUG?.includes('broker') === true ||
|
|
22
|
-
process.env.DEBUG?.includes('auth-broker') === true) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
// Do not enable by default - require explicit enable
|
|
26
|
-
return false;
|
|
27
|
-
};
|
|
28
|
-
// Create DefaultLogger with appropriate log level
|
|
29
|
-
// getLogLevel respects AUTH_LOG_LEVEL env var and defaults to INFO
|
|
30
|
-
const baseLogger = new logger_1.DefaultLogger((0, logger_1.getLogLevel)());
|
|
31
|
-
// Return wrapper that checks if logging is enabled
|
|
32
|
-
return {
|
|
33
|
-
debug: (message, meta) => {
|
|
34
|
-
if (isEnabled()) {
|
|
35
|
-
baseLogger.debug(`[${prefix}] ${message}`, meta);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
info: (message, meta) => {
|
|
39
|
-
if (isEnabled()) {
|
|
40
|
-
baseLogger.info(`[${prefix}] ${message}`, meta);
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
warn: (message, meta) => {
|
|
44
|
-
if (isEnabled()) {
|
|
45
|
-
baseLogger.warn(`[${prefix}] ${message}`, meta);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
error: (message, meta) => {
|
|
49
|
-
if (isEnabled()) {
|
|
50
|
-
baseLogger.error(`[${prefix}] ${message}`, meta);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
}
|