@celljs/oauth2-client 3.9.0 → 4.1.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/esm/node/authentication/oauth2-authentication-provider.d.ts +1 -1
- package/esm/node/authentication/oauth2-authentication-provider.js +4 -3
- package/esm/node/authentication/oauth2-authentication-provider.js.map +1 -1
- package/esm/node/authentication/oidc-authentication-provider.d.ts +7 -2
- package/esm/node/authentication/oidc-authentication-provider.js +23 -3
- package/esm/node/authentication/oidc-authentication-provider.js.map +1 -1
- package/esm/node/authorization/authorization-request-resolver.js +6 -6
- package/esm/node/authorization/authorization-request-resolver.js.map +1 -1
- package/esm/node/endpoint/authorization-code-token-response-client.js +2 -2
- package/esm/node/endpoint/authorization-code-token-response-client.js.map +1 -1
- package/esm/node/endpoint/client-credentials-token-response-client.js +2 -2
- package/esm/node/endpoint/client-credentials-token-response-client.js.map +1 -1
- package/esm/node/endpoint/password-token-response-client.js +2 -2
- package/esm/node/endpoint/password-token-response-client.js.map +1 -1
- package/esm/node/endpoint/refresh-token-token-response-client.js +2 -2
- package/esm/node/endpoint/refresh-token-token-response-client.js.map +1 -1
- package/esm/node/endpoint/user-response-client.js +2 -2
- package/esm/node/endpoint/user-response-client.js.map +1 -1
- package/esm/node/error/error-handler.js +2 -4
- package/esm/node/error/error-handler.js.map +1 -1
- package/esm/node/test/test-config.d.ts +1 -0
- package/esm/node/test/test-config.js +9 -0
- package/esm/node/test/test-config.js.map +1 -0
- package/esm/node/utils/authorization-grant-request-entity-util.js +1 -4
- package/esm/node/utils/authorization-grant-request-entity-util.js.map +1 -1
- package/esm/node/utils/form-util.d.ts +7 -0
- package/esm/node/utils/form-util.js +19 -0
- package/esm/node/utils/form-util.js.map +1 -0
- package/esm/node/utils/index.d.ts +2 -0
- package/esm/node/utils/index.js +2 -0
- package/esm/node/utils/index.js.map +1 -1
- package/esm/node/utils/oidc-nonce-util.d.ts +6 -0
- package/esm/node/utils/oidc-nonce-util.js +20 -0
- package/esm/node/utils/oidc-nonce-util.js.map +1 -0
- package/lib/node/authentication/oauth2-authentication-provider.d.ts +1 -1
- package/lib/node/authentication/oauth2-authentication-provider.d.ts.map +1 -1
- package/lib/node/authentication/oauth2-authentication-provider.js +4 -3
- package/lib/node/authentication/oauth2-authentication-provider.js.map +1 -1
- package/lib/node/authentication/oidc-authentication-provider.d.ts +7 -2
- package/lib/node/authentication/oidc-authentication-provider.d.ts.map +1 -1
- package/lib/node/authentication/oidc-authentication-provider.js +22 -2
- package/lib/node/authentication/oidc-authentication-provider.js.map +1 -1
- package/lib/node/authentication/oidc-authentication-provider.spec.d.ts +2 -0
- package/lib/node/authentication/oidc-authentication-provider.spec.d.ts.map +1 -0
- package/lib/node/authentication/oidc-authentication-provider.spec.js +99 -0
- package/lib/node/authentication/oidc-authentication-provider.spec.js.map +1 -0
- package/lib/node/authorization/authorization-request-resolver.d.ts.map +1 -1
- package/lib/node/authorization/authorization-request-resolver.js +6 -38
- package/lib/node/authorization/authorization-request-resolver.js.map +1 -1
- package/lib/node/endpoint/authorization-code-token-response-client.js +2 -35
- package/lib/node/endpoint/authorization-code-token-response-client.js.map +1 -1
- package/lib/node/endpoint/client-credentials-token-response-client.js +2 -35
- package/lib/node/endpoint/client-credentials-token-response-client.js.map +1 -1
- package/lib/node/endpoint/password-token-response-client.js +2 -35
- package/lib/node/endpoint/password-token-response-client.js.map +1 -1
- package/lib/node/endpoint/refresh-token-token-response-client.js +2 -35
- package/lib/node/endpoint/refresh-token-token-response-client.js.map +1 -1
- package/lib/node/endpoint/user-response-client.js +2 -35
- package/lib/node/endpoint/user-response-client.js.map +1 -1
- package/lib/node/error/error-handler.d.ts.map +1 -1
- package/lib/node/error/error-handler.js +2 -3
- package/lib/node/error/error-handler.js.map +1 -1
- package/lib/node/test/test-config.d.ts +2 -0
- package/lib/node/test/test-config.d.ts.map +1 -0
- package/lib/node/test/test-config.js +10 -0
- package/lib/node/test/test-config.js.map +1 -0
- package/lib/node/utils/authorization-grant-request-entity-util.d.ts.map +1 -1
- package/lib/node/utils/authorization-grant-request-entity-util.js +1 -3
- package/lib/node/utils/authorization-grant-request-entity-util.js.map +1 -1
- package/lib/node/utils/form-util.d.ts +8 -0
- package/lib/node/utils/form-util.d.ts.map +1 -0
- package/lib/node/utils/form-util.js +22 -0
- package/lib/node/utils/form-util.js.map +1 -0
- package/lib/node/utils/form-util.spec.d.ts +2 -0
- package/lib/node/utils/form-util.spec.d.ts.map +1 -0
- package/lib/node/utils/form-util.spec.js +24 -0
- package/lib/node/utils/form-util.spec.js.map +1 -0
- package/lib/node/utils/index.d.ts +2 -0
- package/lib/node/utils/index.d.ts.map +1 -1
- package/lib/node/utils/index.js +2 -0
- package/lib/node/utils/index.js.map +1 -1
- package/lib/node/utils/oidc-nonce-util.d.ts +7 -0
- package/lib/node/utils/oidc-nonce-util.d.ts.map +1 -0
- package/lib/node/utils/oidc-nonce-util.js +23 -0
- package/lib/node/utils/oidc-nonce-util.js.map +1 -0
- package/package.json +16 -27
- package/src/node/authentication/oauth2-authentication-provider.ts +5 -4
- package/src/node/authentication/oidc-authentication-provider.spec.ts +104 -0
- package/src/node/authentication/oidc-authentication-provider.ts +25 -4
- package/src/node/authorization/authorization-request-resolver.ts +6 -5
- package/src/node/endpoint/authorization-code-token-response-client.ts +2 -2
- package/src/node/endpoint/client-credentials-token-response-client.ts +2 -2
- package/src/node/endpoint/password-token-response-client.ts +2 -2
- package/src/node/endpoint/refresh-token-token-response-client.ts +2 -2
- package/src/node/endpoint/user-response-client.ts +2 -2
- package/src/node/error/error-handler.ts +2 -3
- package/src/node/test/test-config.ts +6 -0
- package/src/node/utils/authorization-grant-request-entity-util.ts +1 -3
- package/src/node/utils/form-util.spec.ts +25 -0
- package/src/node/utils/form-util.ts +17 -0
- package/src/node/utils/index.ts +2 -0
- package/src/node/utils/oidc-nonce-util.ts +18 -0
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
10
|
};
|
|
@@ -49,7 +16,7 @@ const http_1 = require("@celljs/http");
|
|
|
49
16
|
const provider_1 = require("../provider");
|
|
50
17
|
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
51
18
|
const utils_1 = require("../utils");
|
|
52
|
-
const
|
|
19
|
+
const form_util_1 = require("../utils/form-util");
|
|
53
20
|
let RefreshTokenTokenResponseClient = class RefreshTokenTokenResponseClient {
|
|
54
21
|
async getTokenResponse(refreshTokenGrantRequest) {
|
|
55
22
|
const { clientRegistration, refreshToken, accessToken } = refreshTokenGrantRequest;
|
|
@@ -98,7 +65,7 @@ let RefreshTokenTokenResponseClient = class RefreshTokenTokenResponseClient {
|
|
|
98
65
|
formParameters[oauth2_core_1.OAuth2ParameterNames.CLIENT_ID] = clientId;
|
|
99
66
|
formParameters[oauth2_core_1.OAuth2ParameterNames.CLIENT_SECRET] = clientSecret;
|
|
100
67
|
}
|
|
101
|
-
return
|
|
68
|
+
return form_util_1.FormUtil.stringify(formParameters);
|
|
102
69
|
}
|
|
103
70
|
};
|
|
104
71
|
exports.RefreshTokenTokenResponseClient = RefreshTokenTokenResponseClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-token-token-response-client.js","sourceRoot":"","sources":["../../../src/node/endpoint/refresh-token-token-response-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"refresh-token-token-response-client.js","sourceRoot":"","sources":["../../../src/node/endpoint/refresh-token-token-response-client.ts"],"names":[],"mappings":";;;;;;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,0CAA4B;qFAAC;0CATrE,+BAA+B;IAD3C,IAAA,gBAAS,GAAE;GACC,+BAA+B,CAmE3C"}
|
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
10
|
};
|
|
@@ -48,7 +15,7 @@ const core_1 = require("@celljs/core");
|
|
|
48
15
|
const http_1 = require("@celljs/http");
|
|
49
16
|
const provider_1 = require("../provider");
|
|
50
17
|
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
51
|
-
const
|
|
18
|
+
const form_util_1 = require("../utils/form-util");
|
|
52
19
|
let DefaultUserResponseClient = class DefaultUserResponseClient {
|
|
53
20
|
async getUserResponse(userRequest) {
|
|
54
21
|
var _a, _b, _c;
|
|
@@ -79,7 +46,7 @@ let DefaultUserResponseClient = class DefaultUserResponseClient {
|
|
|
79
46
|
};
|
|
80
47
|
if (httpMethod === http_1.HttpMethod.POST) {
|
|
81
48
|
config.headers[http_1.HttpHeaders.CONTENT_TYPE] = `${http_1.MediaType.APPLICATION_FORM_URLENCODED};charset=UTF-8`;
|
|
82
|
-
config.data =
|
|
49
|
+
config.data = form_util_1.FormUtil.stringify({
|
|
83
50
|
[oauth2_core_1.OAuth2ParameterNames.ACCESS_TOKEN]: accessToken.tokenValue
|
|
84
51
|
});
|
|
85
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-response-client.js","sourceRoot":"","sources":["../../../src/node/endpoint/user-response-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-response-client.js","sourceRoot":"","sources":["../../../src/node/endpoint/user-response-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DACmI;AACnI,uCAAoD;AACpD,uCAAkF;AAClF,0CAAqD;AACrD,qDAAmJ;AACnJ,kDAA8C;AAIvC,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAQlC,KAAK,CAAC,eAAe,CAAC,WAA8B;;QAChD,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;QACxD,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAE3F,IAAI,EAAC,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,gBAAgB,0CAAE,GAAG,CAAA,EAAE,CAAC;YAC1C,MAAM,IAAI,uCAAyB,CAAC;gBAChC,SAAS,EAAE,oDAAgC;gBAC3C,WAAW,EAAE,8EAA8E,kBAAkB,CAAC,cAAc,EAAE;aACjI,CAAC,CAAC;QACP,CAAC;QACD,MAAM,qBAAqB,GAAG,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,gBAAgB,0CAAE,qBAAqB,CAAC;QACvF,IAAI,CAAC,qBAAqB,EAAE,CAAC;YACzB,MAAM,IAAI,uCAAyB,CAAC;gBAChC,SAAS,EAAE,0DAAsC;gBACjD,WAAW,EAAE,4FAA4F,kBAAkB,CAAC,cAAc,EAAE;aAC/I,CAAC,CAAC;QACP,CAAC;QAED,IAAI,QAAQ,CAAC;QACb,IAAI,CAAC;YACD,MAAM,UAAU,GAAG,eAAe,CAAC,gBAAgB,CAAC,oBAAoB,KAAK,kCAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAU,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAU,CAAC,GAAG,CAAC;YAC1I,MAAM,MAAM,GAAuB;gBAC/B,GAAG,EAAE,MAAA,eAAe,aAAf,eA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,CAAC;;yEACgC;oCANzD,yBAAyB;IADrC,IAAA,gBAAS,EAAC,sCAAkB,CAAC;GACjB,yBAAyB,CA6DrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../src/node/error/error-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAwB,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../src/node/error/error-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAwB,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAE/D,qBACa,+BAAgC,YAAW,YAAY;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAA+C;IAGxE,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAGtD,SAAS,CAAC,QAAQ,CAAC,2BAA2B,EAAE,2BAA2B,CAAC,oBAAoB,CAAC,CAAC;IAElG,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAEpD;IAEK,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBvE;CACJ"}
|
|
@@ -15,7 +15,6 @@ const node_1 = require("@celljs/web/lib/node");
|
|
|
15
15
|
const core_1 = require("@celljs/core");
|
|
16
16
|
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
17
17
|
const authorization_1 = require("../authorization");
|
|
18
|
-
const crypto_js_1 = require("crypto-js");
|
|
19
18
|
let OAuth2AuthorizationErrorHandler = class OAuth2AuthorizationErrorHandler {
|
|
20
19
|
constructor() {
|
|
21
20
|
this.priority = error_protocol_1.OAUTH2_AUTHORIZATION_ERROR_HANDLER_PRIORITY;
|
|
@@ -28,10 +27,10 @@ let OAuth2AuthorizationErrorHandler = class OAuth2AuthorizationErrorHandler {
|
|
|
28
27
|
const authorizationRequest = await this.authorizationRequestManager.remove();
|
|
29
28
|
let redirectUri = `${authorizationRequest.redirectUri}?${oauth2_core_1.OAuth2ParameterNames.ERROR}=${oauth2Error.errorCode}`;
|
|
30
29
|
if (oauth2Error.description) {
|
|
31
|
-
redirectUri = `${redirectUri}&${oauth2_core_1.OAuth2ParameterNames.ERROR_DESCRIPTION}=${
|
|
30
|
+
redirectUri = `${redirectUri}&${oauth2_core_1.OAuth2ParameterNames.ERROR_DESCRIPTION}=${Buffer.from(oauth2Error.description, 'utf8').toString('base64')}`;
|
|
32
31
|
}
|
|
33
32
|
if (oauth2Error.uri) {
|
|
34
|
-
redirectUri = `${redirectUri}&${oauth2_core_1.OAuth2ParameterNames.ERROR_URI}=${
|
|
33
|
+
redirectUri = `${redirectUri}&${oauth2_core_1.OAuth2ParameterNames.ERROR_URI}=${Buffer.from(oauth2Error.uri, 'utf8').toString('base64')}`;
|
|
35
34
|
}
|
|
36
35
|
await this.redirectStrategy.send(redirectUri);
|
|
37
36
|
ctx.response.end(err.message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/node/error/error-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+E;AAC/E,+CAA+E;AAC/E,uCAAoD;AACpD,qDAA2G;AAC3G,oDAA+D;
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/node/error/error-handler.ts"],"names":[],"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A,gBAAS,EAAC,uBAAgB,CAAC;;yEAC0B;AAGnC;IADlB,IAAA,gBAAS,EAAC,2CAA2B,CAAC;;oFAC2D;0CAPzF,+BAA+B;IAD3C,IAAA,gBAAS,EAAC,mBAAY,CAAC;GACX,+BAA+B,CA8B3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-config.d.ts","sourceRoot":"","sources":["../../../src/node/test/test-config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
var _b;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
/**
|
|
6
|
+
* Import first in specs that load @celljs/security: some of its modules read `cell.security` of the
|
|
7
|
+
* configuration while they load, which the generated configuration provides in an application.
|
|
8
|
+
*/
|
|
9
|
+
(_a = (_b = globalThis).cellProps) !== null && _a !== void 0 ? _a : (_b.cellProps = { cell: { security: {} } });
|
|
10
|
+
//# sourceMappingURL=test-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-config.js","sourceRoot":"","sources":["../../../src/node/test/test-config.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,YAAC,UAAkC,EAAC,SAAS,uCAAT,SAAS,GAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-grant-request-entity-util.d.ts","sourceRoot":"","sources":["../../../src/node/utils/authorization-grant-request-entity-util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"authorization-grant-request-entity-util.d.ts","sourceRoot":"","sources":["../../../src/node/utils/authorization-grant-request-entity-util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,yBAAiB,mCAAmC,CAAC;IAEjD,SAAgB,sBAAsB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAQrG;IAED,SAAgB,6BAA6B,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAMtE;CACJ"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AuthorizationGrantRequestEntityUtil = void 0;
|
|
4
4
|
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
5
5
|
const http_1 = require("@celljs/http");
|
|
6
|
-
const crypto_js_1 = require("crypto-js");
|
|
7
6
|
var AuthorizationGrantRequestEntityUtil;
|
|
8
7
|
(function (AuthorizationGrantRequestEntityUtil) {
|
|
9
8
|
function getTokenRequestHeaders(clientRegistration) {
|
|
@@ -11,8 +10,7 @@ var AuthorizationGrantRequestEntityUtil;
|
|
|
11
10
|
const { clientAuthenticationMethod, clientId, clientSecret } = clientRegistration;
|
|
12
11
|
if (clientAuthenticationMethod === oauth2_core_1.ClientAuthenticationMethod.Basic) {
|
|
13
12
|
const credentialsStr = `${clientId}:${clientSecret}`;
|
|
14
|
-
|
|
15
|
-
headers[http_1.HttpHeaders.AUTHORIZATION] = `${clientAuthenticationMethod} ${crypto_js_1.enc.Base64.stringify(encoded)}`;
|
|
13
|
+
headers[http_1.HttpHeaders.AUTHORIZATION] = `${clientAuthenticationMethod} ${Buffer.from(credentialsStr, 'latin1').toString('base64')}`;
|
|
16
14
|
}
|
|
17
15
|
return headers;
|
|
18
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-grant-request-entity-util.js","sourceRoot":"","sources":["../../../src/node/utils/authorization-grant-request-entity-util.ts"],"names":[],"mappings":";;;AAAA,qDAAiE;AAEjE,uCAAsD;
|
|
1
|
+
{"version":3,"file":"authorization-grant-request-entity-util.js","sourceRoot":"","sources":["../../../src/node/utils/authorization-grant-request-entity-util.ts"],"names":[],"mappings":";;;AAAA,qDAAiE;AAEjE,uCAAsD;AAEtD,IAAiB,mCAAmC,CAmBnD;AAnBD,WAAiB,mCAAmC;IAEhD,SAAgB,sBAAsB,CAAC,kBAAsC;QACzE,MAAM,OAAO,GAAG,EAAE,GAAG,6BAA6B,EAAE,EAAE,CAAC;QACvD,MAAM,EAAE,0BAA0B,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,kBAAkB,CAAC;QAClF,IAAI,0BAA0B,KAAK,wCAA0B,CAAC,KAAK,EAAE,CAAC;YAClE,MAAM,cAAc,GAAG,GAAG,QAAQ,IAAI,YAAY,EAAE,CAAC;YACrD,OAAO,CAAC,kBAAW,CAAC,aAAa,CAAC,GAAG,GAAG,0BAA0B,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrI,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IARe,oCAAA,sBAAsB,yBAQrC,CAAA;IAED,SAAgB,6BAA6B;QAEzC,OAAO;YACH,CAAC,kBAAW,CAAC,MAAM,CAAC,EAAE,gBAAS,CAAC,qBAAqB;YACrD,CAAC,kBAAW,CAAC,YAAY,CAAC,EAAE,GAAG,gBAAS,CAAC,2BAA2B,gBAAgB;SACvF,CAAC;IACN,CAAC;IANe,oCAAA,6BAA6B,gCAM5C,CAAA;AACL,CAAC,EAnBgB,mCAAmC,aAAnC,mCAAmC,GAAnC,mCAAmC,QAmBnD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare namespace FormUtil {
|
|
2
|
+
/**
|
|
3
|
+
* `application/x-www-form-urlencoded` of flat parameters, as qs.stringify wrote it: spaces as
|
|
4
|
+
* `%20`, undefined values left out, null as an empty value.
|
|
5
|
+
*/
|
|
6
|
+
function stringify(parameters: Record<string, unknown>): string;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=form-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-util.d.ts","sourceRoot":"","sources":["../../../src/node/utils/form-util.ts"],"names":[],"mappings":"AAKA,yBAAiB,QAAQ,CAAC;IACtB;;;OAGG;IACH,SAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAKrE;CACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormUtil = void 0;
|
|
4
|
+
/** RFC 3986 percent-encoding: encodeURIComponent, plus the sub-delimiters it leaves as they are. */
|
|
5
|
+
function encode(text) {
|
|
6
|
+
return encodeURIComponent(text).replace(/[!'()*]/g, c => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
7
|
+
}
|
|
8
|
+
var FormUtil;
|
|
9
|
+
(function (FormUtil) {
|
|
10
|
+
/**
|
|
11
|
+
* `application/x-www-form-urlencoded` of flat parameters, as qs.stringify wrote it: spaces as
|
|
12
|
+
* `%20`, undefined values left out, null as an empty value.
|
|
13
|
+
*/
|
|
14
|
+
function stringify(parameters) {
|
|
15
|
+
return Object.entries(parameters)
|
|
16
|
+
.filter(([, value]) => value !== undefined)
|
|
17
|
+
.map(([key, value]) => `${encode(key)}=${value === null ? '' : encode(String(value))}`)
|
|
18
|
+
.join('&');
|
|
19
|
+
}
|
|
20
|
+
FormUtil.stringify = stringify;
|
|
21
|
+
})(FormUtil || (exports.FormUtil = FormUtil = {}));
|
|
22
|
+
//# sourceMappingURL=form-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-util.js","sourceRoot":"","sources":["../../../src/node/utils/form-util.ts"],"names":[],"mappings":";;;AAAA,oGAAoG;AACpG,SAAS,MAAM,CAAC,IAAY;IACxB,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAC/G,CAAC;AAED,IAAiB,QAAQ,CAWxB;AAXD,WAAiB,QAAQ;IACrB;;;OAGG;IACH,SAAgB,SAAS,CAAC,UAAmC;QACzD,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;aAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC;aAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;aACtF,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IALe,SAAA,SAAS,YAKxB,CAAA;AACL,CAAC,EAXgB,QAAQ,aAAR,QAAQ,GAAR,QAAQ,QAWxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-util.spec.d.ts","sourceRoot":"","sources":["../../../src/node/utils/form-util.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const form_util_1 = require("./form-util");
|
|
6
|
+
/** The expected strings are what qs.stringify (6.17) produced for the same parameters. */
|
|
7
|
+
(0, bun_test_1.describe)('FormUtil.stringify', () => {
|
|
8
|
+
(0, bun_test_1.it)('encodes like qs.stringify and leaves undefined values out', () => {
|
|
9
|
+
(0, chai_1.expect)(form_util_1.FormUtil.stringify({ grant_type: 'authorization_code', code: 'a/b+c=d', redirect_uri: 'https://x.test/cb?x=1&y=2', client_id: 'id', client_secret: undefined }))
|
|
10
|
+
.to.equal('grant_type=authorization_code&code=a%2Fb%2Bc%3Dd&redirect_uri=https%3A%2F%2Fx.test%2Fcb%3Fx%3D1%26y%3D2&client_id=id');
|
|
11
|
+
});
|
|
12
|
+
(0, bun_test_1.it)('encodes spaces as %20, the RFC 3986 sub-delimiters, and null as an empty value', () => {
|
|
13
|
+
(0, chai_1.expect)(form_util_1.FormUtil.stringify({ scope: 'openid profile email', state: "abc-_~.*'()!", empty: '', nil: null }))
|
|
14
|
+
.to.equal('scope=openid%20profile%20email&state=abc-_~.%2A%27%28%29%21&empty=&nil=');
|
|
15
|
+
});
|
|
16
|
+
(0, bun_test_1.it)('encodes UTF-8', () => {
|
|
17
|
+
(0, chai_1.expect)(form_util_1.FormUtil.stringify({ text: '中文 ✓' })).to.equal('text=%E4%B8%AD%E6%96%87%20%E2%9C%93');
|
|
18
|
+
});
|
|
19
|
+
(0, bun_test_1.it)('decodes back to the parameters with URLSearchParams', () => {
|
|
20
|
+
const parameters = { scope: 'a b', redirect_uri: 'https://x.test/?q=1&r=2', text: '中文' };
|
|
21
|
+
(0, chai_1.expect)(Object.fromEntries(new URLSearchParams(form_util_1.FormUtil.stringify(parameters)))).to.deep.equal(parameters);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=form-util.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-util.spec.js","sourceRoot":"","sources":["../../../src/node/utils/form-util.spec.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,+BAA8B;AAC9B,2CAAuC;AAEvC,0FAA0F;AAC1F,IAAA,mBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;IAChC,IAAA,aAAE,EAAC,2DA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"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2CAA2C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC"}
|
package/lib/node/utils/index.js
CHANGED
|
@@ -16,4 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./authorization-response-util"), exports);
|
|
18
18
|
__exportStar(require("./authorization-grant-request-entity-util"), exports);
|
|
19
|
+
__exportStar(require("./form-util"), exports);
|
|
20
|
+
__exportStar(require("./oidc-nonce-util"), exports);
|
|
19
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,4EAA0D"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,4EAA0D;AAC1D,8CAA4B;AAC5B,oDAAkC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare namespace OidcNonceUtil {
|
|
2
|
+
/** What the authorization request sends as `nonce` for a stored nonce, and the ID Token must carry back. */
|
|
3
|
+
function hash(nonce: string): string;
|
|
4
|
+
/** Whether `claim` (the `nonce` of an ID Token) belongs to the stored `nonce`; constant time. */
|
|
5
|
+
function matches(nonce: string, claim: unknown): boolean;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=oidc-nonce-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oidc-nonce-util.d.ts","sourceRoot":"","sources":["../../../src/node/utils/oidc-nonce-util.ts"],"names":[],"mappings":"AAEA,yBAAiB,aAAa,CAAC;IAC3B,4GAA4G;IAC5G,SAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1C;IAED,iGAAiG;IACjG,SAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAO9D;CACJ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OidcNonceUtil = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
var OidcNonceUtil;
|
|
6
|
+
(function (OidcNonceUtil) {
|
|
7
|
+
/** What the authorization request sends as `nonce` for a stored nonce, and the ID Token must carry back. */
|
|
8
|
+
function hash(nonce) {
|
|
9
|
+
return (0, node_crypto_1.createHash)('sha256').update(nonce).digest('base64url');
|
|
10
|
+
}
|
|
11
|
+
OidcNonceUtil.hash = hash;
|
|
12
|
+
/** Whether `claim` (the `nonce` of an ID Token) belongs to the stored `nonce`; constant time. */
|
|
13
|
+
function matches(nonce, claim) {
|
|
14
|
+
if (typeof claim !== 'string') {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const expected = Buffer.from(hash(nonce));
|
|
18
|
+
const actual = Buffer.from(claim);
|
|
19
|
+
return actual.length === expected.length && (0, node_crypto_1.timingSafeEqual)(actual, expected);
|
|
20
|
+
}
|
|
21
|
+
OidcNonceUtil.matches = matches;
|
|
22
|
+
})(OidcNonceUtil || (exports.OidcNonceUtil = OidcNonceUtil = {}));
|
|
23
|
+
//# sourceMappingURL=oidc-nonce-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oidc-nonce-util.js","sourceRoot":"","sources":["../../../src/node/utils/oidc-nonce-util.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAE1D,IAAiB,aAAa,CAe7B;AAfD,WAAiB,aAAa;IAC1B,4GAA4G;IAC5G,SAAgB,IAAI,CAAC,KAAa;QAC9B,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAClE,CAAC;IAFe,cAAA,IAAI,OAEnB,CAAA;IAED,iGAAiG;IACjG,SAAgB,OAAO,CAAC,KAAa,EAAE,KAAc;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,IAAI,IAAA,6BAAe,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClF,CAAC;IAPe,cAAA,OAAO,UAOtB,CAAA;AACL,CAAC,EAfgB,aAAa,aAAb,aAAa,GAAb,aAAa,QAe7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/oauth2-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -29,86 +29,75 @@
|
|
|
29
29
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@celljs/core": "
|
|
33
|
-
"@celljs/http": "
|
|
34
|
-
"@celljs/oauth2-core": "
|
|
35
|
-
"@celljs/oauth2-jose": "
|
|
36
|
-
"@celljs/security": "
|
|
37
|
-
"@celljs/web": "
|
|
38
|
-
"axios": "^0.
|
|
39
|
-
"
|
|
40
|
-
"jose": "^4.9.3",
|
|
41
|
-
"qs": "^6.9.4",
|
|
42
|
-
"tslib": "^2.8.0"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@types/crypto-js": "^3.1.47"
|
|
32
|
+
"@celljs/core": "4.1.0",
|
|
33
|
+
"@celljs/http": "4.1.0",
|
|
34
|
+
"@celljs/oauth2-core": "4.1.0",
|
|
35
|
+
"@celljs/oauth2-jose": "4.1.0",
|
|
36
|
+
"@celljs/security": "4.1.0",
|
|
37
|
+
"@celljs/web": "4.1.0",
|
|
38
|
+
"axios": "^0.35.0",
|
|
39
|
+
"jose": "^4.9.3"
|
|
46
40
|
},
|
|
47
41
|
"publishConfig": {
|
|
48
42
|
"access": "public"
|
|
49
43
|
},
|
|
50
44
|
"exports": {
|
|
51
45
|
".": {
|
|
52
|
-
"webpack": "./lib/node/index.js",
|
|
53
46
|
"import": "./esm/node/index.js",
|
|
54
47
|
"default": "./lib/node/index.js"
|
|
55
48
|
},
|
|
56
49
|
"./package.json": "./package.json",
|
|
57
50
|
"./lib/node": {
|
|
58
|
-
"webpack": "./lib/node/index.js",
|
|
59
51
|
"import": "./esm/node/index.js",
|
|
60
52
|
"default": "./lib/node/index.js"
|
|
61
53
|
},
|
|
62
54
|
"./lib/node/authentication": {
|
|
63
|
-
"webpack": "./lib/node/authentication/index.js",
|
|
64
55
|
"import": "./esm/node/authentication/index.js",
|
|
65
56
|
"default": "./lib/node/authentication/index.js"
|
|
66
57
|
},
|
|
67
58
|
"./lib/node/authorization": {
|
|
68
|
-
"webpack": "./lib/node/authorization/index.js",
|
|
69
59
|
"import": "./esm/node/authorization/index.js",
|
|
70
60
|
"default": "./lib/node/authorization/index.js"
|
|
71
61
|
},
|
|
72
62
|
"./lib/node/endpoint": {
|
|
73
|
-
"webpack": "./lib/node/endpoint/index.js",
|
|
74
63
|
"import": "./esm/node/endpoint/index.js",
|
|
75
64
|
"default": "./lib/node/endpoint/index.js"
|
|
76
65
|
},
|
|
77
66
|
"./lib/node/error": {
|
|
78
|
-
"webpack": "./lib/node/error/index.js",
|
|
79
67
|
"import": "./esm/node/error/index.js",
|
|
80
68
|
"default": "./lib/node/error/index.js"
|
|
81
69
|
},
|
|
82
70
|
"./lib/node/provider": {
|
|
83
|
-
"webpack": "./lib/node/provider/index.js",
|
|
84
71
|
"import": "./esm/node/provider/index.js",
|
|
85
72
|
"default": "./lib/node/provider/index.js"
|
|
86
73
|
},
|
|
87
74
|
"./lib/node/registration": {
|
|
88
|
-
"webpack": "./lib/node/registration/index.js",
|
|
89
75
|
"import": "./esm/node/registration/index.js",
|
|
90
76
|
"default": "./lib/node/registration/index.js"
|
|
91
77
|
},
|
|
92
78
|
"./lib/node/user": {
|
|
93
|
-
"webpack": "./lib/node/user/index.js",
|
|
94
79
|
"import": "./esm/node/user/index.js",
|
|
95
80
|
"default": "./lib/node/user/index.js"
|
|
96
81
|
},
|
|
97
82
|
"./lib/node/utils": {
|
|
98
|
-
"webpack": "./lib/node/utils/index.js",
|
|
99
83
|
"import": "./esm/node/utils/index.js",
|
|
100
84
|
"default": "./lib/node/utils/index.js"
|
|
101
85
|
},
|
|
102
86
|
"./lib/*.js": {
|
|
103
|
-
"webpack": "./lib/*.js",
|
|
104
87
|
"import": "./esm/*.js",
|
|
105
88
|
"default": "./lib/*.js"
|
|
106
89
|
},
|
|
107
90
|
"./lib/*": {
|
|
108
|
-
"webpack": "./lib/*.js",
|
|
109
91
|
"import": "./esm/*.js",
|
|
110
92
|
"default": "./lib/*.js"
|
|
111
93
|
},
|
|
112
94
|
"./*": "./*"
|
|
95
|
+
},
|
|
96
|
+
"cell": {
|
|
97
|
+
"modules": {
|
|
98
|
+
"backend": [
|
|
99
|
+
"lib/node/module"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
113
102
|
}
|
|
114
103
|
}
|
|
@@ -64,7 +64,8 @@ export class OAuth2AuthenticationProvider implements AuthenticationProvider {
|
|
|
64
64
|
return true;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
protected getUserinfo(clientRegistration: ClientRegistration, tokenResponse: AccessTokenResponse, additionalParameters: { [key: string]: string }
|
|
67
|
+
protected getUserinfo(clientRegistration: ClientRegistration, tokenResponse: AccessTokenResponse, additionalParameters: { [key: string]: string },
|
|
68
|
+
authorizationRequest: AuthorizationRequest) {
|
|
68
69
|
return this.userService.load({
|
|
69
70
|
clientRegistration,
|
|
70
71
|
accessToken: tokenResponse.accessToken,
|
|
@@ -89,6 +90,8 @@ export class OAuth2AuthenticationProvider implements AuthenticationProvider {
|
|
|
89
90
|
if (!this.checkScopes(authorizationRequest.scopes)) {
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
93
|
+
// An authorization request (its state and nonce) is good for one response: a replay finds nothing.
|
|
94
|
+
await this.authorizationRequestManager.remove();
|
|
92
95
|
|
|
93
96
|
const registrationId = authorizationRequest.attributes[OAuth2ParameterNames.REGISTRATION_ID];
|
|
94
97
|
const clientRegistration = await this.clientRegistrationManager.get(registrationId);
|
|
@@ -129,7 +132,7 @@ export class OAuth2AuthenticationProvider implements AuthenticationProvider {
|
|
|
129
132
|
|
|
130
133
|
const { additionalParameters } = tokenResponse;
|
|
131
134
|
|
|
132
|
-
const user = await this.getUserinfo(clientRegistration, tokenResponse, additionalParameters);
|
|
135
|
+
const user = await this.getUserinfo(clientRegistration, tokenResponse, additionalParameters, authorizationRequest);
|
|
133
136
|
await this.userChecker.check(user);
|
|
134
137
|
await this.userMapper.map(user);
|
|
135
138
|
|
|
@@ -140,8 +143,6 @@ export class OAuth2AuthenticationProvider implements AuthenticationProvider {
|
|
|
140
143
|
principalName: user.username
|
|
141
144
|
}, user.username);
|
|
142
145
|
|
|
143
|
-
await this.authorizationRequestManager.remove();
|
|
144
|
-
|
|
145
146
|
return {
|
|
146
147
|
name: user.username,
|
|
147
148
|
principal: user,
|