@mcp-abap-adt/auth-broker 0.1.7 → 0.1.9

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 CHANGED
@@ -9,6 +9,39 @@ 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
+ ## [Unreleased]
13
+
14
+ ## [0.1.9] - 2025-12-05
15
+
16
+ ### Changed
17
+ - **Dependency Injection for Logger**: Migrated from concrete `Logger` implementation to `ILogger` interface
18
+ - Removed dependency on `@mcp-abap-adt/logger` package
19
+ - Now uses `ILogger` interface from `@mcp-abap-adt/interfaces`
20
+ - Logger parameter in constructor is optional - uses no-op logger if not provided
21
+ - Follows Dependency Inversion Principle - depends on interface, not implementation
22
+ - **Bin Script Fixes**: Fixed `generate-env-from-service-key.ts` script
23
+ - 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`)
24
+ - Fixed constructor parameters: changed from array `[directory]` to string `directory` for all store constructors
25
+
26
+ ### Removed
27
+ - **Unused Dependencies**: Removed `@mcp-abap-adt/connection` dependency (not used in production code)
28
+
29
+ ## [0.1.8] - 2025-12-04
30
+
31
+ ### Added
32
+ - **Interfaces Package Integration**: Migrated to use `@mcp-abap-adt/interfaces` package for all interface definitions
33
+ - All interfaces now imported from shared package
34
+ - Backward compatibility maintained with type aliases
35
+ - Dependency on `@mcp-abap-adt/interfaces@^0.1.0` added
36
+ - Updated `@mcp-abap-adt/connection` dependency to `^0.1.14`
37
+
38
+ ### Changed
39
+ - **Interface Renaming**: Interfaces renamed to follow `I` prefix convention:
40
+ - `TokenProviderResult` → `ITokenProviderResult` (type alias for backward compatibility)
41
+ - `TokenProviderOptions` → `ITokenProviderOptions` (type alias for backward compatibility)
42
+ - Old names still work via type aliases for backward compatibility
43
+ - **AuthType Export**: `AuthType` now exported from `@mcp-abap-adt/interfaces` instead of local definition
44
+
12
45
  ## [0.1.7] - 2025-12-04
13
46
 
14
47
  ### Changed
@@ -45,7 +78,7 @@ Thank you to all contributors! See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the co
45
78
  - Token validator utility (moved to providers)
46
79
  - Authentication functions (moved to providers)
47
80
 
48
- ## [0.1.5] - 2025-12-03
81
+ ## [0.1.5] - 2025-12-02
49
82
 
50
83
  ### Changed
51
84
  - **Interface Naming** - All interfaces now start with `I` prefix
@@ -253,64 +286,6 @@ Thank you to all contributors! See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the co
253
286
  - Properly expands `~` to home directory in paths
254
287
  - Added diagnostic logging controlled by `TEST_VERBOSE` environment variable
255
288
 
256
- ## [0.1.5] - 2025-12-02
257
-
258
- ### Added
259
- - **SafeSessionStore** - New in-memory session store implementation
260
- - Stores session data in memory (Map) - data is lost after application restart
261
- - Secure by default - doesn't persist sensitive data to disk
262
- - Use when you want to ensure tokens are not saved to files
263
- - Perfect for applications that require re-authentication after restart
264
- - **SafeSessionStore Tests** - Comprehensive test coverage for SafeSessionStore
265
- - Tests for `loadSession()` - loading non-existent, existing, and deleted sessions
266
- - Tests for `saveSession()` - saving, overwriting, and multiple destinations
267
- - Tests for `deleteSession()` - deleting existing and non-existent sessions
268
- - Tests for in-memory behavior - data isolation between instances
269
- - 11 test cases covering all functionality
270
-
271
- ### Changed
272
- - **Interface Naming** - Renamed interfaces for better readability
273
- - `ServiceKeyStore` → `IServiceKeyStore` (new interface name)
274
- - `SessionStore` → `ISessionStore` (new interface name)
275
- - Old names still available as type aliases for backward compatibility
276
- - All implementations updated to use new interface names
277
- - **AuthBroker Constructor** - Simplified API
278
- - Removed `searchPathsOrStores` parameter (string/array/object)
279
- - Now accepts only `stores` object with `serviceKeyStore` and `sessionStore` properties
280
- - Consumers must explicitly provide stores - no automatic path resolution
281
- - Default stores: `FileServiceKeyStore()` and `FileSessionStore()` if not provided
282
- - This change gives consumers full control over storage implementation
283
-
284
- ### Breaking Changes
285
- - **AuthBroker Constructor** - API change
286
- - Old API: `new AuthBroker(searchPaths?: string | string[], browser?: string, logger?: Logger)`
287
- - New API: `new AuthBroker(stores?: { serviceKeyStore?: IServiceKeyStore; sessionStore?: ISessionStore }, browser?: string, logger?: Logger)`
288
- - Migration: Instead of passing paths, create stores explicitly:
289
- ```typescript
290
- // Old way (no longer works)
291
- const broker = new AuthBroker(['/path/to/destinations']);
292
-
293
- // New way
294
- const { FileServiceKeyStore, FileSessionStore } = require('@mcp-abap-adt/auth-broker');
295
- const broker = new AuthBroker({
296
- serviceKeyStore: new FileServiceKeyStore(['/path/to/destinations']),
297
- sessionStore: new FileSessionStore(['/path/to/destinations']),
298
- });
299
- ```
300
-
301
- ### Fixed
302
- - **Test Helpers** - Updated test helpers to use new AuthBroker API
303
- - `testHelpers.ts` now uses `FileServiceKeyStore` and `FileSessionStore` with explicit paths
304
- - All existing tests updated to work with new constructor signature
305
- - Test coverage maintained at 100% for all components
306
-
307
- ### Technical Details
308
- - Consumers now have full control over storage implementation
309
- - Can choose between `FileSessionStore` (persists to disk) and `SafeSessionStore` (in-memory)
310
- - No automatic path resolution - consumers decide where to store files
311
- - Better separation of concerns - storage logic is explicit
312
- - All tests updated and passing (60 tests across 8 test suites)
313
-
314
289
  ## [0.1.4] - 2025-12-01
315
290
 
316
291
  ### Dependencies
package/README.md CHANGED
@@ -157,6 +157,108 @@ This package supports two types of BTP authentication:
157
157
  - **ABAP URL**: Required, from service key or YAML configuration
158
158
  - **Use Case**: Accessing ABAP systems in BTP with full permissions
159
159
 
160
+ ## Responsibilities and Design Principles
161
+
162
+ ### Core Development Principle
163
+
164
+ **Interface-Only Communication**: This package follows a fundamental development principle: **all interactions with external dependencies happen ONLY through interfaces**. The code knows **NOTHING beyond what is defined in the interfaces**.
165
+
166
+ This means:
167
+ - Does not know about concrete implementation classes (e.g., `AbapSessionStore`, `BtpTokenProvider`)
168
+ - Does not know about internal data structures or methods not defined in interfaces
169
+ - Does not make assumptions about implementation behavior beyond interface contracts
170
+ - Does not access properties or methods not explicitly defined in interfaces
171
+
172
+ This principle ensures:
173
+ - **Loose coupling**: `AuthBroker` is decoupled from concrete implementations
174
+ - **Flexibility**: New implementations can be added without modifying `AuthBroker`
175
+ - **Testability**: Easy to mock dependencies for testing
176
+ - **Maintainability**: Changes to implementations don't affect `AuthBroker`
177
+
178
+ ### Package Responsibilities
179
+
180
+ The `@mcp-abap-adt/auth-broker` package defines **interfaces** and provides **orchestration logic** for authentication. It does **not** implement concrete storage or token acquisition mechanisms - these are provided by separate packages (`@mcp-abap-adt/auth-stores`, `@mcp-abap-adt/auth-providers`).
181
+
182
+ #### What AuthBroker Does
183
+
184
+ - **Orchestrates authentication flows**: Coordinates token retrieval, validation, and refresh using provided stores and providers
185
+ - **Manages token lifecycle**: Handles token caching, validation, and automatic refresh
186
+ - **Works with interfaces only**: Uses `IServiceKeyStore`, `ISessionStore`, and `ITokenProvider` interfaces without knowing concrete implementations
187
+ - **Delegates to providers**: Calls `tokenProvider.getConnectionConfig()` to obtain tokens and connection configuration
188
+ - **Delegates to stores**: Uses `sessionStore.setConnectionConfig()` to save tokens and connection configuration
189
+
190
+ #### What AuthBroker Does NOT Do
191
+
192
+ - **Does NOT know about `serviceUrl`**: `AuthBroker` does not know whether a specific `ISessionStore` implementation requires `serviceUrl` or not. It simply passes the `IConnectionConfig` returned by `tokenProvider` to `sessionStore.setConnectionConfig()`
193
+ - **Does NOT merge configurations**: `AuthBroker` does not merge `serviceUrl` from service keys with connection config from token providers. This is the responsibility of the consumer or the session store implementation
194
+ - **Does NOT implement storage**: File I/O, parsing, and storage logic are handled by concrete store implementations from `@mcp-abap-adt/auth-stores`
195
+ - **Does NOT implement token acquisition**: OAuth2 flows, refresh token logic, and client credentials are handled by concrete provider implementations from `@mcp-abap-adt/auth-providers`
196
+
197
+ ### Consumer Responsibilities
198
+
199
+ The **consumer** (application using `AuthBroker`) is responsible for:
200
+
201
+ 1. **Selecting appropriate implementations**: Choose the correct `IServiceKeyStore`, `ISessionStore`, and `ITokenProvider` implementations based on the use case:
202
+ - **ABAP systems**: Use `AbapServiceKeyStore`, `AbapSessionStore` (or `SafeAbapSessionStore`), and `BtpTokenProvider`
203
+ - **BTP systems**: Use `AbapServiceKeyStore`, `BtpSessionStore` (or `SafeBtpSessionStore`), and `BtpTokenProvider`
204
+ - **XSUAA services**: Use `XsuaaServiceKeyStore`, `XsuaaSessionStore` (or `SafeXsuaaSessionStore`), and `XsuaaTokenProvider`
205
+
206
+ 2. **Ensuring complete configuration**: If a session store requires `serviceUrl` (e.g., `AbapSessionStore` requires `sapUrl`), the consumer must ensure that:
207
+ - The session is created with `serviceUrl` before calling `AuthBroker.getToken()`, OR
208
+ - The session store implementation handles `serviceUrl` retrieval internally (e.g., from `serviceKeyStore`)
209
+
210
+ 3. **Understanding store requirements**: Different session store implementations have different requirements:
211
+ - `AbapSessionStore`: Requires `sapUrl` (maps to `serviceUrl` in `IConnectionConfig`)
212
+ - `BtpSessionStore`: Does not require `serviceUrl` (uses `mcpUrl` instead)
213
+ - `XsuaaSessionStore`: Does not require `serviceUrl` (MCP URL is optional)
214
+
215
+ ### Store Responsibilities
216
+
217
+ Concrete `ISessionStore` implementations are responsible for:
218
+
219
+ - **Handling their own data format**: Each store knows its internal data format (e.g., `AbapSessionData`, `BtpBaseSessionData`)
220
+ - **Converting between formats**: Converting between `IConfig`/`IConnectionConfig` and internal storage format
221
+ - **Managing required fields**: If a store requires `serviceUrl` (e.g., `AbapSessionStore`), it should:
222
+ - Retrieve it from `serviceKeyStore` if not provided in `IConnectionConfig`, OR
223
+ - Use existing value from current session if available, OR
224
+ - Throw an error if neither is available (depending on implementation)
225
+
226
+ ### Provider Responsibilities
227
+
228
+ Concrete `ITokenProvider` implementations are responsible for:
229
+
230
+ - **Obtaining tokens**: Using OAuth2 flows, refresh tokens, or client credentials to obtain JWT tokens
231
+ - **Returning connection config**: Returning `IConnectionConfig` with `authorizationToken` and optionally `serviceUrl` (if known)
232
+ - **Not returning `serviceUrl` if unknown**: Providers like `BtpTokenProvider` may not return `serviceUrl` because they only handle token acquisition, not connection configuration
233
+
234
+ ### Design Principles
235
+
236
+ 1. **Interface-Only Communication** (Core Principle): All interactions with external dependencies happen **ONLY through interfaces**. The code knows **NOTHING beyond what is defined in the interfaces** (see [Core Development Principle](#core-development-principle) above)
237
+ 2. **Dependency Inversion Principle (DIP)**: `AuthBroker` depends on abstractions (`IServiceKeyStore`, `ISessionStore`, `ITokenProvider`), not concrete implementations
238
+ 3. **Single Responsibility**: Each component has a single, well-defined responsibility:
239
+ - `AuthBroker`: Orchestration and token lifecycle management
240
+ - `ISessionStore`: Session data storage and retrieval
241
+ - `ITokenProvider`: Token acquisition
242
+ - `IServiceKeyStore`: Service key storage and retrieval
243
+ 4. **Interface Segregation**: Interfaces are focused and minimal, containing only what's necessary for their specific purpose
244
+ 5. **Open/Closed Principle**: New store and provider implementations can be added without modifying `AuthBroker`
245
+
246
+ ### Example: Why AuthBroker Doesn't Handle `serviceUrl`
247
+
248
+ Consider this scenario:
249
+ - `BtpTokenProvider.getConnectionConfig()` returns `IConnectionConfig` with `authorizationToken` but **without** `serviceUrl` (because it only handles token acquisition)
250
+ - `AbapSessionStore.setConnectionConfig()` requires `sapUrl` (which maps to `serviceUrl`)
251
+
252
+ If `AuthBroker` tried to merge `serviceUrl` from `serviceKeyStore`, it would:
253
+ 1. Violate the DIP by knowing about specific store requirements
254
+ 2. Break the abstraction - `AuthBroker` shouldn't know that `AbapSessionStore` needs `serviceUrl`
255
+ 3. Create coupling between `AuthBroker` and concrete implementations
256
+
257
+ Instead, the consumer or `AbapSessionStore` itself should handle this:
258
+ - **Option 1**: Consumer retrieves `serviceUrl` from `serviceKeyStore` and ensures it's in the session before calling `AuthBroker.getToken()`
259
+ - **Option 2**: `AbapSessionStore.setConnectionConfig()` retrieves `serviceUrl` from `serviceKeyStore` internally if not provided
260
+ - **Option 3**: `AbapSessionStore.setConnectionConfig()` uses existing `sapUrl` from current session if available
261
+
160
262
  ## API
161
263
 
162
264
  ### `AuthBroker`
@@ -171,7 +273,7 @@ new AuthBroker(
171
273
  tokenProvider?: ITokenProvider;
172
274
  },
173
275
  browser?: string,
174
- logger?: Logger
276
+ logger?: ILogger
175
277
  )
176
278
  ```
177
279
 
@@ -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-btp';
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([serviceKeyDir])
63
- : new AbapServiceKeyStore([serviceKeyDir]);
61
+ ? new XsuaaServiceKeyStore(serviceKeyDir)
62
+ : new AbapServiceKeyStore(serviceKeyDir);
64
63
 
65
64
  const sessionStore = isXsuaa
66
- ? new XsuaaSessionStore([sessionDir])
67
- : new AbapSessionStore([sessionDir]);
65
+ ? new XsuaaSessionStore(sessionDir)
66
+ : new AbapSessionStore(sessionDir);
68
67
 
69
68
  // Create token provider
70
69
  const tokenProvider = isXsuaa
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Main AuthBroker class for managing JWT tokens based on destinations
3
3
  */
4
- import { Logger } from '@mcp-abap-adt/logger';
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 default logger.
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?: 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.
@@ -1 +1 @@
1
- {"version":3,"file":"AuthBroker.d.ts","sourceRoot":"","sources":["../src/AuthBroker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAiB,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,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,MAAM;IASjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ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;;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"}
@@ -4,7 +4,15 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AuthBroker = void 0;
7
- const logger_1 = require("@mcp-abap-adt/logger");
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,14 @@ 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 default logger.
34
+ * @param logger Optional logger instance implementing ILogger interface. If not provided, uses no-op logger.
27
35
  */
28
36
  constructor(stores, browser, logger) {
29
37
  this.serviceKeyStore = stores.serviceKeyStore;
30
38
  this.sessionStore = stores.sessionStore;
31
39
  this.tokenProvider = stores.tokenProvider;
32
40
  this.browser = browser || 'system';
33
- this.logger = logger || logger_1.defaultLogger;
41
+ this.logger = logger || noOpLogger;
34
42
  }
35
43
  /**
36
44
  * Get authentication token for destination.
package/dist/index.d.ts CHANGED
@@ -6,5 +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 { Logger } from '@mcp-abap-adt/logger';
9
+ export type { ILogger } from '@mcp-abap-adt/interfaces';
10
+ export type { AuthType } from '@mcp-abap-adt/interfaces';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -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,MAAM,EAAE,MAAM,sBAAsB,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;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"}
@@ -6,44 +6,8 @@
6
6
  * - XSUAA: client_credentials grant type (no browser)
7
7
  * - BTP/ABAP: browser-based OAuth2 or refresh token
8
8
  */
9
- import { IAuthorizationConfig, IConnectionConfig } from '../stores/interfaces';
10
- /**
11
- * Result from token provider
12
- */
13
- export interface TokenProviderResult {
14
- /** Connection configuration with authorization token */
15
- connectionConfig: IConnectionConfig;
16
- /** Refresh token (optional, for BTP/ABAP) */
17
- refreshToken?: string;
18
- }
19
- /**
20
- * Interface for token providers
21
- *
22
- * Takes authorization configuration and returns connection configuration with token.
23
- */
24
- export interface ITokenProvider {
25
- /**
26
- * Get connection configuration with token from authorization configuration
27
- * @param authConfig Authorization configuration (UAA credentials, optional refresh token)
28
- * @param options Optional provider-specific options (e.g., browser type for BTP)
29
- * @returns Promise that resolves to connection configuration with authorization token and optional refresh token
30
- */
31
- getConnectionConfig(authConfig: IAuthorizationConfig, options?: TokenProviderOptions): Promise<TokenProviderResult>;
32
- /**
33
- * Validate JWT token by testing connection to service
34
- * @param token JWT token to validate
35
- * @param serviceUrl Service URL (optional, for services that require URL validation)
36
- * @returns Promise that resolves to true if token is valid, false otherwise
37
- */
38
- validateToken?(token: string, serviceUrl?: string): Promise<boolean>;
39
- }
40
- /**
41
- * Options for token providers
42
- */
43
- export interface TokenProviderOptions {
44
- /** Browser type for browser-based authentication (chrome, edge, firefox, system, none) */
45
- browser?: string;
46
- /** Logger instance for logging */
47
- logger?: import('@mcp-abap-adt/logger').Logger;
48
- }
9
+ import type { IAuthorizationConfig, IConnectionConfig, ITokenProvider, ITokenProviderResult, ITokenProviderOptions } from '@mcp-abap-adt/interfaces';
10
+ export type { ITokenProvider, IAuthorizationConfig, IConnectionConfig, };
11
+ export type TokenProviderResult = ITokenProviderResult;
12
+ export type TokenProviderOptions = ITokenProviderOptions;
49
13
  //# sourceMappingURL=ITokenProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ITokenProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ITokenProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,wDAAwD;IACxD,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,mBAAmB,CACjB,UAAU,EAAE,oBAAoB,EAChC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhC;;;;;OAKG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtE;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,MAAM,CAAC,EAAE,OAAO,sBAAsB,EAAE,MAAM,CAAC;CAChD"}
1
+ {"version":3,"file":"ITokenProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ITokenProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,iBAAiB,GAClB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACvD,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC"}
@@ -1,117 +1,9 @@
1
1
  /**
2
2
  * Storage interfaces for AuthBroker
3
3
  *
4
- * All interfaces are defined here. Types (type aliases) are in types.ts.
4
+ * All interfaces are imported from @mcp-abap-adt/interfaces package.
5
+ * Type aliases (type) are in types.ts.
5
6
  */
6
- import type { IConfig } from '../types';
7
- /**
8
- * Authorization configuration - values needed for obtaining and refreshing tokens
9
- * Returned by stores with actual values (not file paths)
10
- */
11
- export interface IAuthorizationConfig {
12
- /** UAA URL for token refresh */
13
- uaaUrl: string;
14
- /** UAA client ID */
15
- uaaClientId: string;
16
- /** UAA client secret */
17
- uaaClientSecret: string;
18
- /** Refresh token for token renewal (optional) */
19
- refreshToken?: string;
20
- }
21
- /**
22
- * Connection configuration - values needed for connecting to services
23
- * Returned by stores with actual values (not file paths)
24
- */
25
- export interface IConnectionConfig {
26
- /** Service URL (SAP/ABAP/MCP URL) - undefined for XSUAA if not provided */
27
- serviceUrl?: string;
28
- /** Authorization token (JWT token) */
29
- authorizationToken: string;
30
- /** SAP client number (optional, for ABAP/BTP) */
31
- sapClient?: string;
32
- /** Language (optional, for ABAP/BTP) */
33
- language?: string;
34
- }
35
- /**
36
- * Interface for storing and retrieving service keys
37
- *
38
- * Service keys contain UAA credentials and connection URLs.
39
- */
40
- export interface IServiceKeyStore {
41
- /**
42
- * Get raw service key for destination
43
- * @param destination Destination name (e.g., "TRIAL")
44
- * @returns Service key object (implementation-specific) or null if not found
45
- */
46
- getServiceKey(destination: string): Promise<IConfig | null>;
47
- /**
48
- * Get authorization configuration from service key
49
- * Returns values needed for obtaining and refreshing tokens
50
- * @param destination Destination name (e.g., "TRIAL")
51
- * @returns IAuthorizationConfig with actual values or null if not found
52
- */
53
- getAuthorizationConfig(destination: string): Promise<IAuthorizationConfig | null>;
54
- /**
55
- * Get connection configuration from service key
56
- * Returns values needed for connecting to services
57
- * @param destination Destination name (e.g., "TRIAL")
58
- * @returns IConnectionConfig with actual values or null if not found
59
- */
60
- getConnectionConfig(destination: string): Promise<IConnectionConfig | null>;
61
- }
62
- /**
63
- * Interface for session stores - stores and retrieves session data
64
- *
65
- * Session stores handle loading, saving, and managing session data (tokens, configuration).
66
- */
67
- export interface ISessionStore {
68
- /**
69
- * Load session configuration for destination
70
- * Returns optional composition of IAuthorizationConfig and IConnectionConfig
71
- * Can contain either authorization config, or connection config, or both
72
- * @param destination Destination name (e.g., "TRIAL" or "mcp")
73
- * @returns IConfig with actual values or null if not found
74
- */
75
- loadSession(destination: string): Promise<IConfig | null>;
76
- /**
77
- * Save session configuration for destination
78
- * Accepts IConfig (optional composition) or internal representation (for backward compatibility)
79
- * @param destination Destination name (e.g., "TRIAL" or "mcp")
80
- * @param config IConfig or internal session configuration to save
81
- */
82
- saveSession(destination: string, config: IConfig | unknown): Promise<void>;
83
- /**
84
- * Delete session for destination (optional)
85
- * @param destination Destination name (e.g., "TRIAL" or "mcp")
86
- */
87
- deleteSession?(destination: string): Promise<void>;
88
- /**
89
- * Get authorization configuration with actual values (not file paths)
90
- * Returns values needed for obtaining and refreshing tokens
91
- * @param destination Destination name (e.g., "TRIAL" or "mcp")
92
- * @returns IAuthorizationConfig with actual values or null if not found
93
- */
94
- getAuthorizationConfig(destination: string): Promise<IAuthorizationConfig | null>;
95
- /**
96
- * Get connection configuration with actual values (not file paths)
97
- * Returns values needed for connecting to services
98
- * @param destination Destination name (e.g., "TRIAL" or "mcp")
99
- * @returns IConnectionConfig with actual values or null if not found
100
- */
101
- getConnectionConfig(destination: string): Promise<IConnectionConfig | null>;
102
- /**
103
- * Set authorization configuration
104
- * Updates values needed for obtaining and refreshing tokens
105
- * @param destination Destination name (e.g., "TRIAL" or "mcp")
106
- * @param config IAuthorizationConfig with values to set
107
- */
108
- setAuthorizationConfig(destination: string, config: IAuthorizationConfig): Promise<void>;
109
- /**
110
- * Set connection configuration
111
- * Updates values needed for connecting to services
112
- * @param destination Destination name (e.g., "TRIAL" or "mcp")
113
- * @param config IConnectionConfig with values to set
114
- */
115
- setConnectionConfig(destination: string, config: IConnectionConfig): Promise<void>;
116
- }
7
+ import type { IAuthorizationConfig, IConnectionConfig, IServiceKeyStore, ISessionStore } from '@mcp-abap-adt/interfaces';
8
+ export type { IAuthorizationConfig, IConnectionConfig, IServiceKeyStore, ISessionStore, };
117
9
  //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/stores/interfaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,oB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B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAE5E;;;;;OAKG;IACH,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzF;;;;;OAKG;IACH,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpF"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/stores/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EAEd,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,CAAC"}
@@ -2,6 +2,7 @@
2
2
  /**
3
3
  * Storage interfaces for AuthBroker
4
4
  *
5
- * All interfaces are defined here. Types (type aliases) are in types.ts.
5
+ * All interfaces are imported from @mcp-abap-adt/interfaces package.
6
+ * Type aliases (type) are in types.ts.
6
7
  */
7
8
  Object.defineProperty(exports, "__esModule", { value: true });
package/dist/types.d.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  /**
2
2
  * Type definitions for auth-broker package
3
3
  *
4
- * Type aliases (type) are defined here. Interfaces are in stores/interfaces.ts.
4
+ * Type aliases (type) are defined here. Interfaces are imported from @mcp-abap-adt/interfaces.
5
5
  */
6
- import type { IAuthorizationConfig, IConnectionConfig } from './stores/interfaces';
7
- /**
8
- * Configuration - optional composition of authorization and connection configuration
9
- * Can contain either authorization config, or connection config, or both
10
- */
11
- export type IConfig = Partial<IAuthorizationConfig> & Partial<IConnectionConfig>;
12
- export type { IAuthorizationConfig, IConnectionConfig, IServiceKeyStore, ISessionStore, } from './stores/interfaces';
6
+ import type { IAuthorizationConfig, IConnectionConfig, IConfig, IServiceKeyStore, ISessionStore } from '@mcp-abap-adt/interfaces';
7
+ export type { IConfig, IAuthorizationConfig, IConnectionConfig, IServiceKeyStore, ISessionStore, };
13
8
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAGjF,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,OAAO,EACP,gBAAgB,EAChB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EACV,OAAO,EACP,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,CAAC"}
package/dist/types.js CHANGED
@@ -2,6 +2,6 @@
2
2
  /**
3
3
  * Type definitions for auth-broker package
4
4
  *
5
- * Type aliases (type) are defined here. Interfaces are in stores/interfaces.ts.
5
+ * Type aliases (type) are defined here. Interfaces are imported from @mcp-abap-adt/interfaces.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/auth-broker",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
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,13 +51,11 @@
51
51
  "node": ">=18.0.0"
52
52
  },
53
53
  "dependencies": {
54
- "@mcp-abap-adt/connection": "^0.1.13",
55
- "@mcp-abap-adt/logger": "^0.1.0"
54
+ "@mcp-abap-adt/interfaces": "^0.1.1"
56
55
  },
57
56
  "devDependencies": {
58
- "@mcp-abap-adt/auth-providers": "^0.1.0",
59
- "@mcp-abap-adt/auth-stores-btp": "^0.1.0",
60
- "@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",
61
59
  "@types/express": "^5.0.5",
62
60
  "@types/jest": "^30.0.0",
63
61
  "@types/js-yaml": "^4.0.9",