@mcp-abap-adt/connection 9.4.2 → 10.0.2

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +182 -1
  2. package/README.md +78 -37
  3. package/dist/connection/AbstractAbapConnection.d.ts +211 -56
  4. package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
  5. package/dist/connection/AbstractAbapConnection.js +622 -255
  6. package/dist/connection/CloudHttpTransport.d.ts.map +1 -1
  7. package/dist/connection/CloudHttpTransport.js +15 -5
  8. package/dist/connection/CredentialAbapConnection.d.ts +21 -20
  9. package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
  10. package/dist/connection/CredentialAbapConnection.js +39 -46
  11. package/dist/connection/HttpTransport.d.ts +30 -14
  12. package/dist/connection/HttpTransport.d.ts.map +1 -1
  13. package/dist/connection/HttpTransport.js +99 -19
  14. package/dist/connection/IAdtTransport.d.ts +19 -2
  15. package/dist/connection/IAdtTransport.d.ts.map +1 -1
  16. package/dist/connection/OnPremHttpTransport.d.ts.map +1 -1
  17. package/dist/connection/OnPremHttpTransport.js +4 -3
  18. package/dist/connection/RfcTransport.d.ts +23 -3
  19. package/dist/connection/RfcTransport.d.ts.map +1 -1
  20. package/dist/connection/RfcTransport.js +48 -15
  21. package/dist/connection/authErrors.d.ts +61 -0
  22. package/dist/connection/authErrors.d.ts.map +1 -0
  23. package/dist/connection/authErrors.js +78 -0
  24. package/dist/connection/requestTarget.d.ts +12 -0
  25. package/dist/connection/requestTarget.d.ts.map +1 -0
  26. package/dist/connection/requestTarget.js +23 -0
  27. package/dist/connection/rfcConversation.d.ts +10 -5
  28. package/dist/connection/rfcConversation.d.ts.map +1 -1
  29. package/dist/connection/rfcConversation.js +6 -8
  30. package/dist/index.d.ts +1 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +4 -12
  33. package/dist/session/SessionLifecycle.d.ts +1 -1
  34. package/dist/session/SessionLifecycle.d.ts.map +1 -1
  35. package/docs/INDEX.md +4 -1
  36. package/docs/INSTALLATION.md +15 -7
  37. package/docs/JWT_AUTH_TOOLS.md +2 -2
  38. package/docs/MIGRATION-10.0.md +284 -0
  39. package/docs/SCOPE.md +2 -2
  40. package/docs/STATEFUL_SESSION_GUIDE.md +30 -10
  41. package/docs/USAGE.md +118 -35
  42. package/examples/README.md +5 -4
  43. package/examples/basic-connection.js +1 -1
  44. package/examples/jwt-with-token-refresh.js +14 -15
  45. package/examples/saml-connection.js +1 -1
  46. package/package.json +5 -4
  47. package/dist/auth/FileCertificateMaterialLoader.d.ts +0 -6
  48. package/dist/auth/FileCertificateMaterialLoader.d.ts.map +0 -1
  49. package/dist/auth/FileCertificateMaterialLoader.js +0 -28
  50. package/dist/auth/ntlm.d.ts +0 -26
  51. package/dist/auth/ntlm.d.ts.map +0 -1
  52. package/dist/auth/ntlm.js +0 -72
  53. package/dist/auth/providers.d.ts +0 -125
  54. package/dist/auth/providers.d.ts.map +0 -1
  55. package/dist/auth/providers.js +0 -183
  56. package/dist/utils/tokenRefresh.d.ts +0 -15
  57. package/dist/utils/tokenRefresh.d.ts.map +0 -1
  58. package/dist/utils/tokenRefresh.js +0 -55
@@ -1 +1 @@
1
- {"version":3,"file":"CloudHttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/CloudHttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAa9E,qBAAa,kBACX,SAAQ,aACR,YAAW,eAAe;IAE1B,SAAkB,IAAI,gBAAgB;IAEtC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAU;IAEnC;;;;;;;;;;;;;;;;;OAiBG;cACgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI3D,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAuB;IAExB,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqDhD,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IA4ChE;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;CAW5B"}
1
+ {"version":3,"file":"CloudHttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/CloudHttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAa9E,qBAAa,kBACX,SAAQ,aACR,YAAW,eAAe;IAE1B,SAAkB,IAAI,gBAAgB;IAEtC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAU;IAEnC;;;;;;;;;;;;;;;;;OAiBG;cACgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI3D,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAuB;IAExB,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IA4DhD,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IA6ChE;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;CAW5B"}
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.CloudHttpTransport = void 0;
22
22
  const cookies_js_1 = require("../utils/cookies.js");
23
23
  const timeouts_js_1 = require("../utils/timeouts.js");
24
+ const authErrors_js_1 = require("./authErrors.js");
24
25
  const HttpTransport_js_1 = require("./HttpTransport.js");
25
26
  const SESSIONS_PATH = '/sap/bc/adt/core/http/sessions';
26
27
  /** The versioned media types Eclipse asks this resource for, newest first. */
@@ -56,11 +57,15 @@ class CloudHttpTransport extends HttpTransport_js_1.HttpTransport {
56
57
  /** The address this server published for our session — the only close target. */
57
58
  resource = null;
58
59
  async open(context) {
60
+ // The logon, outside the swallowing `try`: a credential that refuses it
61
+ // (`AuthRefusedError`) is the caller's to hear, not a preflight to shrug at.
62
+ await super.open(context);
59
63
  try {
60
- // Read ONCE. The contract lets a provider answer differently each time —
61
- // a token provider renews behind the call — so two reads can build one
62
- // request out of two different credentials.
63
- const auth = await context.authHeaders();
64
+ // Authorized ONCE. The contract lets a provider answer differently each
65
+ // time — a token provider renews behind the call — so two calls can
66
+ // build one request out of two different credentials.
67
+ const auth = {};
68
+ await context.authorize(auth);
64
69
  const response = await this.send({
65
70
  method: 'GET',
66
71
  // The cache-buster is Eclipse's; kept because this must not be served
@@ -95,6 +100,10 @@ class CloudHttpTransport extends HttpTransport_js_1.HttpTransport {
95
100
  this.logger?.debug(`Security session opened: ${resource}`);
96
101
  }
97
102
  catch (error) {
103
+ // The provider will not authorize the preflight: its word, not a failed
104
+ // preflight.
105
+ if (error instanceof authErrors_js_1.AuthRefusedError)
106
+ throw error;
98
107
  // Not fatal here. If no session was opened, the establishment that
99
108
  // follows says so with the whole picture; an error raised from a
100
109
  // preflight would replace that with something less useful.
@@ -119,7 +128,8 @@ class CloudHttpTransport extends HttpTransport_js_1.HttpTransport {
119
128
  return;
120
129
  }
121
130
  try {
122
- const auth = await context.authHeaders();
131
+ const auth = {};
132
+ await context.authorize(auth);
123
133
  await this.sendDetached({
124
134
  method: 'DELETE',
125
135
  url: new URL(resource, context.baseUrl).toString(),
@@ -7,16 +7,15 @@
7
7
  * `/sap/bc/adt/discovery`, keep it, tolerate a failure — with the only
8
8
  * per-credential part being a step before it. That step is `prepare()`.
9
9
  *
10
- * So this owns the establishing call, and the credential contributes three
11
- * things at most: what to prepare, what header to send, and what TLS material
12
- * to present. Which system this is talking to was stated by the caller when it
10
+ * So this owns the establishing call, and the credential contributes what to
11
+ * prepare and what each request carries. Which system this is talking to was stated by the caller when it
13
12
  * chose the subclass, and is never worked out here.
14
13
  */
15
- import type { AgentOptions } from 'node:https';
16
- import type { IAuthProvider } from '@mcp-abap-adt/interfaces-auth';
14
+ import type { IAuthProvider, IAuthRejection, ILogonTarget } from '@mcp-abap-adt/interfaces-auth';
17
15
  import type { SapConfig } from '../config/sapConfig.js';
18
16
  import type { ILogger } from '../logger.js';
19
17
  import { AbstractAbapConnection } from './AbstractAbapConnection.js';
18
+ import { type GuardedAnswer } from './authErrors.js';
20
19
  import { type IAdtTransport } from './IAdtTransport.js';
21
20
  export declare abstract class CredentialAbapConnection<TCredential extends IAuthProvider = IAuthProvider> extends AbstractAbapConnection {
22
21
  /** Public because the type is the point: a caller can reach what it gave. */
@@ -27,29 +26,31 @@ export declare abstract class CredentialAbapConnection<TCredential extends IAuth
27
26
  /**
28
27
  * Whatever the credential needs before the first request goes out.
29
28
  *
30
- * Runs before the preflight, not inside the establishing call: building the
31
- * transport reads the TLS options, and a certificate whose material had not
32
- * been loaded yet rejected the connect while the argument was still being
33
- * evaluated — outside every catch, with no request sent.
29
+ * Runs before the preflight, not inside the establishing call: a credential
30
+ * that had not yet done its one-time work rejected the connect from inside an
31
+ * argument evaluation, outside every catch, with no request sent.
32
+ *
33
+ * A provider answers rather than throws; a throw is treated as an answer too
34
+ * (`guarded`), so a buggy provider fails the connect with words, not with an
35
+ * unhandled rejection.
34
36
  */
35
- /** The header last put on the wire, so a change can be seen. */
36
37
  protected prepareCredential(): Promise<void>;
37
38
  /**
38
- * Nothing here: the header is asked for asynchronously in `getAuthHeaders()`,
39
- * because a provider can renew behind the call and a synchronous read would
40
- * have to hold what it returned. The base's abstract member is satisfied and
41
- * unused.
42
- */
43
- protected buildAuthorizationHeader(): string;
44
- /**
45
- * The credential's cookies travel with its header.
39
+ * The credential writes what this request carries: its header, or its
40
+ * cookies, or both.
46
41
  *
47
42
  * On every path, not only on ordinary requests: a SAML session that is not
48
43
  * presented to the session preflight and the establishing call is a session
49
44
  * the server never sees us in.
50
45
  */
51
- getAuthHeaders(): Promise<Record<string, string>>;
52
- protected getHttpsAgentOptions(): AgentOptions;
46
+ protected authorizeRequest(headers: Record<string, string>): Promise<void>;
47
+ /** What the credential brings to a logon: TLS material, logon parameters. */
48
+ protected logon(target: ILogonTarget): Promise<void>;
49
+ /**
50
+ * The provider's answer, whole; a throw is an answer too (`guarded`), and
51
+ * is kept beside it to become the cause of the refusal.
52
+ */
53
+ protected credentialRejected(rejection: IAuthRejection): Promise<GuardedAnswer>;
53
54
  protected establishSession(): Promise<void>;
54
55
  }
55
56
  //# sourceMappingURL=CredentialAbapConnection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CredentialAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/CredentialAbapConnection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,oBAAoB,CAAC;AASnE,8BAAsB,wBAAwB,CAC5C,WAAW,SAAS,aAAa,GAAG,aAAa,CACjD,SAAQ,sBAAsB;IAG5B,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,WAAW;gBAFhC,MAAM,EAAE,SAAS;IACjB,6EAA6E;IACpE,UAAU,EAAE,WAAW,EAChC,SAAS,EAAE,aAAa,EACxB,MAAM,GAAE,OAAO,GAAG,IAAW,EAC7B,SAAS,CAAC,EAAE,MAAM;IAKpB;;;;;;;OAOG;IACH,gEAAgE;cAEvC,iBAAiB,IAAI,OAA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,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IASnE;;;OAGG;cACsB,kBAAkB,CACzC,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,aAAa,CAAC;cAIT,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CA+ClD"}
@@ -8,21 +8,16 @@
8
8
  * `/sap/bc/adt/discovery`, keep it, tolerate a failure — with the only
9
9
  * per-credential part being a step before it. That step is `prepare()`.
10
10
  *
11
- * So this owns the establishing call, and the credential contributes three
12
- * things at most: what to prepare, what header to send, and what TLS material
13
- * to present. Which system this is talking to was stated by the caller when it
11
+ * So this owns the establishing call, and the credential contributes what to
12
+ * prepare and what each request carries. Which system this is talking to was stated by the caller when it
14
13
  * chose the subclass, and is never worked out here.
15
14
  */
16
15
  Object.defineProperty(exports, "__esModule", { value: true });
17
16
  exports.CredentialAbapConnection = void 0;
18
17
  const AbstractAbapConnection_js_1 = require("./AbstractAbapConnection.js");
18
+ const authErrors_js_1 = require("./authErrors.js");
19
19
  const IAdtTransport_js_1 = require("./IAdtTransport.js");
20
- /** A 401 from the server, whatever transport shape it arrives in. */
21
- function isUnauthorized(error) {
22
- const status = error?.response
23
- ?.status;
24
- return status === 401;
25
- }
20
+ const requestTarget_js_1 = require("./requestTarget.js");
26
21
  class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapConnection {
27
22
  credential;
28
23
  constructor(config,
@@ -34,47 +29,49 @@ class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapC
34
29
  /**
35
30
  * Whatever the credential needs before the first request goes out.
36
31
  *
37
- * Runs before the preflight, not inside the establishing call: building the
38
- * transport reads the TLS options, and a certificate whose material had not
39
- * been loaded yet rejected the connect while the argument was still being
40
- * evaluated — outside every catch, with no request sent.
32
+ * Runs before the preflight, not inside the establishing call: a credential
33
+ * that had not yet done its one-time work rejected the connect from inside an
34
+ * argument evaluation, outside every catch, with no request sent.
35
+ *
36
+ * A provider answers rather than throws; a throw is treated as an answer too
37
+ * (`guarded`), so a buggy provider fails the connect with words, not with an
38
+ * unhandled rejection.
41
39
  */
42
- /** The header last put on the wire, so a change can be seen. */
43
40
  async prepareCredential() {
44
- await this.credential.prepare();
45
- }
46
- /**
47
- * Nothing here: the header is asked for asynchronously in `getAuthHeaders()`,
48
- * because a provider can renew behind the call and a synchronous read would
49
- * have to hold what it returned. The base's abstract member is satisfied and
50
- * unused.
51
- */
52
- buildAuthorizationHeader() {
53
- return '';
41
+ const { outcome, thrown } = await (0, authErrors_js_1.guarded)(() => this.credential.prepare());
42
+ if (!outcome.ok) {
43
+ throw new authErrors_js_1.AuthRefusedError(outcome.refusal, 'prepare', thrown);
44
+ }
54
45
  }
55
46
  /**
56
- * The credential's cookies travel with its header.
47
+ * The credential writes what this request carries: its header, or its
48
+ * cookies, or both.
57
49
  *
58
50
  * On every path, not only on ordinary requests: a SAML session that is not
59
51
  * presented to the session preflight and the establishing call is a session
60
52
  * the server never sees us in.
61
53
  */
62
- async getAuthHeaders() {
63
- const headers = await super.getAuthHeaders();
54
+ async authorizeRequest(headers) {
64
55
  // Asked per request, never held: a provider renews behind this call, and a
65
56
  // value kept here would be the stale one.
66
- const authorization = await this.credential.authorizationHeader();
67
- if (authorization) {
68
- headers.Authorization = authorization;
57
+ const { outcome, thrown } = await (0, authErrors_js_1.guarded)(() => this.credential.authorize((0, requestTarget_js_1.requestTargetOn)(headers)));
58
+ if (!outcome.ok) {
59
+ throw new authErrors_js_1.AuthRefusedError(outcome.refusal, 'request', thrown);
69
60
  }
70
- const cookies = this.credential.cookies();
71
- if (cookies) {
72
- headers.Cookie = cookies;
61
+ }
62
+ /** What the credential brings to a logon: TLS material, logon parameters. */
63
+ async logon(target) {
64
+ const { outcome, thrown } = await (0, authErrors_js_1.guarded)(() => this.credential.establish(target));
65
+ if (!outcome.ok) {
66
+ throw new authErrors_js_1.AuthRefusedError(outcome.refusal, 'logon', thrown);
73
67
  }
74
- return headers;
75
68
  }
76
- getHttpsAgentOptions() {
77
- return this.credential.transportMaterial();
69
+ /**
70
+ * The provider's answer, whole; a throw is an answer too (`guarded`), and
71
+ * is kept beside it to become the cause of the refusal.
72
+ */
73
+ async credentialRejected(rejection) {
74
+ return (0, authErrors_js_1.guarded)(() => this.credential.rejected(rejection));
78
75
  }
79
76
  async establishSession() {
80
77
  try {
@@ -84,18 +81,14 @@ class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapC
84
81
  // does nothing and holds no token. Demanding one here was what made
85
82
  // `connect()` impossible over RFC.
86
83
  //
87
- // There is no second path. A credential that wanted to run the exchange
88
- // itself would need the connection to ask which of the two does the work,
89
- // and a credential whose way in IS a round trip does not need that: the
90
- // wire asks `authHeaders()` PER ATTEMPT, so a one-shot token is offered
91
- // on the establishing call and withheld afterwards by the credential
92
- // itself, with nobody deciding anything.
84
+ // There is no second path. A credential whose way in IS a round trip
85
+ // does not need one: the wire authorizes PER ATTEMPT, so a one-shot token
86
+ // is offered on the establishing call and withheld afterwards by the
87
+ // credential itself, with nobody deciding anything.
93
88
  await this.transport.establish({
89
+ ...this.sessionContext(),
94
90
  baseUrl: await this.getBaseUrl(),
95
- authHeaders: () => this.getAuthHeaders(),
96
- extraHeaders: { 'sap-adt-connection-id': this.getSessionId() ?? '' },
97
- observe: (headers) => this.observeResponse(headers),
98
- isFatal: (error) => this.isSessionVerdict(error),
91
+ isFatal: (error) => this.endsTheExchange(error),
99
92
  });
100
93
  this.logger?.debug('Connected', {
101
94
  credential: this.credential.kind,
@@ -6,21 +6,22 @@
6
6
  * code path on one end cannot be named in a type — a default type parameter has
7
7
  * nothing to point at — so this is what makes the two ends symmetrical.
8
8
  *
9
- * No `open()` or `close()`. A request opens its own socket and there is no
10
- * conversation to establish or give back; those members exist for a transport
11
- * that owns a wire, which is RFC.
9
+ * Nothing to open or give back at this level. A request opens its own socket
10
+ * and there is no conversation to establish; `open()` only offers the
11
+ * credential its logon, and the subclasses add the session mechanism.
12
12
  *
13
13
  * **Where the two axes touch.** TLS client-certificate material comes from the
14
14
  * CREDENTIAL — a certificate authenticates through the transport rather than
15
- * through a header — and configures this. It is taken as a thunk rather than a
16
- * value so it is read when the client is first built, by which time the
17
- * credential has been prepared and knows what it holds. Read in a constructor,
18
- * it would be whatever was loaded before the connection started, which for a
19
- * certificate is nothing.
15
+ * through a header. The provider presents it at the logon (`logonTarget()`);
16
+ * the client is built lazily from it on the first request, over the
17
+ * constructor's `agentOptions` (`ca`, `rejectUnauthorized` — settings that are
18
+ * not the credential). Material that changes between logons drops the client;
19
+ * the cookie jar and the CSRF token are the session's and stay.
20
20
  */
21
21
  import { type AgentOptions } from 'node:https';
22
+ import type { ILogonTarget } from '@mcp-abap-adt/interfaces-auth';
22
23
  import type { ILogger } from '../logger.js';
23
- import type { IAdtEstablishContext, IAdtSessionContext, IAdtTransport, IAdtTransportRequest, IAdtTransportResponse } from './IAdtTransport.js';
24
+ import { type IAdtEstablishContext, type IAdtSessionContext, type IAdtTransport, type IAdtTransportRequest, type IAdtTransportResponse } from './IAdtTransport.js';
24
25
  export { isStatefulRequest } from './statefulRequest.js';
25
26
  export declare class HttpTransport implements IAdtTransport {
26
27
  private readonly agentOptions;
@@ -44,6 +45,11 @@ export declare class HttpTransport implements IAdtTransport {
44
45
  */
45
46
  readonly kind: string;
46
47
  private instance;
48
+ /**
49
+ * The TLS material the last logon offered. The client is built from it, and
50
+ * a logon offering different material drops the client — never the jar.
51
+ */
52
+ private material;
47
53
  /**
48
54
  * The wire's own state.
49
55
  *
@@ -151,15 +157,25 @@ export declare class HttpTransport implements IAdtTransport {
151
157
  protected sessionTypeHeaders(): Record<string, string>;
152
158
  /** A path becomes an address; anything already absolute is left alone. */
153
159
  private address;
160
+ /**
161
+ * What this wire says to a provider at a logon.
162
+ *
163
+ * TLS material is taken: the client is built from it, over `agentOptions`,
164
+ * and material that differs by value from the last logon's drops the client
165
+ * so the next request builds a new agent. Logon parameters belong to the RFC
166
+ * wire; a provider that needs them is told so and decides what that means.
167
+ */
168
+ protected logonTarget(): ILogonTarget;
154
169
  private client;
155
170
  /**
156
- * Nothing to ask for: an HTTP session arrives with the establishing call.
171
+ * The logon, and nothing else to ask for: an HTTP session arrives with the
172
+ * establishing call.
157
173
  *
158
- * Empty rather than absent. "There is no session resource here" is a fact
159
- * about this wire, and a fact is stated, not left for a caller to discover by
160
- * checking whether the method exists.
174
+ * The credential is offered the logon here, before any request — a cloud
175
+ * preflight included. "There is no session resource here" is a fact about
176
+ * this wire, and a fact is stated, not left for a caller to discover.
161
177
  */
162
- open(_context: IAdtSessionContext): Promise<void>;
178
+ open(context: IAdtSessionContext): Promise<void>;
163
179
  /**
164
180
  * Nothing to give back at this level.
165
181
  *
@@ -1 +1 @@
1
- {"version":3,"file":"HttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/HttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAuC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD,qBAAa,aAAc,YAAW,aAAa;IA6B/C,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IACzC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO;IApC1B;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAU;IAE/B,OAAO,CAAC,QAAQ,CAA8B;IAE9C;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;IACjD,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,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,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD;;;;;;OAMG;IACG,KAAK,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAExD;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIzE;;;;;;;;;;;;;OAaG;cACa,YAAY,CAC1B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;YAInB,QAAQ;CA4BvB"}
@@ -7,17 +7,17 @@
7
7
  * code path on one end cannot be named in a type — a default type parameter has
8
8
  * nothing to point at — so this is what makes the two ends symmetrical.
9
9
  *
10
- * No `open()` or `close()`. A request opens its own socket and there is no
11
- * conversation to establish or give back; those members exist for a transport
12
- * that owns a wire, which is RFC.
10
+ * Nothing to open or give back at this level. A request opens its own socket
11
+ * and there is no conversation to establish; `open()` only offers the
12
+ * credential its logon, and the subclasses add the session mechanism.
13
13
  *
14
14
  * **Where the two axes touch.** TLS client-certificate material comes from the
15
15
  * CREDENTIAL — a certificate authenticates through the transport rather than
16
- * through a header — and configures this. It is taken as a thunk rather than a
17
- * value so it is read when the client is first built, by which time the
18
- * credential has been prepared and knows what it holds. Read in a constructor,
19
- * it would be whatever was loaded before the connection started, which for a
20
- * certificate is nothing.
16
+ * through a header. The provider presents it at the logon (`logonTarget()`);
17
+ * the client is built lazily from it on the first request, over the
18
+ * constructor's `agentOptions` (`ca`, `rejectUnauthorized` — settings that are
19
+ * not the credential). Material that changes between logons drops the client;
20
+ * the cookie jar and the CSRF token are the session's and stay.
21
21
  */
22
22
  var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -27,7 +27,9 @@ exports.HttpTransport = exports.isStatefulRequest = void 0;
27
27
  const node_https_1 = require("node:https");
28
28
  const axios_1 = __importDefault(require("axios"));
29
29
  const cookies_js_1 = require("../utils/cookies.js");
30
+ const authErrors_js_1 = require("./authErrors.js");
30
31
  const csrfConfig_js_1 = require("./csrfConfig.js");
32
+ const IAdtTransport_js_1 = require("./IAdtTransport.js");
31
33
  const statefulRequest_js_1 = require("./statefulRequest.js");
32
34
  /** The cookie that names a stateful ABAP context. */
33
35
  const CONTEXT_COOKIE = 'sap-contextid';
@@ -72,6 +74,35 @@ function absentEndpoint(error) {
72
74
  ?.response?.status;
73
75
  return status === 404 || status === 501;
74
76
  }
77
+ const MATERIAL_FIELDS = ['cert', 'key', 'pfx', 'passphrase'];
78
+ /**
79
+ * The material fields a provider offered, and nothing else: a key outside
80
+ * them (`ca`, `rejectUnauthorized`) belongs to `agentOptions`, and a field
81
+ * offered as `undefined` was not offered.
82
+ */
83
+ function materialOf(offered) {
84
+ const taken = {};
85
+ for (const field of MATERIAL_FIELDS) {
86
+ const value = offered[field];
87
+ if (value !== undefined)
88
+ Object.assign(taken, { [field]: value });
89
+ }
90
+ return taken;
91
+ }
92
+ /** Material is the same when every field holds the same value, buffers by bytes. */
93
+ function sameMaterial(a, b) {
94
+ if (!a)
95
+ return Object.keys(b).length === 0;
96
+ return MATERIAL_FIELDS.every((field) => {
97
+ const left = a[field];
98
+ const right = b[field];
99
+ if (left === right)
100
+ return true;
101
+ if (left === undefined || right === undefined)
102
+ return false;
103
+ return Buffer.from(left).equals(Buffer.from(right));
104
+ });
105
+ }
75
106
  class HttpTransport {
76
107
  agentOptions;
77
108
  logger;
@@ -88,6 +119,11 @@ class HttpTransport {
88
119
  */
89
120
  kind = 'http';
90
121
  instance = null;
122
+ /**
123
+ * The TLS material the last logon offered. The client is built from it, and
124
+ * a logon offering different material drops the client — never the jar.
125
+ */
126
+ material = null;
91
127
  /**
92
128
  * The wire's own state.
93
129
  *
@@ -245,8 +281,9 @@ class HttpTransport {
245
281
  break;
246
282
  for (let attempt = 0; attempt <= retries; attempt++) {
247
283
  try {
248
- // Read per attempt: a provider may renew behind the call.
249
- const auth = await context.authHeaders();
284
+ // Authorized per attempt: a provider may renew behind the call.
285
+ const auth = {};
286
+ await context.authorize(auth);
250
287
  const response = await this.send({
251
288
  method: 'GET',
252
289
  url,
@@ -261,7 +298,9 @@ class HttpTransport {
261
298
  });
262
299
  // Handed up BEFORE the token is read: the cookies are the session,
263
300
  // and a fold that only happened on success would lose the session a
264
- // tokenless answer still opened.
301
+ // tokenless answer still opened. And before the fold: an answer the
302
+ // connection refuses as a gone session's throws here, and nothing
303
+ // of it reaches the jar.
265
304
  context.observe(response.headers);
266
305
  this.ingest(response.headers);
267
306
  const token = response.headers['x-csrf-token'];
@@ -274,15 +313,28 @@ class HttpTransport {
274
313
  }
275
314
  catch (error) {
276
315
  // Not a failed exchange: see `isFatal`. Leaves immediately, past the
277
- // retries and past the fallback endpoint.
278
- if (context.isFatal?.(error))
316
+ // retries and past the fallback endpoint. So does the provider's
317
+ // refusal to authorize: it is its word, and asking again only asks
318
+ // it again.
319
+ if (error instanceof authErrors_js_1.AuthRefusedError || context.isFatal?.(error)) {
279
320
  throw error;
321
+ }
280
322
  last = error instanceof Error ? error : new Error(String(error));
281
323
  const response = error.response;
282
324
  if (response?.headers) {
283
- // A refusal can still carry the cookies that matter.
325
+ // A refusal can still carry the cookies that matter — handed up
326
+ // first, so one the connection refuses is not folded in.
284
327
  context.observe(response.headers);
285
328
  this.ingest(response.headers);
329
+ }
330
+ // A refused logon, named as one — after its cookies are in, and
331
+ // without a retry: asking again with the credential just refused
332
+ // tells the system nothing new. What to do about it is not the
333
+ // wire's to decide.
334
+ if ((0, IAdtTransport_js_1.refusalOf)(error)?.status === 401) {
335
+ throw new authErrors_js_1.WireLogonError(error, 401);
336
+ }
337
+ if (response?.headers) {
286
338
  // …and the token itself. SAP answers 405 to a GET on some
287
339
  // endpoints and puts the token in the header anyway, and other
288
340
  // refusals carry one too. A retry would throw away a token the
@@ -394,6 +446,30 @@ class HttpTransport {
394
446
  : this.options.baseUrl;
395
447
  return `${base}${url}`;
396
448
  }
449
+ /**
450
+ * What this wire says to a provider at a logon.
451
+ *
452
+ * TLS material is taken: the client is built from it, over `agentOptions`,
453
+ * and material that differs by value from the last logon's drops the client
454
+ * so the next request builds a new agent. Logon parameters belong to the RFC
455
+ * wire; a provider that needs them is told so and decides what that means.
456
+ */
457
+ logonTarget() {
458
+ return {
459
+ tlsMaterial: (offered) => {
460
+ const material = materialOf(offered);
461
+ if (!sameMaterial(this.material, material)) {
462
+ this.instance = null;
463
+ }
464
+ this.material = material;
465
+ return { ok: true };
466
+ },
467
+ logonParameters: () => ({
468
+ ok: false,
469
+ refusal: { reason: 'this wire takes no logon parameters (HTTP)' },
470
+ }),
471
+ };
472
+ }
397
473
  client() {
398
474
  if (!this.instance) {
399
475
  // Kept as it was: an explicit opt-IN, so a misread env var cannot quietly
@@ -406,19 +482,23 @@ class HttpTransport {
406
482
  httpsAgent: new node_https_1.Agent({
407
483
  rejectUnauthorized,
408
484
  ...this.agentOptions(),
485
+ ...this.material,
409
486
  }),
410
487
  });
411
488
  }
412
489
  return this.instance;
413
490
  }
414
491
  /**
415
- * Nothing to ask for: an HTTP session arrives with the establishing call.
492
+ * The logon, and nothing else to ask for: an HTTP session arrives with the
493
+ * establishing call.
416
494
  *
417
- * Empty rather than absent. "There is no session resource here" is a fact
418
- * about this wire, and a fact is stated, not left for a caller to discover by
419
- * checking whether the method exists.
495
+ * The credential is offered the logon here, before any request — a cloud
496
+ * preflight included. "There is no session resource here" is a fact about
497
+ * this wire, and a fact is stated, not left for a caller to discover.
420
498
  */
421
- async open(_context) { }
499
+ async open(context) {
500
+ await context.logon(this.logonTarget());
501
+ }
422
502
  /**
423
503
  * Nothing to give back at this level.
424
504
  *
@@ -13,6 +13,7 @@
13
13
  * watching it fail — the same rule `SessionStrategy` states for session
14
14
  * mechanics.
15
15
  */
16
+ import type { ILogonTarget } from '@mcp-abap-adt/interfaces-auth';
16
17
  /** One request, in the terms every transport can honour. */
17
18
  export interface IAdtTransportRequest {
18
19
  method: string;
@@ -74,8 +75,20 @@ export interface IAdtTransportResponse {
74
75
  export interface IAdtSessionContext {
75
76
  /** The server, for a wire that addresses one. */
76
77
  baseUrl: string;
77
- /** Read once per request: a provider may renew behind the call. */
78
- authHeaders: () => Promise<Record<string, string>>;
78
+ /**
79
+ * Fill the credential into a request the wire itself originates — the CSRF
80
+ * fetch, the cloud preflight, the logoff. Asked per request, never held: a
81
+ * provider may renew behind the call. Throws `AuthRefusedError` when the
82
+ * credential will not authorize it; the request is then not sent.
83
+ */
84
+ authorize(headers: Record<string, string>): Promise<void>;
85
+ /**
86
+ * Called by the wire at each of its logons, before any request: the
87
+ * credential says what it brings — TLS material, logon parameters — and the
88
+ * target says whether the wire took it. Throws `AuthRefusedError` when the
89
+ * credential refuses the logon.
90
+ */
91
+ logon(target: ILogonTarget): Promise<void>;
79
92
  /** Anything the conversation carries — the ADT connection id, today. */
80
93
  extraHeaders?: Record<string, string>;
81
94
  /** Where to hand each answer, so the connection sees what the wire saw. */
@@ -86,6 +99,10 @@ export interface IAdtEstablishContext extends IAdtSessionContext {
86
99
  * Where to hand each answer. The wire folds a response into its own state;
87
100
  * whether a new session id is an establishment or a replacement is a question
88
101
  * about the session's lifetime, which is decided above.
102
+ *
103
+ * Handed up BEFORE the wire folds the answer in. It may throw a session
104
+ * verdict — the answer belongs to a session that is gone — and the wire then
105
+ * folds nothing of it and ends the exchange (`isFatal`).
89
106
  */
90
107
  observe: (headers: unknown) => void;
91
108
  /** How many times to ask again. Absent means the transport's own default. */
@@ -1 +1 @@
1
- {"version":3,"file":"IAdtTransport.d.ts","sourceRoot":"","sources":["../../src/connection/IAdtTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IAC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AK9B;;;;;;;OAOG;IAEY,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAuCjE"}
1
+ {"version":3,"file":"OnPremHttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/OnPremHttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAI5B,qBAAa,mBACX,SAAQ,aACR,YAAW,gBAAgB;IAE3B,SAAkB,IAAI,EAAE,MAAM,CAAiB;IAE/C,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAG,QAAQ,CAAU;IAEpC;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW,CAAS;IAEb,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7D,aAAa,IAAI,IAAI;IAK9B;;;;;;;OAOG;IAEY,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAwCjE"}
@@ -68,9 +68,10 @@ class OnPremHttpTransport extends HttpTransport_js_1.HttpTransport {
68
68
  return;
69
69
  }
70
70
  try {
71
- // Read once: a provider may answer differently on a second call, and one
72
- // request must be built from one credential.
73
- const auth = await context.authHeaders();
71
+ // Authorized once: a provider may answer differently on a second call,
72
+ // and one request must be built from one credential.
73
+ const auth = {};
74
+ await context.authorize(auth);
74
75
  await this.sendDetached({
75
76
  method: 'GET',
76
77
  url: `${context.baseUrl}${ICF_LOGOFF_PATH}`,