@mcp-abap-adt/auth-broker 3.0.4 → 4.0.0
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 +448 -1
- package/README.md +723 -533
- package/dist/AuthBroker.d.ts +178 -29
- package/dist/AuthBroker.d.ts.map +1 -1
- package/dist/AuthBroker.js +494 -101
- package/dist/DestinationConfigError.d.ts +27 -0
- package/dist/DestinationConfigError.d.ts.map +1 -0
- package/dist/DestinationConfigError.js +36 -0
- package/dist/SessionWriter.d.ts +54 -0
- package/dist/SessionWriter.d.ts.map +1 -0
- package/dist/SessionWriter.js +135 -0
- package/dist/binding.d.ts +95 -0
- package/dist/binding.d.ts.map +1 -0
- package/dist/binding.js +207 -0
- package/dist/bindingOf.d.ts +36 -0
- package/dist/bindingOf.d.ts.map +1 -0
- package/dist/bindingOf.js +53 -0
- package/dist/destinations.d.ts +139 -0
- package/dist/destinations.d.ts.map +1 -0
- package/dist/destinations.js +429 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/providers/ITokenProvider.d.ts +2 -1
- package/dist/providers/ITokenProvider.d.ts.map +1 -1
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.js +2 -2
- package/dist/stores/index.d.ts +2 -2
- package/dist/stores/index.js +2 -2
- package/dist/stores/interfaces.d.ts +4 -3
- package/dist/stores/interfaces.d.ts.map +1 -1
- package/dist/stores/interfaces.js +2 -2
- package/dist/types.d.ts +5 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -1
- package/package.json +25 -45
- package/CONTRIBUTORS.md +0 -33
- package/dist/__tests__/helpers/configHelpers.d.ts +0 -59
- package/dist/__tests__/helpers/configHelpers.d.ts.map +0 -1
- package/dist/__tests__/helpers/configHelpers.js +0 -206
- package/dist/__tests__/helpers/netHelpers.d.ts +0 -3
- package/dist/__tests__/helpers/netHelpers.d.ts.map +0 -1
- package/dist/__tests__/helpers/netHelpers.js +0 -63
- package/dist/__tests__/helpers/testLogger.d.ts +0 -7
- package/dist/__tests__/helpers/testLogger.d.ts.map +0 -1
- package/dist/__tests__/helpers/testLogger.js +0 -54
- package/dist/bin/mcp-auth.js +0 -752
- package/dist/bin/mcp-sso.js +0 -825
- package/dist/bin/mcpSsoConfig.js +0 -566
- package/dist/bin/samlMetadata.js +0 -175
- package/dist/bin/workDir.js +0 -79
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a destination states, and the provider it states.
|
|
3
|
+
*
|
|
4
|
+
* Two fields choose the provider — `authType` and, for `jwt` and `saml`,
|
|
5
|
+
* `grantType` — and nothing else: no field's presence or absence is ever
|
|
6
|
+
* read to pick a row. Both come from the key store's means.
|
|
7
|
+
*/
|
|
8
|
+
import { type IDeviceCodePresenter, type OidcCallbackResult } from '@mcp-abap-adt/auth-providers';
|
|
9
|
+
import type { IAssertionReplayStore, IAuthorizationStrategy, IAuthProvider, ITokenResult } from '@mcp-abap-adt/interfaces-auth';
|
|
10
|
+
import type { DestinationGrant, IConfig, IConnectionConfig } from '@mcp-abap-adt/interfaces-auth-broker';
|
|
11
|
+
import type { IAuthorizationConfig } from '@mcp-abap-adt/interfaces-auth-sap';
|
|
12
|
+
import type { ILogger } from '@mcp-abap-adt/interfaces-utils';
|
|
13
|
+
import { type Binding } from './binding';
|
|
14
|
+
type StatedAuthType = NonNullable<IConnectionConfig['authType']>;
|
|
15
|
+
/** The stated `authType`, or the error naming it. */
|
|
16
|
+
export declare function statedAuthType(destination: string, means: IConnectionConfig | null): StatedAuthType;
|
|
17
|
+
/** The stated grant of a `jwt` or `saml` destination, or the error naming it. */
|
|
18
|
+
export declare function statedGrant(destination: string, authType: 'jwt' | 'saml', means: IConnectionConfig): DestinationGrant;
|
|
19
|
+
/** `basic` → `BasicAuthProvider(username, password)`, from the means alone. */
|
|
20
|
+
export declare function basicProvider(destination: string, means: IConnectionConfig): IAuthProvider;
|
|
21
|
+
/**
|
|
22
|
+
* `snc` → the Secure Login Client recipe, from the four SNC fields. Only the
|
|
23
|
+
* partner name is required: the contract says the library is discovered when
|
|
24
|
+
* `sncLib` is absent and the user's name taken from the credential when
|
|
25
|
+
* `sncMyName` is, and the provider documents its own `qop` default.
|
|
26
|
+
*/
|
|
27
|
+
export declare function sncProvider(destination: string, means: IConnectionConfig, logger: ILogger): IAuthProvider;
|
|
28
|
+
/**
|
|
29
|
+
* `none` → the credential handed over, from the session: the only way in, so
|
|
30
|
+
* required. Read from the secret alone — the means are not a seed.
|
|
31
|
+
*
|
|
32
|
+
* The broker did not obtain it and cannot obtain it again, so a binding that
|
|
33
|
+
* does not match is refused, never discarded: `issuedFor`
|
|
34
|
+
* must always equal the destination's resource — it is what stops the
|
|
35
|
+
* credential going to another one; `issuedBy` is compared only when the means
|
|
36
|
+
* state an issuer.
|
|
37
|
+
*/
|
|
38
|
+
export declare function handedOverProvider(destination: string, authType: 'jwt' | 'saml', secret: IConfig | null, binding: Binding): IAuthProvider;
|
|
39
|
+
/** The UAA grants: one client, one token endpoint (`<uaaUrl>/oauth/token`). */
|
|
40
|
+
export type UaaGrant = 'authorization_code' | 'client_credentials' | 'passcode';
|
|
41
|
+
export declare function isUaaGrant(grant: DestinationGrant): grant is UaaGrant;
|
|
42
|
+
/** What a UAA row is built from. */
|
|
43
|
+
export interface UaaRow {
|
|
44
|
+
destination: string;
|
|
45
|
+
grant: UaaGrant;
|
|
46
|
+
/** The client, from the key store's `getAuthorizationConfig`. */
|
|
47
|
+
client: IAuthorizationConfig | null;
|
|
48
|
+
/** The session secret — the seed; `null` when there is no session. */
|
|
49
|
+
secret: IConfig | null;
|
|
50
|
+
/** The consumer's `authorization` option. */
|
|
51
|
+
authorization: ((destination: string, grant: 'authorization_code' | 'passcode') => IAuthorizationStrategy<string>) | undefined;
|
|
52
|
+
logger: ILogger;
|
|
53
|
+
onTokens: (result: ITokenResult) => Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* `jwt` / `authorization_code` → `AuthorizationCodeProvider`,
|
|
57
|
+
* `client_credentials` → `ClientCredentialsProvider`, `passcode` →
|
|
58
|
+
* `UaaPasscodeProvider`: the client from the key store, the seed from the
|
|
59
|
+
* session (not for `client_credentials`, whose row takes the client alone).
|
|
60
|
+
*
|
|
61
|
+
* Every field and option the row lacks is named in one error, before the
|
|
62
|
+
* consumer's `authorization` is called. `serviceUrl` is not among them: the
|
|
63
|
+
* providers read the client and `uaaUrl` only. `uaaClientSecret: ''` is a public
|
|
64
|
+
* client: `passcode` takes it as no secret; the other two rows' providers
|
|
65
|
+
* require a secret, so for them `''` is missing.
|
|
66
|
+
*/
|
|
67
|
+
export declare function uaaProvider(row: UaaRow): IAuthProvider;
|
|
68
|
+
/** The OIDC grants: a client, and an issuer or explicit endpoints. */
|
|
69
|
+
export type OidcGrant = 'oidc_authorization_code' | 'device_code' | 'password' | 'token_exchange';
|
|
70
|
+
export declare function isOidcGrant(grant: DestinationGrant): grant is OidcGrant;
|
|
71
|
+
/** What an OIDC row is built from. */
|
|
72
|
+
export interface OidcRow {
|
|
73
|
+
destination: string;
|
|
74
|
+
grant: OidcGrant;
|
|
75
|
+
means: IConnectionConfig;
|
|
76
|
+
/** The client, from the key store's `getAuthorizationConfig`. */
|
|
77
|
+
client: IAuthorizationConfig | null;
|
|
78
|
+
/** The session secret — the seed; `null` when there is none, or it is not bound here. */
|
|
79
|
+
secret: IConfig | null;
|
|
80
|
+
oidcAuthorization: ((destination: string) => IAuthorizationStrategy<OidcCallbackResult>) | undefined;
|
|
81
|
+
deviceCodePresenter: ((destination: string) => IDeviceCodePresenter) | undefined;
|
|
82
|
+
logger: ILogger;
|
|
83
|
+
onTokens: (result: ITokenResult) => Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* `jwt` / `oidc_authorization_code` → `OidcBrowserProvider`, `device_code` →
|
|
87
|
+
* `OidcDeviceFlowProvider`, `password` → `OidcPasswordProvider`,
|
|
88
|
+
* `token_exchange` → `OidcTokenExchangeProvider`: the client id (and secret,
|
|
89
|
+
* `''` being a public client) from the key store's client, the grant's data
|
|
90
|
+
* from its `oidc*` fields, the seed from the session.
|
|
91
|
+
*
|
|
92
|
+
* The endpoints: `oidcIssuerUrl`, from which the provider discovers them, or
|
|
93
|
+
* every explicit endpoint the row uses — without either the error names the
|
|
94
|
+
* issuer and the endpoints missing. Every field and option the row lacks is
|
|
95
|
+
* named in one error, before any collaborator is called. `token_exchange`
|
|
96
|
+
* takes one scope string: the stored scopes joined by a space.
|
|
97
|
+
*/
|
|
98
|
+
export declare function oidcProvider(row: OidcRow): IAuthProvider;
|
|
99
|
+
/** The SAML grants: an identity provider's assertion, validated first. */
|
|
100
|
+
export type SamlGrant = 'saml2_pure' | 'saml2_bearer';
|
|
101
|
+
export declare function isSamlGrant(grant: DestinationGrant): grant is SamlGrant;
|
|
102
|
+
/** What a SAML row is built from. */
|
|
103
|
+
export interface SamlRow {
|
|
104
|
+
destination: string;
|
|
105
|
+
grant: SamlGrant;
|
|
106
|
+
means: IConnectionConfig;
|
|
107
|
+
/** `saml2_bearer`'s client, from the key store; `null` for `saml2_pure`. */
|
|
108
|
+
client: IAuthorizationConfig | null;
|
|
109
|
+
/** The session secret — the seed; `null` when there is none, or it is not bound here. */
|
|
110
|
+
secret: IConfig | null;
|
|
111
|
+
authorization: ((destination: string, grant: SamlGrant) => IAuthorizationStrategy<string>) | undefined;
|
|
112
|
+
samlCookies: ((destination: string) => (samlResponse: string) => Promise<string>) | undefined;
|
|
113
|
+
assertionReplayStore: ((destination: string) => IAssertionReplayStore) | undefined;
|
|
114
|
+
logger: ILogger;
|
|
115
|
+
onTokens: (result: ITokenResult) => Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* `saml` / `saml2_pure` → `Saml2PureProvider`, `saml2_bearer` →
|
|
119
|
+
* `Saml2BearerProvider`, each validating the assertion before anything uses
|
|
120
|
+
* it, with the validator the broker composes from the destination's trust and
|
|
121
|
+
* the consumer's replay store: `createSignedResponseValidator` for
|
|
122
|
+
* `saml2_pure` — the Response signed, as the cookies' system receives it whole
|
|
123
|
+
* — and `createSignedAssertionValidator` for `saml2_bearer`, whose token
|
|
124
|
+
* endpoint gets the Assertion alone (auth-providers' own pairing). The
|
|
125
|
+
* expected issuer is `samlIdpEntityId`.
|
|
126
|
+
*
|
|
127
|
+
* `saml2_pure` is seeded with the stored cookies and `expiresAt`;
|
|
128
|
+
* `saml2_bearer` with the stored token, its refresh token and expiry, and
|
|
129
|
+
* takes the client (`uaaUrl`, `uaaClientId`; `uaaClientSecret` `''` a public
|
|
130
|
+
* client) and `samlTokenUrl` when stated.
|
|
131
|
+
*
|
|
132
|
+
* Every field and option the row lacks is named in one error, before any
|
|
133
|
+
* collaborator is called; so is a `samlClockSkewMs` that is not a whole number
|
|
134
|
+
* of milliseconds, and a certificate the validator cannot read — by name, never
|
|
135
|
+
* the value.
|
|
136
|
+
*/
|
|
137
|
+
export declare function samlProvider(row: SamlRow): IAuthProvider;
|
|
138
|
+
export {};
|
|
139
|
+
//# sourceMappingURL=destinations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destinations.d.ts","sourceRoot":"","sources":["../src/destinations.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What a destination states, and the provider it states.
|
|
4
|
+
*
|
|
5
|
+
* Two fields choose the provider — `authType` and, for `jwt` and `saml`,
|
|
6
|
+
* `grantType` — and nothing else: no field's presence or absence is ever
|
|
7
|
+
* read to pick a row. Both come from the key store's means.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.statedAuthType = statedAuthType;
|
|
11
|
+
exports.statedGrant = statedGrant;
|
|
12
|
+
exports.basicProvider = basicProvider;
|
|
13
|
+
exports.sncProvider = sncProvider;
|
|
14
|
+
exports.handedOverProvider = handedOverProvider;
|
|
15
|
+
exports.isUaaGrant = isUaaGrant;
|
|
16
|
+
exports.uaaProvider = uaaProvider;
|
|
17
|
+
exports.isOidcGrant = isOidcGrant;
|
|
18
|
+
exports.oidcProvider = oidcProvider;
|
|
19
|
+
exports.isSamlGrant = isSamlGrant;
|
|
20
|
+
exports.samlProvider = samlProvider;
|
|
21
|
+
const auth_providers_1 = require("@mcp-abap-adt/auth-providers");
|
|
22
|
+
const binding_1 = require("./binding");
|
|
23
|
+
const DestinationConfigError_1 = require("./DestinationConfigError");
|
|
24
|
+
/** The allowed `authType` / `grantType` pairs. `basic` and `snc` read no grant. */
|
|
25
|
+
const GRANTS = {
|
|
26
|
+
jwt: [
|
|
27
|
+
'authorization_code',
|
|
28
|
+
'client_credentials',
|
|
29
|
+
'passcode',
|
|
30
|
+
'oidc_authorization_code',
|
|
31
|
+
'device_code',
|
|
32
|
+
'password',
|
|
33
|
+
'token_exchange',
|
|
34
|
+
'none',
|
|
35
|
+
],
|
|
36
|
+
saml: ['saml2_pure', 'saml2_bearer', 'none'],
|
|
37
|
+
};
|
|
38
|
+
const AUTH_TYPES = ['basic', 'jwt', 'saml', 'snc'];
|
|
39
|
+
/** A stored string that counts as present: `''` is missing. */
|
|
40
|
+
function present(value) {
|
|
41
|
+
return typeof value === 'string' && value !== '';
|
|
42
|
+
}
|
|
43
|
+
/** The stated `authType`, or the error naming it. */
|
|
44
|
+
function statedAuthType(destination, means) {
|
|
45
|
+
const authType = means?.authType;
|
|
46
|
+
if (!present(authType)) {
|
|
47
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, ['authType'], means
|
|
48
|
+
? 'the key store states no authType'
|
|
49
|
+
: 'the key store has no means for this destination');
|
|
50
|
+
}
|
|
51
|
+
if (!AUTH_TYPES.includes(authType)) {
|
|
52
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, ['authType'], `authType is not one of ${AUTH_TYPES.join(', ')}`);
|
|
53
|
+
}
|
|
54
|
+
return authType;
|
|
55
|
+
}
|
|
56
|
+
/** The stated grant of a `jwt` or `saml` destination, or the error naming it. */
|
|
57
|
+
function statedGrant(destination, authType, means) {
|
|
58
|
+
const grantType = means.grantType;
|
|
59
|
+
if (!present(grantType)) {
|
|
60
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, ['grantType'], `a ${authType} destination must state its grantType`);
|
|
61
|
+
}
|
|
62
|
+
if (!GRANTS[authType].includes(grantType)) {
|
|
63
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, ['grantType'], `grantType is not one a ${authType} destination allows (${GRANTS[authType].join(', ')})`);
|
|
64
|
+
}
|
|
65
|
+
return grantType;
|
|
66
|
+
}
|
|
67
|
+
/** The names of the fields among `names` that `source` lacks or holds as `''`. */
|
|
68
|
+
function missing(source, names) {
|
|
69
|
+
return names.filter((name) => !present(source?.[name]));
|
|
70
|
+
}
|
|
71
|
+
/** `basic` → `BasicAuthProvider(username, password)`, from the means alone. */
|
|
72
|
+
function basicProvider(destination, means) {
|
|
73
|
+
const lacking = missing(means, ['username', 'password']);
|
|
74
|
+
if (lacking.length > 0) {
|
|
75
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, lacking, 'a basic destination needs a user and a password');
|
|
76
|
+
}
|
|
77
|
+
return new auth_providers_1.BasicAuthProvider(means.username, means.password);
|
|
78
|
+
}
|
|
79
|
+
/** The provider's own config names, mapped to the store fields they come from. */
|
|
80
|
+
const SNC_FIELDS = {
|
|
81
|
+
partnerName: 'sncPartnerName',
|
|
82
|
+
qop: 'sncQop',
|
|
83
|
+
myName: 'sncMyName',
|
|
84
|
+
sncLib: 'sncLib',
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* `snc` → the Secure Login Client recipe, from the four SNC fields. Only the
|
|
88
|
+
* partner name is required: the contract says the library is discovered when
|
|
89
|
+
* `sncLib` is absent and the user's name taken from the credential when
|
|
90
|
+
* `sncMyName` is, and the provider documents its own `qop` default.
|
|
91
|
+
*/
|
|
92
|
+
function sncProvider(destination, means, logger) {
|
|
93
|
+
if (!present(means.sncPartnerName)) {
|
|
94
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, ['sncPartnerName'], 'an snc destination needs the system’s SNC name');
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
return auth_providers_1.SncLogonProvider.forSecureLoginClient({
|
|
98
|
+
partnerName: means.sncPartnerName,
|
|
99
|
+
qop: present(means.sncQop) ? means.sncQop : undefined,
|
|
100
|
+
sncLib: present(means.sncLib) ? means.sncLib : undefined,
|
|
101
|
+
myName: present(means.sncMyName) ? means.sncMyName : undefined,
|
|
102
|
+
logger,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (error instanceof auth_providers_1.ValidationError) {
|
|
107
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, (error.missingFields ?? []).map((field) => SNC_FIELDS[field] ?? field), 'the SNC provider refused the destination’s SNC settings');
|
|
108
|
+
}
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* `none` → the credential handed over, from the session: the only way in, so
|
|
114
|
+
* required. Read from the secret alone — the means are not a seed.
|
|
115
|
+
*
|
|
116
|
+
* The broker did not obtain it and cannot obtain it again, so a binding that
|
|
117
|
+
* does not match is refused, never discarded: `issuedFor`
|
|
118
|
+
* must always equal the destination's resource — it is what stops the
|
|
119
|
+
* credential going to another one; `issuedBy` is compared only when the means
|
|
120
|
+
* state an issuer.
|
|
121
|
+
*/
|
|
122
|
+
function handedOverProvider(destination, authType, secret, binding) {
|
|
123
|
+
const credential = authType === 'jwt' ? secret?.authorizationToken : secret?.sessionCookies;
|
|
124
|
+
if (!present(credential)) {
|
|
125
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, [authType === 'jwt' ? 'authorizationToken' : 'sessionCookies'], authType === 'jwt'
|
|
126
|
+
? 'a jwt destination with grantType none needs the token in its session'
|
|
127
|
+
: 'a saml destination with grantType none needs the cookies in its session');
|
|
128
|
+
}
|
|
129
|
+
const unbound = [];
|
|
130
|
+
if (!(0, binding_1.sameResource)(secret, binding))
|
|
131
|
+
unbound.push('issuedFor');
|
|
132
|
+
if (binding.issuerStated && !(0, binding_1.sameIssuer)(secret, binding)) {
|
|
133
|
+
unbound.push('issuedBy');
|
|
134
|
+
}
|
|
135
|
+
if (unbound.length > 0) {
|
|
136
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, unbound, 'the credential in the session is not bound to this destination’s means');
|
|
137
|
+
}
|
|
138
|
+
return authType === 'jwt'
|
|
139
|
+
? auth_providers_1.TokenAuthProvider.fixed(credential)
|
|
140
|
+
: new auth_providers_1.SamlAuthProvider(credential);
|
|
141
|
+
}
|
|
142
|
+
function isUaaGrant(grant) {
|
|
143
|
+
return (grant === 'authorization_code' ||
|
|
144
|
+
grant === 'client_credentials' ||
|
|
145
|
+
grant === 'passcode');
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* `jwt` / `authorization_code` → `AuthorizationCodeProvider`,
|
|
149
|
+
* `client_credentials` → `ClientCredentialsProvider`, `passcode` →
|
|
150
|
+
* `UaaPasscodeProvider`: the client from the key store, the seed from the
|
|
151
|
+
* session (not for `client_credentials`, whose row takes the client alone).
|
|
152
|
+
*
|
|
153
|
+
* Every field and option the row lacks is named in one error, before the
|
|
154
|
+
* consumer's `authorization` is called. `serviceUrl` is not among them: the
|
|
155
|
+
* providers read the client and `uaaUrl` only. `uaaClientSecret: ''` is a public
|
|
156
|
+
* client: `passcode` takes it as no secret; the other two rows' providers
|
|
157
|
+
* require a secret, so for them `''` is missing.
|
|
158
|
+
*/
|
|
159
|
+
function uaaProvider(row) {
|
|
160
|
+
const { destination, grant, client, secret } = row;
|
|
161
|
+
const lacking = [];
|
|
162
|
+
if (!present(client?.uaaUrl))
|
|
163
|
+
lacking.push('uaaUrl');
|
|
164
|
+
if (!present(client?.uaaClientId))
|
|
165
|
+
lacking.push('uaaClientId');
|
|
166
|
+
if (grant !== 'passcode' && !present(client?.uaaClientSecret)) {
|
|
167
|
+
lacking.push('uaaClientSecret');
|
|
168
|
+
}
|
|
169
|
+
if (grant !== 'client_credentials' && !row.authorization) {
|
|
170
|
+
lacking.push('authorization');
|
|
171
|
+
}
|
|
172
|
+
if (lacking.length > 0) {
|
|
173
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, lacking, `a jwt destination with grantType ${grant} lacks what its grant needs`);
|
|
174
|
+
}
|
|
175
|
+
const uaaUrl = client?.uaaUrl;
|
|
176
|
+
const clientId = client?.uaaClientId;
|
|
177
|
+
const clientSecret = present(client?.uaaClientSecret)
|
|
178
|
+
? client.uaaClientSecret
|
|
179
|
+
: undefined;
|
|
180
|
+
const hooks = { onTokens: row.onTokens };
|
|
181
|
+
if (grant === 'client_credentials') {
|
|
182
|
+
return new auth_providers_1.ClientCredentialsProvider({
|
|
183
|
+
uaaUrl,
|
|
184
|
+
clientId,
|
|
185
|
+
clientSecret: clientSecret,
|
|
186
|
+
logger: row.logger,
|
|
187
|
+
...hooks,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
const seed = tokenSeed(secret);
|
|
191
|
+
// Checked above: the rows that reach here need it.
|
|
192
|
+
const authorization = row.authorization(destination, grant);
|
|
193
|
+
if (grant === 'authorization_code') {
|
|
194
|
+
return new auth_providers_1.AuthorizationCodeProvider({
|
|
195
|
+
uaaUrl,
|
|
196
|
+
clientId,
|
|
197
|
+
clientSecret: clientSecret,
|
|
198
|
+
authorization,
|
|
199
|
+
...seed,
|
|
200
|
+
logger: row.logger,
|
|
201
|
+
...hooks,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return new auth_providers_1.UaaPasscodeProvider({
|
|
205
|
+
uaaUrl,
|
|
206
|
+
clientId,
|
|
207
|
+
clientSecret,
|
|
208
|
+
authorization,
|
|
209
|
+
...seed,
|
|
210
|
+
logger: row.logger,
|
|
211
|
+
...hooks,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/** The seed of a token provider: the stored token, its refresh token and expiry. */
|
|
215
|
+
function tokenSeed(secret) {
|
|
216
|
+
return {
|
|
217
|
+
accessToken: present(secret?.authorizationToken)
|
|
218
|
+
? secret.authorizationToken
|
|
219
|
+
: undefined,
|
|
220
|
+
refreshToken: present(secret?.refreshToken)
|
|
221
|
+
? secret.refreshToken
|
|
222
|
+
: undefined,
|
|
223
|
+
expiresAt: typeof secret?.expiresAt === 'number' ? secret.expiresAt : undefined,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/** A stored string, or `undefined` for one absent or `''`. */
|
|
227
|
+
function stated(value) {
|
|
228
|
+
return present(value) ? value : undefined;
|
|
229
|
+
}
|
|
230
|
+
function isOidcGrant(grant) {
|
|
231
|
+
return (grant === 'oidc_authorization_code' ||
|
|
232
|
+
grant === 'device_code' ||
|
|
233
|
+
grant === 'password' ||
|
|
234
|
+
grant === 'token_exchange');
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* The endpoints each OIDC row reads when the means state no issuer to
|
|
238
|
+
* discover them from — the ones its provider asks discovery for otherwise.
|
|
239
|
+
*/
|
|
240
|
+
const OIDC_ENDPOINTS = {
|
|
241
|
+
oidc_authorization_code: ['oidcAuthorizationEndpoint', 'oidcTokenEndpoint'],
|
|
242
|
+
device_code: ['oidcDeviceAuthorizationEndpoint', 'oidcTokenEndpoint'],
|
|
243
|
+
password: ['oidcTokenEndpoint'],
|
|
244
|
+
token_exchange: ['oidcTokenEndpoint'],
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* `jwt` / `oidc_authorization_code` → `OidcBrowserProvider`, `device_code` →
|
|
248
|
+
* `OidcDeviceFlowProvider`, `password` → `OidcPasswordProvider`,
|
|
249
|
+
* `token_exchange` → `OidcTokenExchangeProvider`: the client id (and secret,
|
|
250
|
+
* `''` being a public client) from the key store's client, the grant's data
|
|
251
|
+
* from its `oidc*` fields, the seed from the session.
|
|
252
|
+
*
|
|
253
|
+
* The endpoints: `oidcIssuerUrl`, from which the provider discovers them, or
|
|
254
|
+
* every explicit endpoint the row uses — without either the error names the
|
|
255
|
+
* issuer and the endpoints missing. Every field and option the row lacks is
|
|
256
|
+
* named in one error, before any collaborator is called. `token_exchange`
|
|
257
|
+
* takes one scope string: the stored scopes joined by a space.
|
|
258
|
+
*/
|
|
259
|
+
function oidcProvider(row) {
|
|
260
|
+
const { destination, grant, means, client } = row;
|
|
261
|
+
const lacking = [];
|
|
262
|
+
if (!present(client?.uaaClientId))
|
|
263
|
+
lacking.push('uaaClientId');
|
|
264
|
+
if (!present(means.oidcIssuerUrl)) {
|
|
265
|
+
const endpoints = OIDC_ENDPOINTS[grant].filter((name) => !present(means[name]));
|
|
266
|
+
if (endpoints.length > 0)
|
|
267
|
+
lacking.push('oidcIssuerUrl', ...endpoints);
|
|
268
|
+
}
|
|
269
|
+
if (grant === 'password') {
|
|
270
|
+
lacking.push(...missing(means, ['username', 'password']));
|
|
271
|
+
}
|
|
272
|
+
if (grant === 'token_exchange') {
|
|
273
|
+
lacking.push(...missing(means, ['oidcSubjectToken', 'oidcSubjectTokenType']));
|
|
274
|
+
}
|
|
275
|
+
if (grant === 'oidc_authorization_code' && !row.oidcAuthorization) {
|
|
276
|
+
lacking.push('oidcAuthorization');
|
|
277
|
+
}
|
|
278
|
+
if (grant === 'device_code' && !row.deviceCodePresenter) {
|
|
279
|
+
lacking.push('deviceCodePresenter');
|
|
280
|
+
}
|
|
281
|
+
if (lacking.length > 0) {
|
|
282
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, lacking, `a jwt destination with grantType ${grant} lacks what its grant needs`);
|
|
283
|
+
}
|
|
284
|
+
const scopes = Array.isArray(means.oidcScopes) && means.oidcScopes.length > 0
|
|
285
|
+
? means.oidcScopes
|
|
286
|
+
: undefined;
|
|
287
|
+
const common = {
|
|
288
|
+
issuerUrl: stated(means.oidcIssuerUrl),
|
|
289
|
+
clientId: client?.uaaClientId,
|
|
290
|
+
clientSecret: stated(client?.uaaClientSecret),
|
|
291
|
+
tokenEndpoint: stated(means.oidcTokenEndpoint),
|
|
292
|
+
...tokenSeed(row.secret),
|
|
293
|
+
logger: row.logger,
|
|
294
|
+
onTokens: row.onTokens,
|
|
295
|
+
};
|
|
296
|
+
switch (grant) {
|
|
297
|
+
case 'oidc_authorization_code':
|
|
298
|
+
return new auth_providers_1.OidcBrowserProvider({
|
|
299
|
+
...common,
|
|
300
|
+
scopes,
|
|
301
|
+
authorizationEndpoint: stated(means.oidcAuthorizationEndpoint),
|
|
302
|
+
// Checked above.
|
|
303
|
+
authorization: row.oidcAuthorization(destination),
|
|
304
|
+
});
|
|
305
|
+
case 'device_code':
|
|
306
|
+
return new auth_providers_1.OidcDeviceFlowProvider({
|
|
307
|
+
...common,
|
|
308
|
+
scopes,
|
|
309
|
+
deviceAuthorizationEndpoint: stated(means.oidcDeviceAuthorizationEndpoint),
|
|
310
|
+
presenter: row.deviceCodePresenter(destination),
|
|
311
|
+
});
|
|
312
|
+
case 'password':
|
|
313
|
+
return new auth_providers_1.OidcPasswordProvider({
|
|
314
|
+
...common,
|
|
315
|
+
scopes,
|
|
316
|
+
username: means.username,
|
|
317
|
+
password: means.password,
|
|
318
|
+
});
|
|
319
|
+
case 'token_exchange':
|
|
320
|
+
return new auth_providers_1.OidcTokenExchangeProvider({
|
|
321
|
+
...common,
|
|
322
|
+
scope: scopes?.join(' '),
|
|
323
|
+
subjectToken: means.oidcSubjectToken,
|
|
324
|
+
subjectTokenType: means.oidcSubjectTokenType,
|
|
325
|
+
audience: stated(means.oidcAudience),
|
|
326
|
+
actorToken: stated(means.oidcActorToken),
|
|
327
|
+
actorTokenType: stated(means.oidcActorTokenType),
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function isSamlGrant(grant) {
|
|
332
|
+
return grant === 'saml2_pure' || grant === 'saml2_bearer';
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* `saml` / `saml2_pure` → `Saml2PureProvider`, `saml2_bearer` →
|
|
336
|
+
* `Saml2BearerProvider`, each validating the assertion before anything uses
|
|
337
|
+
* it, with the validator the broker composes from the destination's trust and
|
|
338
|
+
* the consumer's replay store: `createSignedResponseValidator` for
|
|
339
|
+
* `saml2_pure` — the Response signed, as the cookies' system receives it whole
|
|
340
|
+
* — and `createSignedAssertionValidator` for `saml2_bearer`, whose token
|
|
341
|
+
* endpoint gets the Assertion alone (auth-providers' own pairing). The
|
|
342
|
+
* expected issuer is `samlIdpEntityId`.
|
|
343
|
+
*
|
|
344
|
+
* `saml2_pure` is seeded with the stored cookies and `expiresAt`;
|
|
345
|
+
* `saml2_bearer` with the stored token, its refresh token and expiry, and
|
|
346
|
+
* takes the client (`uaaUrl`, `uaaClientId`; `uaaClientSecret` `''` a public
|
|
347
|
+
* client) and `samlTokenUrl` when stated.
|
|
348
|
+
*
|
|
349
|
+
* Every field and option the row lacks is named in one error, before any
|
|
350
|
+
* collaborator is called; so is a `samlClockSkewMs` that is not a whole number
|
|
351
|
+
* of milliseconds, and a certificate the validator cannot read — by name, never
|
|
352
|
+
* the value.
|
|
353
|
+
*/
|
|
354
|
+
function samlProvider(row) {
|
|
355
|
+
const { destination, grant, means, client } = row;
|
|
356
|
+
const lacking = missing(means, [
|
|
357
|
+
'samlIdpSsoUrl',
|
|
358
|
+
'samlSpEntityId',
|
|
359
|
+
'samlIdpEntityId',
|
|
360
|
+
]);
|
|
361
|
+
const certificates = means.samlIdpCertificates;
|
|
362
|
+
if (!Array.isArray(certificates) ||
|
|
363
|
+
certificates.length === 0 ||
|
|
364
|
+
!certificates.every(present)) {
|
|
365
|
+
lacking.push('samlIdpCertificates');
|
|
366
|
+
}
|
|
367
|
+
if (grant === 'saml2_bearer') {
|
|
368
|
+
lacking.push(...missing(client, ['uaaUrl', 'uaaClientId']));
|
|
369
|
+
}
|
|
370
|
+
if (!row.authorization)
|
|
371
|
+
lacking.push('authorization');
|
|
372
|
+
if (grant === 'saml2_pure' && !row.samlCookies)
|
|
373
|
+
lacking.push('samlCookies');
|
|
374
|
+
if (!row.assertionReplayStore)
|
|
375
|
+
lacking.push('assertionReplayStore');
|
|
376
|
+
if (lacking.length > 0) {
|
|
377
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, lacking, `a saml destination with grantType ${grant} lacks what its grant needs`);
|
|
378
|
+
}
|
|
379
|
+
const skew = means.samlClockSkewMs;
|
|
380
|
+
if (skew !== undefined && !(Number.isInteger(skew) && skew >= 0)) {
|
|
381
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, ['samlClockSkewMs'], 'samlClockSkewMs is not a whole, non-negative number of milliseconds');
|
|
382
|
+
}
|
|
383
|
+
const replayStore = row.assertionReplayStore(destination);
|
|
384
|
+
const createValidator = grant === 'saml2_pure'
|
|
385
|
+
? auth_providers_1.createSignedResponseValidator
|
|
386
|
+
: auth_providers_1.createSignedAssertionValidator;
|
|
387
|
+
let assertionValidator;
|
|
388
|
+
try {
|
|
389
|
+
assertionValidator = createValidator({
|
|
390
|
+
idpCertificates: certificates,
|
|
391
|
+
clockSkewMs: skew,
|
|
392
|
+
replayStore,
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
catch {
|
|
396
|
+
// The validator's own message may quote what it could not read; the
|
|
397
|
+
// error names the field only.
|
|
398
|
+
throw new DestinationConfigError_1.DestinationConfigError(destination, ['samlIdpCertificates'], 'a SAML signing certificate the destination states is not a valid X.509 certificate');
|
|
399
|
+
}
|
|
400
|
+
const common = {
|
|
401
|
+
idpSsoUrl: means.samlIdpSsoUrl,
|
|
402
|
+
spEntityId: means.samlSpEntityId,
|
|
403
|
+
acsUrl: stated(means.samlAcsUrl),
|
|
404
|
+
relayState: stated(means.samlRelayState),
|
|
405
|
+
idpEntityId: means.samlIdpEntityId,
|
|
406
|
+
idpInitiated: means.samlIdpInitiated === true,
|
|
407
|
+
assertionValidator,
|
|
408
|
+
authorization: row.authorization(destination, grant),
|
|
409
|
+
logger: row.logger,
|
|
410
|
+
onTokens: row.onTokens,
|
|
411
|
+
};
|
|
412
|
+
if (grant === 'saml2_pure') {
|
|
413
|
+
const secret = row.secret;
|
|
414
|
+
return new auth_providers_1.Saml2PureProvider({
|
|
415
|
+
...common,
|
|
416
|
+
cookieProvider: row.samlCookies(destination),
|
|
417
|
+
accessToken: stated(secret?.sessionCookies),
|
|
418
|
+
expiresAt: typeof secret?.expiresAt === 'number' ? secret.expiresAt : undefined,
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
return new auth_providers_1.Saml2BearerProvider({
|
|
422
|
+
...common,
|
|
423
|
+
tokenUrl: stated(means.samlTokenUrl),
|
|
424
|
+
uaaUrl: client?.uaaUrl,
|
|
425
|
+
clientId: client?.uaaClientId,
|
|
426
|
+
clientSecret: stated(client?.uaaClientSecret),
|
|
427
|
+
...tokenSeed(row.secret),
|
|
428
|
+
});
|
|
429
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @mcp-abap-adt/auth-broker
|
|
3
|
-
* Per-destination
|
|
4
|
-
*
|
|
3
|
+
* Per-destination credential broker: `getProvider` builds the `IAuthProvider`
|
|
4
|
+
* a destination states from its key store's means and its session store's
|
|
5
|
+
* secret, and stores back what that provider obtains; the token API serves a
|
|
6
|
+
* token from the same provider, or from one the consumer injects.
|
|
5
7
|
*/
|
|
6
8
|
export type { ITokenRefresher } from '@mcp-abap-adt/interfaces-auth';
|
|
7
9
|
export type { AuthType } from '@mcp-abap-adt/interfaces-auth-sap';
|
|
8
10
|
export type { ILogger } from '@mcp-abap-adt/interfaces-utils';
|
|
9
|
-
export { AuthBroker, type AuthBrokerConfig, type TokenProviderFactory, } from './AuthBroker';
|
|
11
|
+
export { AuthBroker, type AuthBrokerConfig, type StrategyGrant, type TokenProviderFactory, } from './AuthBroker';
|
|
12
|
+
export { bindingOf, type SecretBinding } from './bindingOf';
|
|
13
|
+
export { DestinationConfigError } from './DestinationConfigError';
|
|
10
14
|
export type { IRefreshableTokenProvider, ITokenProvider, ITokenResult, TokenProviderOptions, } from './providers';
|
|
11
15
|
export type { IAuthorizationConfig, IConnectionConfig, IServiceKeyStore, ISessionStore, } from './stores/interfaces';
|
|
12
16
|
export type { IConfig } from './types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,YAAY,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,YAAY,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,YAAY,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,YAAY,EACV,yBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @mcp-abap-adt/auth-broker
|
|
4
|
-
* Per-destination
|
|
5
|
-
*
|
|
4
|
+
* Per-destination credential broker: `getProvider` builds the `IAuthProvider`
|
|
5
|
+
* a destination states from its key store's means and its session store's
|
|
6
|
+
* secret, and stores back what that provider obtains; the token API serves a
|
|
7
|
+
* token from the same provider, or from one the consumer injects.
|
|
6
8
|
*/
|
|
7
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.AuthBroker = void 0;
|
|
10
|
+
exports.DestinationConfigError = exports.bindingOf = exports.AuthBroker = void 0;
|
|
9
11
|
var AuthBroker_1 = require("./AuthBroker");
|
|
10
12
|
Object.defineProperty(exports, "AuthBroker", { enumerable: true, get: function () { return AuthBroker_1.AuthBroker; } });
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var bindingOf_1 = require("./bindingOf");
|
|
14
|
+
Object.defineProperty(exports, "bindingOf", { enumerable: true, get: function () { return bindingOf_1.bindingOf; } });
|
|
15
|
+
var DestinationConfigError_1 = require("./DestinationConfigError");
|
|
16
|
+
Object.defineProperty(exports, "DestinationConfigError", { enumerable: true, get: function () { return DestinationConfigError_1.DestinationConfigError; } });
|
|
17
|
+
// Store implementations: `@mcp-abap-adt/auth-stores`, or any `ISessionStore` /
|
|
18
|
+
// `IServiceKeyStore`. Provider implementations: `@mcp-abap-adt/auth-providers`.
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Stateful providers handle token lifecycle internally (refresh/relogin).
|
|
5
5
|
*/
|
|
6
6
|
import type { IRefreshableTokenProvider, ITokenProvider, ITokenProviderOptions, ITokenResult } from '@mcp-abap-adt/interfaces-auth';
|
|
7
|
-
import type {
|
|
7
|
+
import type { IConnectionConfig } from '@mcp-abap-adt/interfaces-auth-broker';
|
|
8
|
+
import type { IAuthorizationConfig } from '@mcp-abap-adt/interfaces-auth-sap';
|
|
8
9
|
export type { IAuthorizationConfig, IConnectionConfig, IRefreshableTokenProvider, ITokenProvider, ITokenResult, };
|
|
9
10
|
export type TokenProviderOptions = ITokenProviderOptions;
|
|
10
11
|
//# sourceMappingURL=ITokenProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ITokenProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ITokenProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ITokenProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ITokenProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAG9E,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,cAAc,EACd,YAAY,GACb,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Token provider interface
|
|
3
3
|
*
|
|
4
|
-
* Provider implementations
|
|
5
|
-
*
|
|
4
|
+
* Provider implementations: `@mcp-abap-adt/auth-providers`, or any
|
|
5
|
+
* `IRefreshableTokenProvider`.
|
|
6
6
|
*/
|
|
7
7
|
export type { IRefreshableTokenProvider, ITokenProvider, ITokenResult, TokenProviderOptions, } from './ITokenProvider';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|