@mcp-abap-adt/auth-broker 0.1.8 → 0.1.10
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 +28 -60
- package/README.md +1 -1
- package/bin/generate-env-from-service-key.ts +5 -6
- package/dist/AuthBroker.d.ts +3 -3
- package/dist/AuthBroker.d.ts.map +1 -1
- package/dist/AuthBroker.js +24 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -11,7 +11,33 @@ Thank you to all contributors! See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the co
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
-
## [0.1.
|
|
14
|
+
## [0.1.10] - 2025-12-07
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- **Constructor Validation**: Added validation checks in `AuthBroker` constructor to ensure all required dependencies are provided
|
|
18
|
+
- Validates that `stores` parameter is not null/undefined
|
|
19
|
+
- Validates that `serviceKeyStore` is provided
|
|
20
|
+
- Validates that `sessionStore` is provided
|
|
21
|
+
- Validates that `tokenProvider` is provided
|
|
22
|
+
- Throws descriptive error messages if any required dependency is missing
|
|
23
|
+
- Helps catch configuration errors early during development
|
|
24
|
+
|
|
25
|
+
## [0.1.9] - 2025-12-05
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- **Dependency Injection for Logger**: Migrated from concrete `Logger` implementation to `ILogger` interface
|
|
29
|
+
- Removed dependency on `@mcp-abap-adt/logger` package
|
|
30
|
+
- Now uses `ILogger` interface from `@mcp-abap-adt/interfaces`
|
|
31
|
+
- Logger parameter in constructor is optional - uses no-op logger if not provided
|
|
32
|
+
- Follows Dependency Inversion Principle - depends on interface, not implementation
|
|
33
|
+
- **Bin Script Fixes**: Fixed `generate-env-from-service-key.ts` script
|
|
34
|
+
- Corrected imports from non-existent packages (`@mcp-abap-adt/auth-stores-btp`, `@mcp-abap-adt/auth-stores-xsuaa`) to correct package (`@mcp-abap-adt/auth-stores`)
|
|
35
|
+
- Fixed constructor parameters: changed from array `[directory]` to string `directory` for all store constructors
|
|
36
|
+
|
|
37
|
+
### Removed
|
|
38
|
+
- **Unused Dependencies**: Removed `@mcp-abap-adt/connection` dependency (not used in production code)
|
|
39
|
+
|
|
40
|
+
## [0.1.8] - 2025-12-04
|
|
15
41
|
|
|
16
42
|
### Added
|
|
17
43
|
- **Interfaces Package Integration**: Migrated to use `@mcp-abap-adt/interfaces` package for all interface definitions
|
|
@@ -63,7 +89,7 @@ Thank you to all contributors! See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the co
|
|
|
63
89
|
- Token validator utility (moved to providers)
|
|
64
90
|
- Authentication functions (moved to providers)
|
|
65
91
|
|
|
66
|
-
## [0.1.5] - 2025-12-
|
|
92
|
+
## [0.1.5] - 2025-12-02
|
|
67
93
|
|
|
68
94
|
### Changed
|
|
69
95
|
- **Interface Naming** - All interfaces now start with `I` prefix
|
|
@@ -271,64 +297,6 @@ Thank you to all contributors! See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the co
|
|
|
271
297
|
- Properly expands `~` to home directory in paths
|
|
272
298
|
- Added diagnostic logging controlled by `TEST_VERBOSE` environment variable
|
|
273
299
|
|
|
274
|
-
## [0.1.5] - 2025-12-02
|
|
275
|
-
|
|
276
|
-
### Added
|
|
277
|
-
- **SafeSessionStore** - New in-memory session store implementation
|
|
278
|
-
- Stores session data in memory (Map) - data is lost after application restart
|
|
279
|
-
- Secure by default - doesn't persist sensitive data to disk
|
|
280
|
-
- Use when you want to ensure tokens are not saved to files
|
|
281
|
-
- Perfect for applications that require re-authentication after restart
|
|
282
|
-
- **SafeSessionStore Tests** - Comprehensive test coverage for SafeSessionStore
|
|
283
|
-
- Tests for `loadSession()` - loading non-existent, existing, and deleted sessions
|
|
284
|
-
- Tests for `saveSession()` - saving, overwriting, and multiple destinations
|
|
285
|
-
- Tests for `deleteSession()` - deleting existing and non-existent sessions
|
|
286
|
-
- Tests for in-memory behavior - data isolation between instances
|
|
287
|
-
- 11 test cases covering all functionality
|
|
288
|
-
|
|
289
|
-
### Changed
|
|
290
|
-
- **Interface Naming** - Renamed interfaces for better readability
|
|
291
|
-
- `ServiceKeyStore` → `IServiceKeyStore` (new interface name)
|
|
292
|
-
- `SessionStore` → `ISessionStore` (new interface name)
|
|
293
|
-
- Old names still available as type aliases for backward compatibility
|
|
294
|
-
- All implementations updated to use new interface names
|
|
295
|
-
- **AuthBroker Constructor** - Simplified API
|
|
296
|
-
- Removed `searchPathsOrStores` parameter (string/array/object)
|
|
297
|
-
- Now accepts only `stores` object with `serviceKeyStore` and `sessionStore` properties
|
|
298
|
-
- Consumers must explicitly provide stores - no automatic path resolution
|
|
299
|
-
- Default stores: `FileServiceKeyStore()` and `FileSessionStore()` if not provided
|
|
300
|
-
- This change gives consumers full control over storage implementation
|
|
301
|
-
|
|
302
|
-
### Breaking Changes
|
|
303
|
-
- **AuthBroker Constructor** - API change
|
|
304
|
-
- Old API: `new AuthBroker(searchPaths?: string | string[], browser?: string, logger?: Logger)`
|
|
305
|
-
- New API: `new AuthBroker(stores?: { serviceKeyStore?: IServiceKeyStore; sessionStore?: ISessionStore }, browser?: string, logger?: Logger)`
|
|
306
|
-
- Migration: Instead of passing paths, create stores explicitly:
|
|
307
|
-
```typescript
|
|
308
|
-
// Old way (no longer works)
|
|
309
|
-
const broker = new AuthBroker(['/path/to/destinations']);
|
|
310
|
-
|
|
311
|
-
// New way
|
|
312
|
-
const { FileServiceKeyStore, FileSessionStore } = require('@mcp-abap-adt/auth-broker');
|
|
313
|
-
const broker = new AuthBroker({
|
|
314
|
-
serviceKeyStore: new FileServiceKeyStore(['/path/to/destinations']),
|
|
315
|
-
sessionStore: new FileSessionStore(['/path/to/destinations']),
|
|
316
|
-
});
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### Fixed
|
|
320
|
-
- **Test Helpers** - Updated test helpers to use new AuthBroker API
|
|
321
|
-
- `testHelpers.ts` now uses `FileServiceKeyStore` and `FileSessionStore` with explicit paths
|
|
322
|
-
- All existing tests updated to work with new constructor signature
|
|
323
|
-
- Test coverage maintained at 100% for all components
|
|
324
|
-
|
|
325
|
-
### Technical Details
|
|
326
|
-
- Consumers now have full control over storage implementation
|
|
327
|
-
- Can choose between `FileSessionStore` (persists to disk) and `SafeSessionStore` (in-memory)
|
|
328
|
-
- No automatic path resolution - consumers decide where to store files
|
|
329
|
-
- Better separation of concerns - storage logic is explicit
|
|
330
|
-
- All tests updated and passing (60 tests across 8 test suites)
|
|
331
|
-
|
|
332
300
|
## [0.1.4] - 2025-12-01
|
|
333
301
|
|
|
334
302
|
### Dependencies
|
package/README.md
CHANGED
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
import * as path from 'path';
|
|
17
17
|
import * as fs from 'fs';
|
|
18
18
|
import { AuthBroker } from '../src/AuthBroker';
|
|
19
|
-
import { AbapServiceKeyStore, AbapSessionStore } from '@mcp-abap-adt/auth-stores
|
|
20
|
-
import { XsuaaServiceKeyStore, XsuaaSessionStore } from '@mcp-abap-adt/auth-stores-xsuaa';
|
|
19
|
+
import { AbapServiceKeyStore, AbapSessionStore, XsuaaServiceKeyStore, XsuaaSessionStore } from '@mcp-abap-adt/auth-stores';
|
|
21
20
|
import { BtpTokenProvider, XsuaaTokenProvider } from '@mcp-abap-adt/auth-providers';
|
|
22
21
|
|
|
23
22
|
async function main() {
|
|
@@ -59,12 +58,12 @@ async function main() {
|
|
|
59
58
|
|
|
60
59
|
// Create appropriate stores
|
|
61
60
|
const serviceKeyStore = isXsuaa
|
|
62
|
-
? new XsuaaServiceKeyStore(
|
|
63
|
-
: new AbapServiceKeyStore(
|
|
61
|
+
? new XsuaaServiceKeyStore(serviceKeyDir)
|
|
62
|
+
: new AbapServiceKeyStore(serviceKeyDir);
|
|
64
63
|
|
|
65
64
|
const sessionStore = isXsuaa
|
|
66
|
-
? new XsuaaSessionStore(
|
|
67
|
-
: new AbapSessionStore(
|
|
65
|
+
? new XsuaaSessionStore(sessionDir)
|
|
66
|
+
: new AbapSessionStore(sessionDir);
|
|
68
67
|
|
|
69
68
|
// Create token provider
|
|
70
69
|
const tokenProvider = isXsuaa
|
package/dist/AuthBroker.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Main AuthBroker class for managing JWT tokens based on destinations
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { ILogger } from '@mcp-abap-adt/interfaces';
|
|
5
5
|
import { IServiceKeyStore, ISessionStore, IAuthorizationConfig, IConnectionConfig } from './stores/interfaces';
|
|
6
6
|
import { ITokenProvider } from './providers';
|
|
7
7
|
/**
|
|
@@ -22,13 +22,13 @@ export declare class AuthBroker {
|
|
|
22
22
|
* @param browser Optional browser name for authentication (chrome, edge, firefox, system, none).
|
|
23
23
|
* Default: 'system' (system default browser).
|
|
24
24
|
* Use 'none' to print URL instead of opening browser.
|
|
25
|
-
* @param logger Optional logger instance. If not provided, uses
|
|
25
|
+
* @param logger Optional logger instance implementing ILogger interface. If not provided, uses no-op logger.
|
|
26
26
|
*/
|
|
27
27
|
constructor(stores: {
|
|
28
28
|
serviceKeyStore: IServiceKeyStore;
|
|
29
29
|
sessionStore: ISessionStore;
|
|
30
30
|
tokenProvider: ITokenProvider;
|
|
31
|
-
}, browser?: string, logger?:
|
|
31
|
+
}, browser?: string, logger?: ILogger);
|
|
32
32
|
/**
|
|
33
33
|
* Get authentication token for destination.
|
|
34
34
|
* Tries to load from session store, validates it, and refreshes if needed using a fallback chain.
|
package/dist/AuthBroker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthBroker.d.ts","sourceRoot":"","sources":["../src/AuthBroker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AuthBroker.d.ts","sourceRoot":"","sources":["../src/AuthBroker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAY7C;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,eAAe,CAAmB;IAC1C,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAiB;IAEtC;;;;;;;;;;OAUG;gBAED,MAAM,EAAE;QAAE,eAAe,EAAE,gBAAgB,CAAC;QAAC,YAAY,EAAE,aAAa,CAAC;QAAC,aAAa,EAAE,cAAc,CAAA;KAAE,EACzG,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,OAAO;IAuBlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmIpD;;;;;OAKG;IACG,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuCxD;;;;OAIG;IACG,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAWvF;;;;OAIG;IACG,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;CAWlF"}
|
package/dist/AuthBroker.js
CHANGED
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.AuthBroker = void 0;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* No-op logger implementation for default fallback when logger is not provided
|
|
9
|
+
*/
|
|
10
|
+
const noOpLogger = {
|
|
11
|
+
info: () => { },
|
|
12
|
+
error: () => { },
|
|
13
|
+
warn: () => { },
|
|
14
|
+
debug: () => { },
|
|
15
|
+
};
|
|
8
16
|
/**
|
|
9
17
|
* AuthBroker manages JWT authentication tokens for destinations
|
|
10
18
|
*/
|
|
@@ -23,14 +31,27 @@ class AuthBroker {
|
|
|
23
31
|
* @param browser Optional browser name for authentication (chrome, edge, firefox, system, none).
|
|
24
32
|
* Default: 'system' (system default browser).
|
|
25
33
|
* Use 'none' to print URL instead of opening browser.
|
|
26
|
-
* @param logger Optional logger instance. If not provided, uses
|
|
34
|
+
* @param logger Optional logger instance implementing ILogger interface. If not provided, uses no-op logger.
|
|
27
35
|
*/
|
|
28
36
|
constructor(stores, browser, logger) {
|
|
37
|
+
// Validate that stores and provider are provided and not null/undefined
|
|
38
|
+
if (!stores) {
|
|
39
|
+
throw new Error('AuthBroker: stores parameter is required');
|
|
40
|
+
}
|
|
41
|
+
if (!stores.serviceKeyStore) {
|
|
42
|
+
throw new Error('AuthBroker: serviceKeyStore is required');
|
|
43
|
+
}
|
|
44
|
+
if (!stores.sessionStore) {
|
|
45
|
+
throw new Error('AuthBroker: sessionStore is required');
|
|
46
|
+
}
|
|
47
|
+
if (!stores.tokenProvider) {
|
|
48
|
+
throw new Error('AuthBroker: tokenProvider is required');
|
|
49
|
+
}
|
|
29
50
|
this.serviceKeyStore = stores.serviceKeyStore;
|
|
30
51
|
this.sessionStore = stores.sessionStore;
|
|
31
52
|
this.tokenProvider = stores.tokenProvider;
|
|
32
53
|
this.browser = browser || 'system';
|
|
33
|
-
this.logger = logger ||
|
|
54
|
+
this.logger = logger || noOpLogger;
|
|
34
55
|
}
|
|
35
56
|
/**
|
|
36
57
|
* Get authentication token for destination.
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export { AuthBroker } from './AuthBroker';
|
|
|
6
6
|
export type { IAuthorizationConfig, IConnectionConfig, IServiceKeyStore, ISessionStore } from './stores/interfaces';
|
|
7
7
|
export type { IConfig } from './types';
|
|
8
8
|
export type { ITokenProvider, TokenProviderOptions, TokenProviderResult } from './providers';
|
|
9
|
-
export type {
|
|
9
|
+
export type { ILogger } from '@mcp-abap-adt/interfaces';
|
|
10
10
|
export type { AuthType } from '@mcp-abap-adt/interfaces';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpH,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE7F,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpH,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE7F,YAAY,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,YAAY,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-abap-adt/auth-broker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "JWT authentication broker for MCP ABAP ADT - manages tokens based on destination headers",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -51,14 +51,11 @@
|
|
|
51
51
|
"node": ">=18.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@mcp-abap-adt/
|
|
55
|
-
"@mcp-abap-adt/interfaces": "^0.1.0",
|
|
56
|
-
"@mcp-abap-adt/logger": "^0.1.0"
|
|
54
|
+
"@mcp-abap-adt/interfaces": "^0.1.1"
|
|
57
55
|
},
|
|
58
56
|
"devDependencies": {
|
|
59
|
-
"@mcp-abap-adt/auth-providers": "^0.1.
|
|
60
|
-
"@mcp-abap-adt/auth-stores
|
|
61
|
-
"@mcp-abap-adt/auth-stores-xsuaa": "^0.1.0",
|
|
57
|
+
"@mcp-abap-adt/auth-providers": "^0.1.2",
|
|
58
|
+
"@mcp-abap-adt/auth-stores": "^0.1.4",
|
|
62
59
|
"@types/express": "^5.0.5",
|
|
63
60
|
"@types/jest": "^30.0.0",
|
|
64
61
|
"@types/js-yaml": "^4.0.9",
|