@mcp-abap-adt/auth-providers 2.2.2 → 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 +193 -0
- package/README.md +825 -64
- package/dist/__tests__/integration/stand/formLogin.d.ts +68 -0
- package/dist/__tests__/integration/stand/formLogin.d.ts.map +1 -0
- package/dist/__tests__/integration/stand/formLogin.js +194 -0
- package/dist/auth/callbackServer.js +2 -2
- package/dist/auth/passcodeAuth.d.ts +25 -0
- package/dist/auth/passcodeAuth.d.ts.map +1 -0
- package/dist/auth/passcodeAuth.js +62 -0
- package/dist/auth/saml2Auth.d.ts +6 -2
- package/dist/auth/saml2Auth.d.ts.map +1 -1
- package/dist/auth/saml2Auth.js +9 -20
- package/dist/auth/samlBearerAssertion.d.ts +24 -0
- package/dist/auth/samlBearerAssertion.d.ts.map +1 -0
- package/dist/auth/samlBearerAssertion.js +102 -0
- package/dist/auth/strictXml.d.ts +13 -0
- package/dist/auth/strictXml.d.ts.map +1 -0
- package/dist/auth/strictXml.js +21 -0
- package/dist/errors/AssertionValidationError.d.ts +15 -0
- package/dist/errors/AssertionValidationError.d.ts.map +1 -0
- package/dist/errors/AssertionValidationError.js +24 -0
- package/dist/errors/TokenProviderErrors.d.ts +2 -0
- package/dist/errors/TokenProviderErrors.d.ts.map +1 -1
- package/dist/errors/TokenProviderErrors.js +3 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -2
- package/dist/providers/Saml2BearerProvider.d.ts +1 -0
- package/dist/providers/Saml2BearerProvider.d.ts.map +1 -1
- package/dist/providers/Saml2BearerProvider.js +20 -2
- package/dist/providers/Saml2PureProvider.d.ts +1 -0
- package/dist/providers/Saml2PureProvider.d.ts.map +1 -1
- package/dist/providers/Saml2PureProvider.js +19 -5
- package/dist/providers/UaaPasscodeProvider.d.ts +43 -0
- package/dist/providers/UaaPasscodeProvider.d.ts.map +1 -0
- package/dist/providers/UaaPasscodeProvider.js +86 -0
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +3 -3
- package/dist/providers/saml2Utils.d.ts +49 -2
- package/dist/providers/saml2Utils.d.ts.map +1 -1
- package/dist/providers/saml2Utils.js +94 -2
- package/dist/strategies/index.d.ts +1 -1
- package/dist/strategies/index.d.ts.map +1 -1
- package/dist/strategies/index.js +2 -1
- package/dist/strategies/manualStrategies.d.ts +7 -0
- package/dist/strategies/manualStrategies.d.ts.map +1 -1
- package/dist/strategies/manualStrategies.js +21 -0
- package/dist/validation/assertionValidator.d.ts +28 -0
- package/dist/validation/assertionValidator.d.ts.map +1 -0
- package/dist/validation/assertionValidator.js +444 -0
- package/dist/validation/documentIds.d.ts +15 -0
- package/dist/validation/documentIds.d.ts.map +1 -0
- package/dist/validation/documentIds.js +32 -0
- package/dist/validation/inMemoryReplayStore.d.ts +22 -0
- package/dist/validation/inMemoryReplayStore.d.ts.map +1 -0
- package/dist/validation/inMemoryReplayStore.js +49 -0
- package/dist/validation/signedNode.d.ts +54 -0
- package/dist/validation/signedNode.d.ts.map +1 -0
- package/dist/validation/signedNode.js +171 -0
- package/dist/validation/xsdDateTime.d.ts +17 -0
- package/dist/validation/xsdDateTime.d.ts.map +1 -0
- package/dist/validation/xsdDateTime.js +67 -0
- package/package.json +14 -8
- package/bin/auth-device-flow.ts +0 -114
- package/dist/auth/deviceFlowAuth.d.ts +0 -43
- package/dist/auth/deviceFlowAuth.d.ts.map +0 -1
- package/dist/auth/deviceFlowAuth.js +0 -168
- package/dist/providers/DeviceFlowProvider.d.ts +0 -32
- package/dist/providers/DeviceFlowProvider.d.ts.map +0 -1
- package/dist/providers/DeviceFlowProvider.js +0 -86
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceFlowProvider.d.ts","sourceRoot":"","sources":["../../src/providers/DeviceFlowProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAO9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;IACvD,OAAO,CAAC,MAAM,CAA2B;gBAE7B,MAAM,EAAE,wBAAwB;IAc5C,SAAS,CAAC,WAAW,IAAI,eAAe;cAOxB,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC;cAyCrC,cAAc,IAAI,OAAO,CAAC,YAAY,CAAC;CA2BxD"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Device Flow Token Provider
|
|
4
|
-
*
|
|
5
|
-
* Uses OAuth2 Device Flow for devices without browser or input capabilities.
|
|
6
|
-
* User authorizes on another device by entering a code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.DeviceFlowProvider = void 0;
|
|
10
|
-
const interfaces_auth_1 = require("@mcp-abap-adt/interfaces-auth");
|
|
11
|
-
const announce_1 = require("../auth/announce");
|
|
12
|
-
const deviceFlowAuth_1 = require("../auth/deviceFlowAuth");
|
|
13
|
-
const tokenRefresher_1 = require("../auth/tokenRefresher");
|
|
14
|
-
const BaseTokenProvider_1 = require("./BaseTokenProvider");
|
|
15
|
-
/**
|
|
16
|
-
* Device Flow token provider
|
|
17
|
-
*
|
|
18
|
-
* Uses OAuth2 Device Flow - user authorizes on another device.
|
|
19
|
-
* Supports refresh token if provided by server.
|
|
20
|
-
*/
|
|
21
|
-
class DeviceFlowProvider extends BaseTokenProvider_1.BaseTokenProvider {
|
|
22
|
-
config;
|
|
23
|
-
constructor(config) {
|
|
24
|
-
super();
|
|
25
|
-
this.config = config;
|
|
26
|
-
this.logger = config.logger;
|
|
27
|
-
if (config.accessToken) {
|
|
28
|
-
this.authorizationToken = config.accessToken;
|
|
29
|
-
this.expiresAt = this.parseExpirationFromJWT(config.accessToken);
|
|
30
|
-
}
|
|
31
|
-
if (config.refreshToken) {
|
|
32
|
-
this.refreshToken = config.refreshToken;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
getAuthType() {
|
|
36
|
-
// Device Flow is not a standard grant type in OAuth2 spec
|
|
37
|
-
// We'll use a custom type or map it to authorization_code
|
|
38
|
-
// For now, using authorization_code as it's similar
|
|
39
|
-
return interfaces_auth_1.AUTH_TYPE_AUTHORIZATION_CODE;
|
|
40
|
-
}
|
|
41
|
-
async performLogin() {
|
|
42
|
-
// Initiate device flow
|
|
43
|
-
const deviceFlow = await (0, deviceFlowAuth_1.initiateDeviceFlow)(this.config.uaaUrl, this.config.clientId, this.config.scope, this.logger);
|
|
44
|
-
// Display user code and verification URI. This is a prompt the user must
|
|
45
|
-
// see to complete the flow, not a log line — it goes to the logger when
|
|
46
|
-
// there is one and to stderr otherwise, never to stdout.
|
|
47
|
-
const announce = (0, announce_1.announcer)(this.logger);
|
|
48
|
-
announce('Device Flow Authorization');
|
|
49
|
-
announce(`Go to: ${deviceFlow.verificationUri}`);
|
|
50
|
-
if (deviceFlow.verificationUriComplete) {
|
|
51
|
-
announce(`Or use complete URL: ${deviceFlow.verificationUriComplete}`);
|
|
52
|
-
}
|
|
53
|
-
announce(`Enter code: ${deviceFlow.userCode}`);
|
|
54
|
-
announce('Waiting for authorization...');
|
|
55
|
-
// Poll for tokens
|
|
56
|
-
const result = await (0, deviceFlowAuth_1.pollForDeviceTokens)(this.config.uaaUrl, this.config.clientId, this.config.clientSecret, deviceFlow.deviceCode, deviceFlow.interval, this.logger);
|
|
57
|
-
const expiresIn = this.calculateExpiresIn(result.accessToken);
|
|
58
|
-
return {
|
|
59
|
-
authorizationToken: result.accessToken,
|
|
60
|
-
refreshToken: result.refreshToken,
|
|
61
|
-
authType: interfaces_auth_1.AUTH_TYPE_AUTHORIZATION_CODE, // Device flow maps to authorization_code
|
|
62
|
-
expiresIn,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
async performRefresh() {
|
|
66
|
-
if (!this.refreshToken) {
|
|
67
|
-
// No refresh token - re-authenticate with device flow
|
|
68
|
-
return await this.performLogin();
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const result = await (0, tokenRefresher_1.refreshJwtToken)(this.refreshToken, this.config.uaaUrl, this.config.clientId, this.config.clientSecret || '');
|
|
72
|
-
const expiresIn = this.calculateExpiresIn(result.accessToken);
|
|
73
|
-
return {
|
|
74
|
-
authorizationToken: result.accessToken,
|
|
75
|
-
refreshToken: result.refreshToken || this.refreshToken,
|
|
76
|
-
authType: interfaces_auth_1.AUTH_TYPE_AUTHORIZATION_CODE,
|
|
77
|
-
expiresIn,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
catch (_error) {
|
|
81
|
-
// Refresh failed - try device flow login
|
|
82
|
-
return await this.performLogin();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.DeviceFlowProvider = DeviceFlowProvider;
|