@mcp-abap-adt/auth-broker 0.1.4 → 0.1.5
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 +58 -0
- package/README.md +24 -4
- package/dist/AuthBroker.d.ts +7 -13
- package/dist/AuthBroker.d.ts.map +1 -1
- package/dist/AuthBroker.js +16 -32
- package/dist/__tests__/testHelpers.d.ts.map +1 -1
- package/dist/__tests__/testHelpers.js +9 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/stores/FileServiceKeyStore.d.ts +2 -2
- package/dist/stores/FileServiceKeyStore.d.ts.map +1 -1
- package/dist/stores/FileSessionStore.d.ts +2 -2
- package/dist/stores/FileSessionStore.d.ts.map +1 -1
- package/dist/stores/SafeSessionStore.d.ts +35 -0
- package/dist/stores/SafeSessionStore.d.ts.map +1 -0
- package/dist/stores/SafeSessionStore.js +42 -0
- package/dist/stores/index.d.ts +2 -1
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +3 -1
- package/dist/stores/interfaces.d.ts +6 -2
- package/dist/stores/interfaces.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,64 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
Thank you to all contributors! See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the complete list.
|
|
11
11
|
|
|
12
|
+
## [0.1.5] - 2025-12-02
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **SafeSessionStore** - New in-memory session store implementation
|
|
16
|
+
- Stores session data in memory (Map) - data is lost after application restart
|
|
17
|
+
- Secure by default - doesn't persist sensitive data to disk
|
|
18
|
+
- Use when you want to ensure tokens are not saved to files
|
|
19
|
+
- Perfect for applications that require re-authentication after restart
|
|
20
|
+
- **SafeSessionStore Tests** - Comprehensive test coverage for SafeSessionStore
|
|
21
|
+
- Tests for `loadSession()` - loading non-existent, existing, and deleted sessions
|
|
22
|
+
- Tests for `saveSession()` - saving, overwriting, and multiple destinations
|
|
23
|
+
- Tests for `deleteSession()` - deleting existing and non-existent sessions
|
|
24
|
+
- Tests for in-memory behavior - data isolation between instances
|
|
25
|
+
- 11 test cases covering all functionality
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- **Interface Naming** - Renamed interfaces for better readability
|
|
29
|
+
- `ServiceKeyStore` → `IServiceKeyStore` (new interface name)
|
|
30
|
+
- `SessionStore` → `ISessionStore` (new interface name)
|
|
31
|
+
- Old names still available as type aliases for backward compatibility
|
|
32
|
+
- All implementations updated to use new interface names
|
|
33
|
+
- **AuthBroker Constructor** - Simplified API
|
|
34
|
+
- Removed `searchPathsOrStores` parameter (string/array/object)
|
|
35
|
+
- Now accepts only `stores` object with `serviceKeyStore` and `sessionStore` properties
|
|
36
|
+
- Consumers must explicitly provide stores - no automatic path resolution
|
|
37
|
+
- Default stores: `FileServiceKeyStore()` and `FileSessionStore()` if not provided
|
|
38
|
+
- This change gives consumers full control over storage implementation
|
|
39
|
+
|
|
40
|
+
### Breaking Changes
|
|
41
|
+
- **AuthBroker Constructor** - API change
|
|
42
|
+
- Old API: `new AuthBroker(searchPaths?: string | string[], browser?: string, logger?: Logger)`
|
|
43
|
+
- New API: `new AuthBroker(stores?: { serviceKeyStore?: IServiceKeyStore; sessionStore?: ISessionStore }, browser?: string, logger?: Logger)`
|
|
44
|
+
- Migration: Instead of passing paths, create stores explicitly:
|
|
45
|
+
```typescript
|
|
46
|
+
// Old way (no longer works)
|
|
47
|
+
const broker = new AuthBroker(['/path/to/destinations']);
|
|
48
|
+
|
|
49
|
+
// New way
|
|
50
|
+
const { FileServiceKeyStore, FileSessionStore } = require('@mcp-abap-adt/auth-broker');
|
|
51
|
+
const broker = new AuthBroker({
|
|
52
|
+
serviceKeyStore: new FileServiceKeyStore(['/path/to/destinations']),
|
|
53
|
+
sessionStore: new FileSessionStore(['/path/to/destinations']),
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
- **Test Helpers** - Updated test helpers to use new AuthBroker API
|
|
59
|
+
- `testHelpers.ts` now uses `FileServiceKeyStore` and `FileSessionStore` with explicit paths
|
|
60
|
+
- All existing tests updated to work with new constructor signature
|
|
61
|
+
- Test coverage maintained at 100% for all components
|
|
62
|
+
|
|
63
|
+
### Technical Details
|
|
64
|
+
- Consumers now have full control over storage implementation
|
|
65
|
+
- Can choose between `FileSessionStore` (persists to disk) and `SafeSessionStore` (in-memory)
|
|
66
|
+
- No automatic path resolution - consumers decide where to store files
|
|
67
|
+
- Better separation of concerns - storage logic is explicit
|
|
68
|
+
- All tests updated and passing (60 tests across 8 test suites)
|
|
69
|
+
|
|
12
70
|
## [0.1.4] - 2025-12-01
|
|
13
71
|
|
|
14
72
|
### Dependencies
|
package/README.md
CHANGED
|
@@ -20,9 +20,22 @@ npm install @mcp-abap-adt/auth-broker
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
|
-
import { AuthBroker } from '@mcp-abap-adt/auth-broker';
|
|
23
|
+
import { AuthBroker, FileServiceKeyStore, FileSessionStore, SafeSessionStore } from '@mcp-abap-adt/auth-broker';
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
// Use default file-based stores (current working directory)
|
|
26
|
+
const broker = new AuthBroker();
|
|
27
|
+
|
|
28
|
+
// Use custom file-based stores with specific paths
|
|
29
|
+
const broker = new AuthBroker({
|
|
30
|
+
serviceKeyStore: new FileServiceKeyStore(['/path/to/destinations']),
|
|
31
|
+
sessionStore: new FileSessionStore(['/path/to/destinations']),
|
|
32
|
+
}, 'chrome');
|
|
33
|
+
|
|
34
|
+
// Use safe in-memory session store (data lost after restart)
|
|
35
|
+
const broker = new AuthBroker({
|
|
36
|
+
serviceKeyStore: new FileServiceKeyStore(['/path/to/destinations']),
|
|
37
|
+
sessionStore: new SafeSessionStore(), // In-memory, secure
|
|
38
|
+
});
|
|
26
39
|
|
|
27
40
|
// Get token for destination (loads from .env, validates, refreshes if needed)
|
|
28
41
|
const token = await broker.getToken('TRIAL');
|
|
@@ -72,11 +85,18 @@ SAP_UAA_CLIENT_SECRET=client_secret
|
|
|
72
85
|
#### Constructor
|
|
73
86
|
|
|
74
87
|
```typescript
|
|
75
|
-
new AuthBroker(
|
|
88
|
+
new AuthBroker(stores?: { serviceKeyStore?: IServiceKeyStore; sessionStore?: ISessionStore }, browser?: string, logger?: Logger)
|
|
76
89
|
```
|
|
77
90
|
|
|
78
|
-
- `
|
|
91
|
+
- `stores` - Optional object with custom storage implementations:
|
|
92
|
+
- `serviceKeyStore` - Store for service keys (default: `FileServiceKeyStore()`)
|
|
93
|
+
- `sessionStore` - Store for session data (default: `FileSessionStore()`)
|
|
94
|
+
- Available implementations:
|
|
95
|
+
- `FileServiceKeyStore(searchPaths?)` - File-based service key store
|
|
96
|
+
- `FileSessionStore(searchPaths?)` - File-based session store (persists to disk)
|
|
97
|
+
- `SafeSessionStore()` - In-memory session store (secure, data lost after restart)
|
|
79
98
|
- `browser` - Optional browser name for authentication (`chrome`, `edge`, `firefox`, `system`, `none`). Default: `system`
|
|
99
|
+
- `logger` - Optional logger instance. If not provided, uses default logger
|
|
80
100
|
|
|
81
101
|
#### Methods
|
|
82
102
|
|
package/dist/AuthBroker.d.ts
CHANGED
|
@@ -2,34 +2,28 @@
|
|
|
2
2
|
* Main AuthBroker class for managing JWT tokens based on destinations
|
|
3
3
|
*/
|
|
4
4
|
import { Logger } from './logger';
|
|
5
|
-
import {
|
|
5
|
+
import { IServiceKeyStore, ISessionStore } from './stores/interfaces';
|
|
6
6
|
/**
|
|
7
7
|
* AuthBroker manages JWT authentication tokens for destinations
|
|
8
8
|
*/
|
|
9
9
|
export declare class AuthBroker {
|
|
10
|
-
private searchPaths;
|
|
11
10
|
private browser;
|
|
12
11
|
private logger;
|
|
13
12
|
private serviceKeyStore;
|
|
14
13
|
private sessionStore;
|
|
15
14
|
/**
|
|
16
15
|
* Create a new AuthBroker instance
|
|
17
|
-
* @param
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* If object: uses provided stores (searchPaths ignored).
|
|
21
|
-
* Priority for searchPaths:
|
|
22
|
-
* 1. Constructor parameter (highest)
|
|
23
|
-
* 2. AUTH_BROKER_PATH environment variable (colon/semicolon-separated)
|
|
24
|
-
* 3. Current working directory (lowest)
|
|
16
|
+
* @param stores Object with custom stores. If not provided, creates default file-based stores.
|
|
17
|
+
* - serviceKeyStore: Store for service keys (default: FileServiceKeyStore)
|
|
18
|
+
* - sessionStore: Store for session data (default: FileSessionStore)
|
|
25
19
|
* @param browser Optional browser name for authentication (chrome, edge, firefox, system, none).
|
|
26
20
|
* Default: 'system' (system default browser).
|
|
27
21
|
* Use 'none' to print URL instead of opening browser.
|
|
28
22
|
* @param logger Optional logger instance. If not provided, uses default logger.
|
|
29
23
|
*/
|
|
30
|
-
constructor(
|
|
31
|
-
serviceKeyStore?:
|
|
32
|
-
sessionStore?:
|
|
24
|
+
constructor(stores?: {
|
|
25
|
+
serviceKeyStore?: IServiceKeyStore;
|
|
26
|
+
sessionStore?: ISessionStore;
|
|
33
27
|
}, browser?: string, logger?: Logger);
|
|
34
28
|
/**
|
|
35
29
|
* Get authentication token for destination.
|
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;
|
|
1
|
+
{"version":3,"file":"AuthBroker.d.ts","sourceRoot":"","sources":["../src/AuthBroker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,MAAM,EAAiB,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGtE;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,eAAe,CAAmB;IAC1C,OAAO,CAAC,YAAY,CAAgB;IAEpC;;;;;;;;;OASG;gBAED,MAAM,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,gBAAgB,CAAC;QAAC,YAAY,CAAC,EAAE,aAAa,CAAA;KAAE,EAC7E,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM;IAQjB;;;;;;OAMG;IACG,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiDpD;;;;;OAKG;IACG,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBxD;;;OAGG;YACW,oBAAoB;IAuDlC;;;;;OAKG;IACG,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAiBjE;;;OAGG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIrC;;OAEG;IACH,aAAa,IAAI,IAAI;IAIrB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CAW/B"}
|
package/dist/AuthBroker.js
CHANGED
|
@@ -8,47 +8,29 @@ const tokenValidator_1 = require("./tokenValidator");
|
|
|
8
8
|
const tokenRefresher_1 = require("./tokenRefresher");
|
|
9
9
|
const browserAuth_1 = require("./browserAuth");
|
|
10
10
|
const cache_1 = require("./cache");
|
|
11
|
-
const pathResolver_1 = require("./pathResolver");
|
|
12
11
|
const logger_1 = require("./logger");
|
|
13
12
|
const stores_1 = require("./stores");
|
|
14
13
|
/**
|
|
15
14
|
* AuthBroker manages JWT authentication tokens for destinations
|
|
16
15
|
*/
|
|
17
16
|
class AuthBroker {
|
|
18
|
-
searchPaths;
|
|
19
17
|
browser;
|
|
20
18
|
logger;
|
|
21
19
|
serviceKeyStore;
|
|
22
20
|
sessionStore;
|
|
23
21
|
/**
|
|
24
22
|
* Create a new AuthBroker instance
|
|
25
|
-
* @param
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* If object: uses provided stores (searchPaths ignored).
|
|
29
|
-
* Priority for searchPaths:
|
|
30
|
-
* 1. Constructor parameter (highest)
|
|
31
|
-
* 2. AUTH_BROKER_PATH environment variable (colon/semicolon-separated)
|
|
32
|
-
* 3. Current working directory (lowest)
|
|
23
|
+
* @param stores Object with custom stores. If not provided, creates default file-based stores.
|
|
24
|
+
* - serviceKeyStore: Store for service keys (default: FileServiceKeyStore)
|
|
25
|
+
* - sessionStore: Store for session data (default: FileSessionStore)
|
|
33
26
|
* @param browser Optional browser name for authentication (chrome, edge, firefox, system, none).
|
|
34
27
|
* Default: 'system' (system default browser).
|
|
35
28
|
* Use 'none' to print URL instead of opening browser.
|
|
36
29
|
* @param logger Optional logger instance. If not provided, uses default logger.
|
|
37
30
|
*/
|
|
38
|
-
constructor(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.searchPaths = (0, pathResolver_1.resolveSearchPaths)(searchPathsOrStores);
|
|
42
|
-
// Create default file-based stores
|
|
43
|
-
this.serviceKeyStore = new stores_1.FileServiceKeyStore(this.searchPaths);
|
|
44
|
-
this.sessionStore = new stores_1.FileSessionStore(this.searchPaths);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
// New API: stores provided
|
|
48
|
-
this.searchPaths = (0, pathResolver_1.resolveSearchPaths)(undefined); // Still resolve for backward compatibility in internal functions
|
|
49
|
-
this.serviceKeyStore = searchPathsOrStores.serviceKeyStore || new stores_1.FileServiceKeyStore();
|
|
50
|
-
this.sessionStore = searchPathsOrStores.sessionStore || new stores_1.FileSessionStore();
|
|
51
|
-
}
|
|
31
|
+
constructor(stores, browser, logger) {
|
|
32
|
+
this.serviceKeyStore = stores?.serviceKeyStore || new stores_1.FileServiceKeyStore();
|
|
33
|
+
this.sessionStore = stores?.sessionStore || new stores_1.FileSessionStore();
|
|
52
34
|
this.browser = browser || 'system';
|
|
53
35
|
this.logger = logger || logger_1.defaultLogger;
|
|
54
36
|
}
|
|
@@ -88,13 +70,14 @@ class AuthBroker {
|
|
|
88
70
|
if (!serviceKey) {
|
|
89
71
|
// No service key and no valid token - throw error with helpful message
|
|
90
72
|
const searchPaths = this.getSearchPathsForError();
|
|
91
|
-
const searchedPaths = searchPaths.
|
|
73
|
+
const searchedPaths = searchPaths.length > 0
|
|
74
|
+
? `\nSearched in:\n${searchPaths.map(p => ` - ${p}`).join('\n')}`
|
|
75
|
+
: '';
|
|
92
76
|
throw new Error(`No authentication found for destination "${destination}". ` +
|
|
93
77
|
`Neither ${destination}.env file nor ${destination}.json service key found.\n` +
|
|
94
78
|
`Please create one of:\n` +
|
|
95
79
|
` - ${destination}.env (with SAP_JWT_TOKEN)\n` +
|
|
96
|
-
` - ${destination}.json (service key)
|
|
97
|
-
`Searched in:\n${searchedPaths}`);
|
|
80
|
+
` - ${destination}.json (service key)${searchedPaths}`);
|
|
98
81
|
}
|
|
99
82
|
// Try to refresh (will use browser auth if no refresh token)
|
|
100
83
|
const newToken = await this.refreshTokenInternal(destination, serviceKey, envConfig);
|
|
@@ -112,10 +95,11 @@ class AuthBroker {
|
|
|
112
95
|
const serviceKey = await this.serviceKeyStore.getServiceKey(destination);
|
|
113
96
|
if (!serviceKey) {
|
|
114
97
|
const searchPaths = this.getSearchPathsForError();
|
|
115
|
-
const searchedPaths = searchPaths.
|
|
98
|
+
const searchedPaths = searchPaths.length > 0
|
|
99
|
+
? `\nSearched in:\n${searchPaths.map(p => ` - ${p}`).join('\n')}`
|
|
100
|
+
: '';
|
|
116
101
|
throw new Error(`Service key file not found for destination "${destination}".\n` +
|
|
117
|
-
`Please create file: ${destination}.json
|
|
118
|
-
`Searched in:\n${searchedPaths}`);
|
|
102
|
+
`Please create file: ${destination}.json${searchedPaths}`);
|
|
119
103
|
}
|
|
120
104
|
// Load existing session (for refresh token)
|
|
121
105
|
const envConfig = await this.sessionStore.loadSession(destination);
|
|
@@ -209,8 +193,8 @@ class AuthBroker {
|
|
|
209
193
|
if (this.sessionStore instanceof stores_1.FileSessionStore) {
|
|
210
194
|
return this.sessionStore.getSearchPaths();
|
|
211
195
|
}
|
|
212
|
-
//
|
|
213
|
-
return
|
|
196
|
+
// No file stores, return empty array
|
|
197
|
+
return [];
|
|
214
198
|
}
|
|
215
199
|
}
|
|
216
200
|
exports.AuthBroker = AuthBroker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testHelpers.d.ts","sourceRoot":"","sources":["../../src/__tests__/testHelpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"testHelpers.d.ts","sourceRoot":"","sources":["../../src/__tests__/testHelpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,eAAO,MAAM,sBAAsB,QAAsF,CAAC;AAE1H,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,sBAAsB,EAAE,UAAU,CAAC;CACpC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAY9D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAM7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAM3C;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAe/F;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAsB/G;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,mBAAmB,GAAE,OAAe,GAAG,IAAI,CAOzF"}
|
|
@@ -48,6 +48,7 @@ const os = __importStar(require("os"));
|
|
|
48
48
|
const fs = __importStar(require("fs"));
|
|
49
49
|
const AuthBroker_1 = require("../AuthBroker");
|
|
50
50
|
const logger_1 = require("../logger");
|
|
51
|
+
const stores_1 = require("../stores");
|
|
51
52
|
// Fixed test destinations path - user can place service keys here
|
|
52
53
|
exports.TEST_DESTINATIONS_PATH = process.env.TEST_DESTINATIONS_PATH || path.join(process.cwd(), 'test-destinations');
|
|
53
54
|
/**
|
|
@@ -55,8 +56,14 @@ exports.TEST_DESTINATIONS_PATH = process.env.TEST_DESTINATIONS_PATH || path.join
|
|
|
55
56
|
*/
|
|
56
57
|
function setupTestBrokers(testName) {
|
|
57
58
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), `auth-broker-${testName}-test-`));
|
|
58
|
-
const broker = new AuthBroker_1.AuthBroker(
|
|
59
|
-
|
|
59
|
+
const broker = new AuthBroker_1.AuthBroker({
|
|
60
|
+
serviceKeyStore: new stores_1.FileServiceKeyStore([tempDir]),
|
|
61
|
+
sessionStore: new stores_1.FileSessionStore([tempDir]),
|
|
62
|
+
}, undefined, logger_1.testLogger);
|
|
63
|
+
const testDestinationsBroker = new AuthBroker_1.AuthBroker({
|
|
64
|
+
serviceKeyStore: new stores_1.FileServiceKeyStore([exports.TEST_DESTINATIONS_PATH]),
|
|
65
|
+
sessionStore: new stores_1.FileSessionStore([exports.TEST_DESTINATIONS_PATH]),
|
|
66
|
+
}, undefined, logger_1.testLogger);
|
|
60
67
|
return { tempDir, broker, testDestinationsBroker };
|
|
61
68
|
}
|
|
62
69
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
export { AuthBroker } from './AuthBroker';
|
|
6
6
|
export type { EnvConfig, ServiceKey } from './types';
|
|
7
7
|
export { resolveSearchPaths, findFileInPaths } from './pathResolver';
|
|
8
|
-
export { ServiceKeyStore, SessionStore } from './stores/interfaces';
|
|
9
|
-
export { FileServiceKeyStore, FileSessionStore } from './stores';
|
|
8
|
+
export { IServiceKeyStore, ISessionStore, ServiceKeyStore, SessionStore } from './stores/interfaces';
|
|
9
|
+
export { FileServiceKeyStore, FileSessionStore, SafeSessionStore } from './stores';
|
|
10
10
|
//# 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;AAC1C,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGrE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* JWT authentication broker for MCP ABAP ADT server
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.FileSessionStore = exports.FileServiceKeyStore = exports.findFileInPaths = exports.resolveSearchPaths = exports.AuthBroker = void 0;
|
|
7
|
+
exports.SafeSessionStore = exports.FileSessionStore = exports.FileServiceKeyStore = exports.findFileInPaths = exports.resolveSearchPaths = exports.AuthBroker = void 0;
|
|
8
8
|
var AuthBroker_1 = require("./AuthBroker");
|
|
9
9
|
Object.defineProperty(exports, "AuthBroker", { enumerable: true, get: function () { return AuthBroker_1.AuthBroker; } });
|
|
10
10
|
var pathResolver_1 = require("./pathResolver");
|
|
@@ -13,3 +13,4 @@ Object.defineProperty(exports, "findFileInPaths", { enumerable: true, get: funct
|
|
|
13
13
|
var stores_1 = require("./stores");
|
|
14
14
|
Object.defineProperty(exports, "FileServiceKeyStore", { enumerable: true, get: function () { return stores_1.FileServiceKeyStore; } });
|
|
15
15
|
Object.defineProperty(exports, "FileSessionStore", { enumerable: true, get: function () { return stores_1.FileSessionStore; } });
|
|
16
|
+
Object.defineProperty(exports, "SafeSessionStore", { enumerable: true, get: function () { return stores_1.SafeSessionStore; } });
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Reads service keys from {destination}.json files in search paths.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { IServiceKeyStore } from './interfaces';
|
|
7
7
|
import { ServiceKey } from '../types';
|
|
8
8
|
/**
|
|
9
9
|
* File-based service key store implementation
|
|
@@ -14,7 +14,7 @@ import { ServiceKey } from '../types';
|
|
|
14
14
|
* 2. AUTH_BROKER_PATH environment variable
|
|
15
15
|
* 3. Current working directory (lowest)
|
|
16
16
|
*/
|
|
17
|
-
export declare class FileServiceKeyStore implements
|
|
17
|
+
export declare class FileServiceKeyStore implements IServiceKeyStore {
|
|
18
18
|
private searchPaths;
|
|
19
19
|
/**
|
|
20
20
|
* Create a new FileServiceKeyStore instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileServiceKeyStore.d.ts","sourceRoot":"","sources":["../../src/stores/FileServiceKeyStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"FileServiceKeyStore.d.ts","sourceRoot":"","sources":["../../src/stores/FileServiceKeyStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,YAAW,gBAAgB;IAC1D,OAAO,CAAC,WAAW,CAAW;IAE9B;;;;;OAKG;gBACS,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE;IAI3C;;;;OAIG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAIpE;;;OAGG;IACH,cAAc,IAAI,MAAM,EAAE;CAG3B"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Reads/writes session data from/to {destination}.env files in search paths.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { ISessionStore } from './interfaces';
|
|
7
7
|
import { EnvConfig } from '../types';
|
|
8
8
|
/**
|
|
9
9
|
* File-based session store implementation
|
|
@@ -15,7 +15,7 @@ import { EnvConfig } from '../types';
|
|
|
15
15
|
* 2. AUTH_BROKER_PATH environment variable
|
|
16
16
|
* 3. Current working directory (lowest)
|
|
17
17
|
*/
|
|
18
|
-
export declare class FileSessionStore implements
|
|
18
|
+
export declare class FileSessionStore implements ISessionStore {
|
|
19
19
|
private searchPaths;
|
|
20
20
|
/**
|
|
21
21
|
* Create a new FileSessionStore instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSessionStore.d.ts","sourceRoot":"","sources":["../../src/stores/FileSessionStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"FileSessionStore.d.ts","sourceRoot":"","sources":["../../src/stores/FileSessionStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAKrC;;;;;;;;;GASG;AACH,qBAAa,gBAAiB,YAAW,aAAa;IACpD,OAAO,CAAC,WAAW,CAAW;IAE9B;;;;;OAKG;gBACS,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE;IAI3C;;;;OAIG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAIjE;;;;OAIG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBxE;;;OAGG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvD;;;OAGG;IACH,cAAc,IAAI,MAAM,EAAE;CAG3B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory implementation of SessionStore
|
|
3
|
+
*
|
|
4
|
+
* Stores session data in memory (Map). Data is lost after application restart.
|
|
5
|
+
* This is a secure implementation that doesn't persist sensitive data to disk.
|
|
6
|
+
*/
|
|
7
|
+
import { ISessionStore } from './interfaces';
|
|
8
|
+
import { EnvConfig } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* In-memory session store implementation
|
|
11
|
+
*
|
|
12
|
+
* Stores session data in a Map. All data is lost when the application restarts.
|
|
13
|
+
* This is the default secure implementation that doesn't write sensitive data to files.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SafeSessionStore implements ISessionStore {
|
|
16
|
+
private sessions;
|
|
17
|
+
/**
|
|
18
|
+
* Load session configuration for destination
|
|
19
|
+
* @param destination Destination name (e.g., "TRIAL")
|
|
20
|
+
* @returns EnvConfig object or null if not found
|
|
21
|
+
*/
|
|
22
|
+
loadSession(destination: string): Promise<EnvConfig | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Save session configuration for destination
|
|
25
|
+
* @param destination Destination name (e.g., "TRIAL")
|
|
26
|
+
* @param config Session configuration to save
|
|
27
|
+
*/
|
|
28
|
+
saveSession(destination: string, config: EnvConfig): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Delete session for destination
|
|
31
|
+
* @param destination Destination name (e.g., "TRIAL")
|
|
32
|
+
*/
|
|
33
|
+
deleteSession(destination: string): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=SafeSessionStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SafeSessionStore.d.ts","sourceRoot":"","sources":["../../src/stores/SafeSessionStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;;;;GAKG;AACH,qBAAa,gBAAiB,YAAW,aAAa;IACpD,OAAO,CAAC,QAAQ,CAAqC;IAErD;;;;OAIG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAIjE;;;;OAIG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE;;;OAGG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGxD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* In-memory implementation of SessionStore
|
|
4
|
+
*
|
|
5
|
+
* Stores session data in memory (Map). Data is lost after application restart.
|
|
6
|
+
* This is a secure implementation that doesn't persist sensitive data to disk.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SafeSessionStore = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* In-memory session store implementation
|
|
12
|
+
*
|
|
13
|
+
* Stores session data in a Map. All data is lost when the application restarts.
|
|
14
|
+
* This is the default secure implementation that doesn't write sensitive data to files.
|
|
15
|
+
*/
|
|
16
|
+
class SafeSessionStore {
|
|
17
|
+
sessions = new Map();
|
|
18
|
+
/**
|
|
19
|
+
* Load session configuration for destination
|
|
20
|
+
* @param destination Destination name (e.g., "TRIAL")
|
|
21
|
+
* @returns EnvConfig object or null if not found
|
|
22
|
+
*/
|
|
23
|
+
async loadSession(destination) {
|
|
24
|
+
return this.sessions.get(destination) || null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Save session configuration for destination
|
|
28
|
+
* @param destination Destination name (e.g., "TRIAL")
|
|
29
|
+
* @param config Session configuration to save
|
|
30
|
+
*/
|
|
31
|
+
async saveSession(destination, config) {
|
|
32
|
+
this.sessions.set(destination, config);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Delete session for destination
|
|
36
|
+
* @param destination Destination name (e.g., "TRIAL")
|
|
37
|
+
*/
|
|
38
|
+
async deleteSession(destination) {
|
|
39
|
+
this.sessions.delete(destination);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.SafeSessionStore = SafeSessionStore;
|
package/dist/stores/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Storage implementations for AuthBroker
|
|
3
3
|
*/
|
|
4
|
-
export { ServiceKeyStore, SessionStore } from './interfaces';
|
|
4
|
+
export { IServiceKeyStore, ISessionStore, ServiceKeyStore, SessionStore } from './interfaces';
|
|
5
5
|
export { FileServiceKeyStore } from './FileServiceKeyStore';
|
|
6
6
|
export { FileSessionStore } from './FileSessionStore';
|
|
7
|
+
export { SafeSessionStore } from './SafeSessionStore';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/stores/index.js
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* Storage implementations for AuthBroker
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FileSessionStore = exports.FileServiceKeyStore = void 0;
|
|
6
|
+
exports.SafeSessionStore = exports.FileSessionStore = exports.FileServiceKeyStore = void 0;
|
|
7
7
|
var FileServiceKeyStore_1 = require("./FileServiceKeyStore");
|
|
8
8
|
Object.defineProperty(exports, "FileServiceKeyStore", { enumerable: true, get: function () { return FileServiceKeyStore_1.FileServiceKeyStore; } });
|
|
9
9
|
var FileSessionStore_1 = require("./FileSessionStore");
|
|
10
10
|
Object.defineProperty(exports, "FileSessionStore", { enumerable: true, get: function () { return FileSessionStore_1.FileSessionStore; } });
|
|
11
|
+
var SafeSessionStore_1 = require("./SafeSessionStore");
|
|
12
|
+
Object.defineProperty(exports, "SafeSessionStore", { enumerable: true, get: function () { return SafeSessionStore_1.SafeSessionStore; } });
|
|
@@ -11,7 +11,7 @@ import { ServiceKey, EnvConfig } from '../types';
|
|
|
11
11
|
* Service keys contain UAA credentials and SAP URL for a destination.
|
|
12
12
|
* Default implementation: FileServiceKeyStore (reads from {destination}.json files)
|
|
13
13
|
*/
|
|
14
|
-
export interface
|
|
14
|
+
export interface IServiceKeyStore {
|
|
15
15
|
/**
|
|
16
16
|
* Get service key for destination
|
|
17
17
|
* @param destination Destination name (e.g., "TRIAL")
|
|
@@ -25,7 +25,7 @@ export interface ServiceKeyStore {
|
|
|
25
25
|
* Session data contains JWT tokens, refresh tokens, UAA config, and SAP URL.
|
|
26
26
|
* Default implementation: FileSessionStore (reads/writes {destination}.env files)
|
|
27
27
|
*/
|
|
28
|
-
export interface
|
|
28
|
+
export interface ISessionStore {
|
|
29
29
|
/**
|
|
30
30
|
* Load session configuration for destination
|
|
31
31
|
* @param destination Destination name (e.g., "TRIAL")
|
|
@@ -44,4 +44,8 @@ export interface SessionStore {
|
|
|
44
44
|
*/
|
|
45
45
|
deleteSession?(destination: string): Promise<void>;
|
|
46
46
|
}
|
|
47
|
+
/** @deprecated Use IServiceKeyStore instead */
|
|
48
|
+
export type ServiceKeyStore = IServiceKeyStore;
|
|
49
|
+
/** @deprecated Use ISessionStore instead */
|
|
50
|
+
export type SessionStore = ISessionStore;
|
|
47
51
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/stores/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/stores/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAChE;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAE5D;;;;OAIG;IACH,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnE;;;OAGG;IACH,aAAa,CAAC,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAGD,+CAA+C;AAC/C,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAE/C,4CAA4C;AAC5C,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED