catalyst-relay 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -59,6 +59,29 @@ const [session, loginError] = await client.login();
59
59
  if (loginError) throw loginError;
60
60
  console.log(`Logged in as ${session.username}`);
61
61
 
62
+ // --- SAML Authentication (requires playwright) ---
63
+ const [samlClient] = createClient({
64
+ url: 'https://sap-server:443',
65
+ client: '100',
66
+ auth: {
67
+ type: 'saml',
68
+ username: 'user@company.com',
69
+ password: 'pass'
70
+ },
71
+ insecure: true
72
+ });
73
+
74
+ // --- SSO Authentication (requires kerberos) ---
75
+ const [ssoClient] = createClient({
76
+ url: 'https://sap-server:443',
77
+ client: '100',
78
+ auth: {
79
+ type: 'sso',
80
+ slsUrl: 'https://sapsso.company.com'
81
+ },
82
+ insecure: true
83
+ });
84
+
62
85
  // Read ABAP objects
63
86
  const [objects, readError] = await client.read([
64
87
  { name: 'ZCL_MY_CLASS', extension: 'aclass' },
@@ -94,10 +117,33 @@ curl -X POST http://localhost:3000/login \
94
117
  }'
95
118
 
96
119
  # Response: { "success": true, "data": { "sessionId": "abc123", "username": "USER" } }
120
+
121
+ # Login with SAML
122
+ curl -X POST http://localhost:3000/login \
123
+ -H "Content-Type: application/json" \
124
+ -d '{
125
+ "url": "https://sap-server:443",
126
+ "client": "100",
127
+ "auth": { "type": "saml", "username": "user@company.com", "password": "pass" }
128
+ }'
129
+
130
+ # Login with SSO (Kerberos)
131
+ curl -X POST http://localhost:3000/login \
132
+ -H "Content-Type: application/json" \
133
+ -d '{
134
+ "url": "https://sap-server:443",
135
+ "client": "100",
136
+ "auth": { "type": "sso", "slsUrl": "https://sapsso.company.com" }
137
+ }'
97
138
  ```
98
139
 
99
140
  ## Features
100
141
 
142
+ ### Authentication
143
+ - **Basic Auth** — Username/password authentication
144
+ - **SAML** — Browser-automated SSO via identity providers (Azure AD, Okta, SAP IDP)
145
+ - **SSO (Kerberos)** — Windows domain authentication via SAP Secure Login Server
146
+
101
147
  ### Session Management
102
148
  - Login/logout with session tokens
103
149
  - Automatic CSRF token handling and refresh
@@ -376,9 +422,8 @@ The library uses only web standard APIs (`fetch`, `Request`, `Response`, `URL`)
376
422
 
377
423
  ## Known Limitations
378
424
 
379
- - **SAML authentication**: Stubbed out, not yet implemented
380
- - **SSO (Kerberos) authentication**: Stubbed out, not yet implemented
381
- - Basic authentication is fully functional
425
+ - **SSO (Kerberos)**: Primarily tested on Windows with Active Directory; Linux/macOS requires MIT Kerberos with valid ticket (`kinit`)
426
+ - **SAML**: First run downloads Chromium browser (~150MB) for headless automation
382
427
 
383
428
  ## Dependencies
384
429
 
@@ -389,6 +434,14 @@ The library uses only web standard APIs (`fetch`, `Request`, `Response`, `URL`)
389
434
  | `undici` | HTTP client with SSL bypass support |
390
435
  | `@xmldom/xmldom` | XML parsing for ADT responses |
391
436
  | `diff` | Text diffing for git-diff feature |
437
+ | `node-forge` | Certificate parsing and RSA key generation (SSO) |
438
+
439
+ ### Optional Peer Dependencies
440
+
441
+ | Package | Required For | Install |
442
+ |---------|--------------|---------|
443
+ | `playwright` | SAML authentication | `npm install playwright` |
444
+ | `kerberos` | SSO (Kerberos) authentication | `npm install kerberos` |
392
445
 
393
446
  ## Project Structure
394
447
 
@@ -401,6 +454,9 @@ src/
401
454
  │ ├── config.ts # Configuration loading
402
455
  │ ├── adt/ # ADT operations
403
456
  │ ├── auth/ # Authentication strategies
457
+ │ │ ├── basic/ # Username/password auth
458
+ │ │ ├── saml/ # SAML browser automation
459
+ │ │ └── sso/ # Kerberos + mTLS certificates
404
460
  │ ├── session/ # Session management
405
461
  │ └── utils/ # Shared utilities
406
462
  ├── types/ # TypeScript type definitions
package/dist/index.d.mts CHANGED
@@ -10,6 +10,26 @@ interface BasicAuthConfig {
10
10
  username: string;
11
11
  password: string;
12
12
  }
13
+ /**
14
+ * CSS selectors for SAML login form
15
+ */
16
+ interface SamlFormSelectors {
17
+ /** CSS selector for username input field */
18
+ username: string;
19
+ /** CSS selector for password input field */
20
+ password: string;
21
+ /** CSS selector for submit button */
22
+ submit: string;
23
+ }
24
+ /**
25
+ * SAML provider configuration
26
+ */
27
+ interface SamlProviderConfig {
28
+ /** Whether to ignore HTTPS certificate errors */
29
+ ignoreHttpsErrors: boolean;
30
+ /** CSS selectors for login form elements */
31
+ formSelectors: SamlFormSelectors;
32
+ }
13
33
  /**
14
34
  * SAML authentication configuration
15
35
  */
@@ -17,13 +37,23 @@ interface SamlAuthConfig {
17
37
  type: 'saml';
18
38
  username: string;
19
39
  password: string;
20
- provider?: string;
40
+ /** Optional custom provider configuration for non-standard login forms */
41
+ providerConfig?: SamlProviderConfig;
21
42
  }
22
43
  /**
23
44
  * SSO (Kerberos) authentication configuration
24
45
  */
25
46
  interface SsoAuthConfig {
26
47
  type: 'sso';
48
+ /** Secure Login Server URL (e.g., https://sapsso.corp.example.com) */
49
+ slsUrl: string;
50
+ /** SLS profile name (default: SAPSSO_P) */
51
+ profile?: string;
52
+ /** Kerberos service principal name override */
53
+ servicePrincipalName?: string;
54
+ /** Force certificate re-enrollment even if valid cert exists */
55
+ forceEnroll?: boolean;
56
+ /** @deprecated Use slsUrl instead */
27
57
  certificate?: string;
28
58
  }
29
59
  /**
@@ -402,12 +432,11 @@ interface DiffResult {
402
432
  * HTTP client for SAP ADT (ABAP Development Tools) with:
403
433
  * - Session management (login/logout)
404
434
  * - CSRF token fetching and automatic refresh
405
- * - Basic authentication (SAML and SSO to be implemented)
435
+ * - Basic, SAML, and SSO (Kerberos + mTLS) authentication
406
436
  * - Automatic retry on 403 CSRF errors
407
437
  * - Session reset on 500 errors
408
438
  *
409
439
  * Uses web standard APIs (fetch, Request, Response) - runtime-agnostic.
410
- * High-level ADT operations (CRAUD, preview, etc.) are stubs to be implemented.
411
440
  */
412
441
 
413
442
  interface ADTClient {
package/dist/index.d.ts CHANGED
@@ -10,6 +10,26 @@ interface BasicAuthConfig {
10
10
  username: string;
11
11
  password: string;
12
12
  }
13
+ /**
14
+ * CSS selectors for SAML login form
15
+ */
16
+ interface SamlFormSelectors {
17
+ /** CSS selector for username input field */
18
+ username: string;
19
+ /** CSS selector for password input field */
20
+ password: string;
21
+ /** CSS selector for submit button */
22
+ submit: string;
23
+ }
24
+ /**
25
+ * SAML provider configuration
26
+ */
27
+ interface SamlProviderConfig {
28
+ /** Whether to ignore HTTPS certificate errors */
29
+ ignoreHttpsErrors: boolean;
30
+ /** CSS selectors for login form elements */
31
+ formSelectors: SamlFormSelectors;
32
+ }
13
33
  /**
14
34
  * SAML authentication configuration
15
35
  */
@@ -17,13 +37,23 @@ interface SamlAuthConfig {
17
37
  type: 'saml';
18
38
  username: string;
19
39
  password: string;
20
- provider?: string;
40
+ /** Optional custom provider configuration for non-standard login forms */
41
+ providerConfig?: SamlProviderConfig;
21
42
  }
22
43
  /**
23
44
  * SSO (Kerberos) authentication configuration
24
45
  */
25
46
  interface SsoAuthConfig {
26
47
  type: 'sso';
48
+ /** Secure Login Server URL (e.g., https://sapsso.corp.example.com) */
49
+ slsUrl: string;
50
+ /** SLS profile name (default: SAPSSO_P) */
51
+ profile?: string;
52
+ /** Kerberos service principal name override */
53
+ servicePrincipalName?: string;
54
+ /** Force certificate re-enrollment even if valid cert exists */
55
+ forceEnroll?: boolean;
56
+ /** @deprecated Use slsUrl instead */
27
57
  certificate?: string;
28
58
  }
29
59
  /**
@@ -402,12 +432,11 @@ interface DiffResult {
402
432
  * HTTP client for SAP ADT (ABAP Development Tools) with:
403
433
  * - Session management (login/logout)
404
434
  * - CSRF token fetching and automatic refresh
405
- * - Basic authentication (SAML and SSO to be implemented)
435
+ * - Basic, SAML, and SSO (Kerberos + mTLS) authentication
406
436
  * - Automatic retry on 403 CSRF errors
407
437
  * - Session reset on 500 errors
408
438
  *
409
439
  * Uses web standard APIs (fetch, Request, Response) - runtime-agnostic.
410
- * High-level ADT operations (CRAUD, preview, etc.) are stubs to be implemented.
411
440
  */
412
441
 
413
442
  interface ADTClient {