@celljs/oauth2-client 3.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/LICENSE +21 -0
- package/README.md +1 -0
- package/cell.yml +57 -0
- package/lib/node/authentication/authentication-protocol.d.ts +25 -0
- package/lib/node/authentication/authentication-protocol.d.ts.map +1 -0
- package/lib/node/authentication/authentication-protocol.js +11 -0
- package/lib/node/authentication/authentication-protocol.js.map +1 -0
- package/lib/node/authentication/index.d.ts +4 -0
- package/lib/node/authentication/index.d.ts.map +1 -0
- package/lib/node/authentication/index.js +20 -0
- package/lib/node/authentication/index.js.map +1 -0
- package/lib/node/authentication/oauth2-authentication-provider.d.ts +30 -0
- package/lib/node/authentication/oauth2-authentication-provider.d.ts.map +1 -0
- package/lib/node/authentication/oauth2-authentication-provider.js +170 -0
- package/lib/node/authentication/oauth2-authentication-provider.js.map +1 -0
- package/lib/node/authentication/oidc-authentication-provider.d.ts +18 -0
- package/lib/node/authentication/oidc-authentication-provider.d.ts.map +1 -0
- package/lib/node/authentication/oidc-authentication-provider.js +74 -0
- package/lib/node/authentication/oidc-authentication-provider.js.map +1 -0
- package/lib/node/authorization/authorization-code-authorized-client-provider.d.ts +5 -0
- package/lib/node/authorization/authorization-code-authorized-client-provider.d.ts.map +1 -0
- package/lib/node/authorization/authorization-code-authorized-client-provider.js +27 -0
- package/lib/node/authorization/authorization-code-authorized-client-provider.js.map +1 -0
- package/lib/node/authorization/authorization-code-grant-middleware.d.ts +26 -0
- package/lib/node/authorization/authorization-code-grant-middleware.d.ts.map +1 -0
- package/lib/node/authorization/authorization-code-grant-middleware.js +129 -0
- package/lib/node/authorization/authorization-code-grant-middleware.js.map +1 -0
- package/lib/node/authorization/authorization-failure-handler.d.ts +10 -0
- package/lib/node/authorization/authorization-failure-handler.d.ts.map +1 -0
- package/lib/node/authorization/authorization-failure-handler.js +35 -0
- package/lib/node/authorization/authorization-failure-handler.js.map +1 -0
- package/lib/node/authorization/authorization-protocol.d.ts +78 -0
- package/lib/node/authorization/authorization-protocol.d.ts.map +1 -0
- package/lib/node/authorization/authorization-protocol.js +34 -0
- package/lib/node/authorization/authorization-protocol.js.map +1 -0
- package/lib/node/authorization/authorization-request-manager.d.ts +13 -0
- package/lib/node/authorization/authorization-request-manager.d.ts.map +1 -0
- package/lib/node/authorization/authorization-request-manager.js +64 -0
- package/lib/node/authorization/authorization-request-manager.js.map +1 -0
- package/lib/node/authorization/authorization-request-redirect-middleware.d.ts +20 -0
- package/lib/node/authorization/authorization-request-redirect-middleware.d.ts.map +1 -0
- package/lib/node/authorization/authorization-request-redirect-middleware.js +113 -0
- package/lib/node/authorization/authorization-request-redirect-middleware.js.map +1 -0
- package/lib/node/authorization/authorization-request-resolver.d.ts +38 -0
- package/lib/node/authorization/authorization-request-resolver.d.ts.map +1 -0
- package/lib/node/authorization/authorization-request-resolver.js +155 -0
- package/lib/node/authorization/authorization-request-resolver.js.map +1 -0
- package/lib/node/authorization/authorization-success-handler.d.ts +7 -0
- package/lib/node/authorization/authorization-success-handler.d.ts.map +1 -0
- package/lib/node/authorization/authorization-success-handler.js +28 -0
- package/lib/node/authorization/authorization-success-handler.js.map +1 -0
- package/lib/node/authorization/authorized-client-manager.d.ts +11 -0
- package/lib/node/authorization/authorized-client-manager.d.ts.map +1 -0
- package/lib/node/authorization/authorized-client-manager.js +48 -0
- package/lib/node/authorization/authorized-client-manager.js.map +1 -0
- package/lib/node/authorization/authorized-client-service.d.ts +12 -0
- package/lib/node/authorization/authorized-client-service.d.ts.map +1 -0
- package/lib/node/authorization/authorized-client-service.js +87 -0
- package/lib/node/authorization/authorized-client-service.js.map +1 -0
- package/lib/node/authorization/client-credentials-authorized-client-provider.d.ts +12 -0
- package/lib/node/authorization/client-credentials-authorized-client-provider.d.ts.map +1 -0
- package/lib/node/authorization/client-credentials-authorized-client-provider.js +72 -0
- package/lib/node/authorization/client-credentials-authorized-client-provider.js.map +1 -0
- package/lib/node/authorization/context-attributes-mapper.d.ts +5 -0
- package/lib/node/authorization/context-attributes-mapper.d.ts.map +1 -0
- package/lib/node/authorization/context-attributes-mapper.js +28 -0
- package/lib/node/authorization/context-attributes-mapper.js.map +1 -0
- package/lib/node/authorization/index.d.ts +14 -0
- package/lib/node/authorization/index.d.ts.map +1 -0
- package/lib/node/authorization/index.js +30 -0
- package/lib/node/authorization/index.js.map +1 -0
- package/lib/node/authorization/password-authorized-client-provider.d.ts +12 -0
- package/lib/node/authorization/password-authorized-client-provider.d.ts.map +1 -0
- package/lib/node/authorization/password-authorized-client-provider.js +85 -0
- package/lib/node/authorization/password-authorized-client-provider.js.map +1 -0
- package/lib/node/authorization/refresh-token-authorized-client-provider.d.ts +12 -0
- package/lib/node/authorization/refresh-token-authorized-client-provider.d.ts.map +1 -0
- package/lib/node/authorization/refresh-token-authorized-client-provider.js +68 -0
- package/lib/node/authorization/refresh-token-authorized-client-provider.js.map +1 -0
- package/lib/node/constants.d.ts +5 -0
- package/lib/node/constants.d.ts.map +1 -0
- package/lib/node/constants.js +8 -0
- package/lib/node/constants.js.map +1 -0
- package/lib/node/endpoint/authorization-code-token-response-client.d.ts +12 -0
- package/lib/node/endpoint/authorization-code-token-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/authorization-code-token-response-client.js +83 -0
- package/lib/node/endpoint/authorization-code-token-response-client.js.map +1 -0
- package/lib/node/endpoint/client-credentials-token-response-client.d.ts +12 -0
- package/lib/node/endpoint/client-credentials-token-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/client-credentials-token-response-client.js +80 -0
- package/lib/node/endpoint/client-credentials-token-response-client.js.map +1 -0
- package/lib/node/endpoint/endpoint-protocol.d.ts +48 -0
- package/lib/node/endpoint/endpoint-protocol.d.ts.map +1 -0
- package/lib/node/endpoint/endpoint-protocol.js +9 -0
- package/lib/node/endpoint/endpoint-protocol.js.map +1 -0
- package/lib/node/endpoint/index.d.ts +7 -0
- package/lib/node/endpoint/index.d.ts.map +1 -0
- package/lib/node/endpoint/index.js +23 -0
- package/lib/node/endpoint/index.js.map +1 -0
- package/lib/node/endpoint/password-token-response-client.d.ts +12 -0
- package/lib/node/endpoint/password-token-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/password-token-response-client.js +82 -0
- package/lib/node/endpoint/password-token-response-client.js.map +1 -0
- package/lib/node/endpoint/refresh-token-token-response-client.d.ts +12 -0
- package/lib/node/endpoint/refresh-token-token-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/refresh-token-token-response-client.js +87 -0
- package/lib/node/endpoint/refresh-token-token-response-client.js.map +1 -0
- package/lib/node/endpoint/user-response-client.d.ts +9 -0
- package/lib/node/endpoint/user-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/user-response-client.js +84 -0
- package/lib/node/endpoint/user-response-client.js.map +1 -0
- package/lib/node/error/error-hander.d.ts +11 -0
- package/lib/node/error/error-hander.d.ts.map +1 -0
- package/lib/node/error/error-hander.js +52 -0
- package/lib/node/error/error-hander.js.map +1 -0
- package/lib/node/error/error-protocol.d.ts +3 -0
- package/lib/node/error/error-protocol.d.ts.map +1 -0
- package/lib/node/error/error-protocol.js +7 -0
- package/lib/node/error/error-protocol.js.map +1 -0
- package/lib/node/error/error.d.ts +10 -0
- package/lib/node/error/error.d.ts.map +1 -0
- package/lib/node/error/error.js +23 -0
- package/lib/node/error/error.js.map +1 -0
- package/lib/node/error/index.d.ts +4 -0
- package/lib/node/error/index.d.ts.map +1 -0
- package/lib/node/error/index.js +20 -0
- package/lib/node/error/index.js.map +1 -0
- package/lib/node/index.d.ts +8 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +24 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/module.d.ts +4 -0
- package/lib/node/module.d.ts.map +1 -0
- package/lib/node/module.js +6 -0
- package/lib/node/module.js.map +1 -0
- package/lib/node/provider/index.d.ts +3 -0
- package/lib/node/provider/index.d.ts.map +1 -0
- package/lib/node/provider/index.js +19 -0
- package/lib/node/provider/index.js.map +1 -0
- package/lib/node/provider/provider-details-manager.d.ts +12 -0
- package/lib/node/provider/provider-details-manager.d.ts.map +1 -0
- package/lib/node/provider/provider-details-manager.js +50 -0
- package/lib/node/provider/provider-details-manager.js.map +1 -0
- package/lib/node/provider/provider-protocol.d.ts +21 -0
- package/lib/node/provider/provider-protocol.d.ts.map +1 -0
- package/lib/node/provider/provider-protocol.js +5 -0
- package/lib/node/provider/provider-protocol.js.map +1 -0
- package/lib/node/registration/id-token-jwt-decoder-facatory.d.ts +15 -0
- package/lib/node/registration/id-token-jwt-decoder-facatory.d.ts.map +1 -0
- package/lib/node/registration/id-token-jwt-decoder-facatory.js +89 -0
- package/lib/node/registration/id-token-jwt-decoder-facatory.js.map +1 -0
- package/lib/node/registration/index.d.ts +5 -0
- package/lib/node/registration/index.d.ts.map +1 -0
- package/lib/node/registration/index.js +21 -0
- package/lib/node/registration/index.js.map +1 -0
- package/lib/node/registration/jws-algorithm-resolver.d.ts +5 -0
- package/lib/node/registration/jws-algorithm-resolver.d.ts.map +1 -0
- package/lib/node/registration/jws-algorithm-resolver.js +22 -0
- package/lib/node/registration/jws-algorithm-resolver.js.map +1 -0
- package/lib/node/registration/registration-manager.d.ts +15 -0
- package/lib/node/registration/registration-manager.d.ts.map +1 -0
- package/lib/node/registration/registration-manager.js +64 -0
- package/lib/node/registration/registration-manager.js.map +1 -0
- package/lib/node/registration/registration-protocol.d.ts +22 -0
- package/lib/node/registration/registration-protocol.d.ts.map +1 -0
- package/lib/node/registration/registration-protocol.js +7 -0
- package/lib/node/registration/registration-protocol.js.map +1 -0
- package/lib/node/user/index.d.ts +4 -0
- package/lib/node/user/index.d.ts.map +1 -0
- package/lib/node/user/index.js +20 -0
- package/lib/node/user/index.js.map +1 -0
- package/lib/node/user/oauth2-user-service.d.ts +10 -0
- package/lib/node/user/oauth2-user-service.d.ts.map +1 -0
- package/lib/node/user/oauth2-user-service.js +61 -0
- package/lib/node/user/oauth2-user-service.js.map +1 -0
- package/lib/node/user/oidc-user-service.d.ts +13 -0
- package/lib/node/user/oidc-user-service.d.ts.map +1 -0
- package/lib/node/user/oidc-user-service.js +98 -0
- package/lib/node/user/oidc-user-service.js.map +1 -0
- package/lib/node/user/user-protocol.d.ts +6 -0
- package/lib/node/user/user-protocol.d.ts.map +1 -0
- package/lib/node/user/user-protocol.js +3 -0
- package/lib/node/user/user-protocol.js.map +1 -0
- package/lib/node/utils/authorization-grant-request-entity-util.d.ts +10 -0
- package/lib/node/utils/authorization-grant-request-entity-util.d.ts.map +1 -0
- package/lib/node/utils/authorization-grant-request-entity-util.js +28 -0
- package/lib/node/utils/authorization-grant-request-entity-util.js.map +1 -0
- package/lib/node/utils/authorization-response-util.d.ts +8 -0
- package/lib/node/utils/authorization-response-util.d.ts.map +1 -0
- package/lib/node/utils/authorization-response-util.js +53 -0
- package/lib/node/utils/authorization-response-util.js.map +1 -0
- package/lib/node/utils/index.d.ts +3 -0
- package/lib/node/utils/index.d.ts.map +1 -0
- package/lib/node/utils/index.js +19 -0
- package/lib/node/utils/index.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +4 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +51 -0
- package/src/node/authentication/authentication-protocol.ts +26 -0
- package/src/node/authentication/index.ts +3 -0
- package/src/node/authentication/oauth2-authentication-provider.ts +163 -0
- package/src/node/authentication/oidc-authentication-provider.ts +60 -0
- package/src/node/authorization/authorization-code-authorized-client-provider.ts +16 -0
- package/src/node/authorization/authorization-code-grant-middleware.ts +110 -0
- package/src/node/authorization/authorization-failure-handler.ts +23 -0
- package/src/node/authorization/authorization-protocol.ts +104 -0
- package/src/node/authorization/authorization-request-manager.ts +54 -0
- package/src/node/authorization/authorization-request-redirect-middleware.ts +91 -0
- package/src/node/authorization/authorization-request-resolver.ts +149 -0
- package/src/node/authorization/authorization-success-handler.ts +15 -0
- package/src/node/authorization/authorized-client-manager.ts +35 -0
- package/src/node/authorization/authorized-client-service.ts +73 -0
- package/src/node/authorization/client-credentials-authorized-client-provider.ts +61 -0
- package/src/node/authorization/context-attributes-mapper.ts +18 -0
- package/src/node/authorization/index.ts +13 -0
- package/src/node/authorization/password-authorized-client-provider.ts +78 -0
- package/src/node/authorization/refresh-token-authorized-client-provider.ts +58 -0
- package/src/node/constants.ts +4 -0
- package/src/node/endpoint/authorization-code-token-response-client.ts +73 -0
- package/src/node/endpoint/client-credentials-token-response-client.ts +69 -0
- package/src/node/endpoint/endpoint-protocol.ts +55 -0
- package/src/node/endpoint/index.ts +6 -0
- package/src/node/endpoint/password-token-response-client.ts +71 -0
- package/src/node/endpoint/refresh-token-token-response-client.ts +77 -0
- package/src/node/endpoint/user-response-client.ts +72 -0
- package/src/node/error/error-hander.ts +39 -0
- package/src/node/error/error-protocol.ts +6 -0
- package/src/node/error/error.ts +19 -0
- package/src/node/error/index.ts +3 -0
- package/src/node/index.ts +7 -0
- package/src/node/module.ts +4 -0
- package/src/node/provider/index.ts +2 -0
- package/src/node/provider/provider-details-manager.ts +33 -0
- package/src/node/provider/provider-protocol.ts +24 -0
- package/src/node/registration/id-token-jwt-decoder-facatory.ts +71 -0
- package/src/node/registration/index.ts +4 -0
- package/src/node/registration/jws-algorithm-resolver.ts +12 -0
- package/src/node/registration/registration-manager.ts +47 -0
- package/src/node/registration/registration-protocol.ts +27 -0
- package/src/node/user/index.ts +3 -0
- package/src/node/user/oauth2-user-service.ts +50 -0
- package/src/node/user/oidc-user-service.ts +92 -0
- package/src/node/user/user-protocol.ts +6 -0
- package/src/node/utils/authorization-grant-request-entity-util.ts +26 -0
- package/src/node/utils/authorization-response-util.ts +50 -0
- package/src/node/utils/index.ts +2 -0
- package/src/package.spec.ts +4 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PasswordTokenResponseClient = void 0;
|
|
13
|
+
const endpoint_protocol_1 = require("./endpoint-protocol");
|
|
14
|
+
const core_1 = require("@celljs/core");
|
|
15
|
+
const http_1 = require("@celljs/http");
|
|
16
|
+
const provider_1 = require("../provider");
|
|
17
|
+
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
18
|
+
const utils_1 = require("../utils");
|
|
19
|
+
const qs = require("qs");
|
|
20
|
+
let PasswordTokenResponseClient = class PasswordTokenResponseClient {
|
|
21
|
+
async getTokenResponse(passwordGrantRequest) {
|
|
22
|
+
const { clientRegistration } = passwordGrantRequest;
|
|
23
|
+
const providerDetails = await this.providerDetailsManager.get(clientRegistration.provider);
|
|
24
|
+
let response;
|
|
25
|
+
try {
|
|
26
|
+
response = await this.restOperations.post(providerDetails.tokenUri, this.buildFormParameters(passwordGrantRequest), {
|
|
27
|
+
headers: utils_1.AuthorizationGrantRequestEntityUtil.getTokenRequestHeaders(clientRegistration)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const oauth2Error = {
|
|
32
|
+
errorCode: endpoint_protocol_1.INVALID_TOKEN_RESPONSE_ERROR_CODE,
|
|
33
|
+
description: `An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: ${(error === null || error === void 0 ? void 0 : error.message) || error}`
|
|
34
|
+
};
|
|
35
|
+
throw new oauth2_core_1.OAuth2AuthorizationError(oauth2Error, error);
|
|
36
|
+
}
|
|
37
|
+
const { data } = response;
|
|
38
|
+
const acccessTokenResponse = this.accessTokenResponseConverter.convert(data);
|
|
39
|
+
if (!acccessTokenResponse.accessToken.scopes || acccessTokenResponse.accessToken.scopes.length === 0) {
|
|
40
|
+
// As per spec, in Section 5.1 Successful Access Token Response
|
|
41
|
+
// https://tools.ietf.org/html/rfc6749#section-5.1
|
|
42
|
+
// If AccessTokenResponse.scope is empty, then default to the scope
|
|
43
|
+
// originally requested by the client in the Token Request
|
|
44
|
+
acccessTokenResponse.accessToken.scopes = clientRegistration.scopes;
|
|
45
|
+
}
|
|
46
|
+
return acccessTokenResponse;
|
|
47
|
+
}
|
|
48
|
+
buildFormParameters(passwordGrantRequest) {
|
|
49
|
+
const { clientRegistration, authorizationGrantType, username, password } = passwordGrantRequest;
|
|
50
|
+
const formParameters = {
|
|
51
|
+
[oauth2_core_1.OAuth2ParameterNames.GRANT_TYPE]: authorizationGrantType,
|
|
52
|
+
[oauth2_core_1.OAuth2ParameterNames.USERNAME]: username,
|
|
53
|
+
[oauth2_core_1.OAuth2ParameterNames.PASSWORD]: password
|
|
54
|
+
};
|
|
55
|
+
const { clientAuthenticationMethod, clientId, clientSecret, scopes } = clientRegistration;
|
|
56
|
+
if (scopes) {
|
|
57
|
+
formParameters[oauth2_core_1.OAuth2ParameterNames.SCOPE] = scopes.join(' ');
|
|
58
|
+
}
|
|
59
|
+
if (oauth2_core_1.ClientAuthenticationMethod.Post === clientAuthenticationMethod) {
|
|
60
|
+
formParameters[oauth2_core_1.OAuth2ParameterNames.CLIENT_ID] = clientId;
|
|
61
|
+
formParameters[oauth2_core_1.OAuth2ParameterNames.CLIENT_SECRET] = clientSecret;
|
|
62
|
+
}
|
|
63
|
+
return qs.stringify(formParameters);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, core_1.Autowired)(http_1.RestOperations),
|
|
68
|
+
__metadata("design:type", Function)
|
|
69
|
+
], PasswordTokenResponseClient.prototype, "restOperations", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, core_1.Autowired)(provider_1.ProviderDetailsManager),
|
|
72
|
+
__metadata("design:type", Object)
|
|
73
|
+
], PasswordTokenResponseClient.prototype, "providerDetailsManager", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, core_1.Autowired)(oauth2_core_1.AccessTokenResponseConverter),
|
|
76
|
+
__metadata("design:type", oauth2_core_1.AccessTokenResponseConverter)
|
|
77
|
+
], PasswordTokenResponseClient.prototype, "accessTokenResponseConverter", void 0);
|
|
78
|
+
PasswordTokenResponseClient = __decorate([
|
|
79
|
+
(0, core_1.Component)()
|
|
80
|
+
], PasswordTokenResponseClient);
|
|
81
|
+
exports.PasswordTokenResponseClient = PasswordTokenResponseClient;
|
|
82
|
+
//# sourceMappingURL=password-token-response-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-token-response-client.js","sourceRoot":"","sources":["../../../src/node/endpoint/password-token-response-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAyH;AACzH,uCAAoD;AACpD,uCAA8C;AAC9C,0CAAqD;AACrD,qDAAiL;AACjL,oCAA+D;AAC/D,yBAAyB;AAGlB,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAWpC,KAAK,CAAC,gBAAgB,CAAC,oBAA0C;QAC7D,MAAM,EAAE,kBAAkB,EAAE,GAAG,oBAAoB,CAAC;QACpD,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAE3F,IAAI,QAAQ,CAAC;QACb,IAAI;YACA,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,eAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,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,EAAE;YACR,cAAc,CAAC,kCAAoB,CAAC,KAAK,CAAC,GAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAClE;QACD,IAAI,wCAA0B,CAAC,IAAI,KAAK,0BAA0B,EAAE;YAChE,cAAc,CAAC,kCAAoB,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;YAC1D,cAAc,CAAC,kCAAoB,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;SACrE;QACD,OAAO,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;CAEJ,CAAA;AA3DG;IAAC,IAAA,gBAAS,EAAC,qBAAc,CAAC;;mEACwB;AAElD;IAAC,IAAA,gBAAS,EAAC,iCAAsB,CAAC;;2EACgC;AAElE;IAAC,IAAA,gBAAS,EAAC,0CAA4B,CAAC;8BACS,0CAA4B;iFAAC;AATrE,2BAA2B;IADvC,IAAA,gBAAS,GAAE;GACC,2BAA2B,CA6DvC;AA7DY,kEAA2B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AccessTokenResponseClient, RefreshTokenGrantRequest } from './endpoint-protocol';
|
|
2
|
+
import { RestOperations } from '@celljs/http';
|
|
3
|
+
import { ProviderDetailsManager } from '../provider';
|
|
4
|
+
import { AccessTokenResponse, AccessTokenResponseConverter } from '@celljs/oauth2-core';
|
|
5
|
+
export declare class RefreshTokenTokenResponseClient implements AccessTokenResponseClient<RefreshTokenGrantRequest> {
|
|
6
|
+
protected readonly restOperations: RestOperations;
|
|
7
|
+
protected readonly providerDetailsManager: ProviderDetailsManager;
|
|
8
|
+
protected readonly accessTokenResponseConverter: AccessTokenResponseConverter;
|
|
9
|
+
getTokenResponse(refreshTokenGrantRequest: RefreshTokenGrantRequest): Promise<AccessTokenResponse>;
|
|
10
|
+
protected buildFormParameters(refreshTokenGrantRequest: RefreshTokenGrantRequest): string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=refresh-token-token-response-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh-token-token-response-client.d.ts","sourceRoot":"","sources":["../../../src/node/endpoint/refresh-token-token-response-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAqC,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE7H,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAA2F,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAIjL,qBACa,+BAAgC,YAAW,yBAAyB,CAAC,wBAAwB,CAAC;IAGvG,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAGlE,SAAS,CAAC,QAAQ,CAAC,4BAA4B,EAAE,4BAA4B,CAAC;IAExE,gBAAgB,CAAC,wBAAwB,EAAE,wBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAuCxG,SAAS,CAAC,mBAAmB,CAAC,wBAAwB,EAAE,wBAAwB;CAiBnF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RefreshTokenTokenResponseClient = void 0;
|
|
13
|
+
const endpoint_protocol_1 = require("./endpoint-protocol");
|
|
14
|
+
const core_1 = require("@celljs/core");
|
|
15
|
+
const http_1 = require("@celljs/http");
|
|
16
|
+
const provider_1 = require("../provider");
|
|
17
|
+
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
18
|
+
const utils_1 = require("../utils");
|
|
19
|
+
const qs = require("qs");
|
|
20
|
+
let RefreshTokenTokenResponseClient = class RefreshTokenTokenResponseClient {
|
|
21
|
+
async getTokenResponse(refreshTokenGrantRequest) {
|
|
22
|
+
const { clientRegistration, refreshToken, accessToken } = refreshTokenGrantRequest;
|
|
23
|
+
const providerDetails = await this.providerDetailsManager.get(clientRegistration.provider);
|
|
24
|
+
let response;
|
|
25
|
+
try {
|
|
26
|
+
response = await this.restOperations.post(providerDetails.tokenUri, this.buildFormParameters(refreshTokenGrantRequest), {
|
|
27
|
+
headers: utils_1.AuthorizationGrantRequestEntityUtil.getTokenRequestHeaders(clientRegistration)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const oauth2Error = {
|
|
32
|
+
errorCode: endpoint_protocol_1.INVALID_TOKEN_RESPONSE_ERROR_CODE,
|
|
33
|
+
description: `An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: ${(error === null || error === void 0 ? void 0 : error.message) || error}`
|
|
34
|
+
};
|
|
35
|
+
throw new oauth2_core_1.OAuth2AuthorizationError(oauth2Error, error);
|
|
36
|
+
}
|
|
37
|
+
const { data } = response;
|
|
38
|
+
const acccessTokenResponse = this.accessTokenResponseConverter.convert(data);
|
|
39
|
+
if (!acccessTokenResponse.accessToken.scopes || acccessTokenResponse.accessToken.scopes.length === 0) {
|
|
40
|
+
// As per spec, in Section 5.1 Successful Access Token Response
|
|
41
|
+
// https://tools.ietf.org/html/rfc6749#section-5.1
|
|
42
|
+
// If AccessTokenResponse.scope is empty, then default to the scope
|
|
43
|
+
// originally requested by the client in the Token Request
|
|
44
|
+
acccessTokenResponse.accessToken.scopes = accessToken.scopes;
|
|
45
|
+
}
|
|
46
|
+
if (!acccessTokenResponse.refreshToken) {
|
|
47
|
+
acccessTokenResponse.refreshToken = {
|
|
48
|
+
issuedAt: Date.now(),
|
|
49
|
+
tokenValue: refreshToken.tokenValue
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return acccessTokenResponse;
|
|
53
|
+
}
|
|
54
|
+
buildFormParameters(refreshTokenGrantRequest) {
|
|
55
|
+
const { clientRegistration, authorizationGrantType, refreshToken, scopes } = refreshTokenGrantRequest;
|
|
56
|
+
const formParameters = {
|
|
57
|
+
[oauth2_core_1.OAuth2ParameterNames.GRANT_TYPE]: authorizationGrantType,
|
|
58
|
+
[oauth2_core_1.OAuth2ParameterNames.REFRESH_TOKEN]: refreshToken.tokenValue
|
|
59
|
+
};
|
|
60
|
+
if (scopes) {
|
|
61
|
+
formParameters[oauth2_core_1.OAuth2ParameterNames.SCOPE] = scopes.join(' ');
|
|
62
|
+
}
|
|
63
|
+
const { clientAuthenticationMethod, clientId, clientSecret } = clientRegistration;
|
|
64
|
+
if (oauth2_core_1.ClientAuthenticationMethod.Post === clientAuthenticationMethod) {
|
|
65
|
+
formParameters[oauth2_core_1.OAuth2ParameterNames.CLIENT_ID] = clientId;
|
|
66
|
+
formParameters[oauth2_core_1.OAuth2ParameterNames.CLIENT_SECRET] = clientSecret;
|
|
67
|
+
}
|
|
68
|
+
return qs.stringify(formParameters);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, core_1.Autowired)(http_1.RestOperations),
|
|
73
|
+
__metadata("design:type", Function)
|
|
74
|
+
], RefreshTokenTokenResponseClient.prototype, "restOperations", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, core_1.Autowired)(provider_1.ProviderDetailsManager),
|
|
77
|
+
__metadata("design:type", Object)
|
|
78
|
+
], RefreshTokenTokenResponseClient.prototype, "providerDetailsManager", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, core_1.Autowired)(oauth2_core_1.AccessTokenResponseConverter),
|
|
81
|
+
__metadata("design:type", oauth2_core_1.AccessTokenResponseConverter)
|
|
82
|
+
], RefreshTokenTokenResponseClient.prototype, "accessTokenResponseConverter", void 0);
|
|
83
|
+
RefreshTokenTokenResponseClient = __decorate([
|
|
84
|
+
(0, core_1.Component)()
|
|
85
|
+
], RefreshTokenTokenResponseClient);
|
|
86
|
+
exports.RefreshTokenTokenResponseClient = RefreshTokenTokenResponseClient;
|
|
87
|
+
//# sourceMappingURL=refresh-token-token-response-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh-token-token-response-client.js","sourceRoot":"","sources":["../../../src/node/endpoint/refresh-token-token-response-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAA6H;AAC7H,uCAAoD;AACpD,uCAA8C;AAC9C,0CAAqD;AACrD,qDAAiL;AACjL,oCAA+D;AAC/D,yBAAyB;AAGlB,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAWxC,KAAK,CAAC,gBAAgB,CAAC,wBAAkD;QACrE,MAAM,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,wBAAwB,CAAC;QACnF,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAE3F,IAAI,QAAQ,CAAC;QACb,IAAI;YACA,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,eAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,wBAAwB,CAAC,EAAE;gBAChJ,OAAO,EAAE,2CAAmC,CAAC,sBAAsB,CAAC,k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GAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAClE;QACD,MAAM,EAAE,0BAA0B,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,kBAAkB,CAAC;QAClF,IAAI,wCAA0B,CAAC,IAAI,KAAK,0BAA0B,EAAE;YAChE,cAAc,CAAC,kCAAoB,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;YAC1D,cAAc,CAAC,kCAAoB,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;SACrE;QACD,OAAO,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;CAEJ,CAAA;AAjEG;IAAC,IAAA,gBAAS,EAAC,qBAAc,CAAC;;uEACwB;AAElD;IAAC,IAAA,gBAAS,EAAC,iCAAsB,CAAC;;+EACgC;AAElE;IAAC,IAAA,gBAAS,EAAC,0CAA4B,CAAC;8BACS,0CAA4B;qFAAC;AATrE,+BAA+B;IAD3C,IAAA,gBAAS,GAAE;GACC,+BAA+B,CAmE3C;AAnEY,0EAA+B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UserResponseClient, OAuth2UserRequest, OAuth2UserResponse } from './endpoint-protocol';
|
|
2
|
+
import { RestOperations } from '@celljs/http';
|
|
3
|
+
import { ProviderDetailsManager } from '../provider';
|
|
4
|
+
export declare class DefaultUserResponseClient implements UserResponseClient<OAuth2UserRequest> {
|
|
5
|
+
protected readonly restOperations: RestOperations;
|
|
6
|
+
protected readonly providerDetailsManager: ProviderDetailsManager;
|
|
7
|
+
getUserResponse(userRequest: OAuth2UserRequest): Promise<OAuth2UserResponse>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=user-response-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-response-client.d.ts","sourceRoot":"","sources":["../../../src/node/endpoint/user-response-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EACqC,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEnI,OAAO,EAAE,cAAc,EAAsC,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAKrD,qBACa,yBAA0B,YAAW,kBAAkB,CAAC,iBAAiB,CAAC;IAGnF,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAE5D,eAAe,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAqDrF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DefaultUserResponseClient = void 0;
|
|
13
|
+
const endpoint_protocol_1 = require("./endpoint-protocol");
|
|
14
|
+
const core_1 = require("@celljs/core");
|
|
15
|
+
const http_1 = require("@celljs/http");
|
|
16
|
+
const provider_1 = require("../provider");
|
|
17
|
+
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
18
|
+
const qs = require("qs");
|
|
19
|
+
let DefaultUserResponseClient = class DefaultUserResponseClient {
|
|
20
|
+
async getUserResponse(userRequest) {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
const { clientRegistration, accessToken } = userRequest;
|
|
23
|
+
const providerDetails = await this.providerDetailsManager.get(clientRegistration.provider);
|
|
24
|
+
if (!((_a = providerDetails === null || providerDetails === void 0 ? void 0 : providerDetails.userInfoEndpoint) === null || _a === void 0 ? void 0 : _a.uri)) {
|
|
25
|
+
throw new oauth2_core_1.OAuth2AuthenticationError({
|
|
26
|
+
errorCode: endpoint_protocol_1.MISSING_USER_INFO_URI_ERROR_CODE,
|
|
27
|
+
description: `Missing required UserInfo Uri in UserInfoEndpoint for Client Registration: ${clientRegistration.registrationId}`
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const userNameAttributeName = (_b = providerDetails === null || providerDetails === void 0 ? void 0 : providerDetails.userInfoEndpoint) === null || _b === void 0 ? void 0 : _b.userNameAttributeName;
|
|
31
|
+
if (!userNameAttributeName) {
|
|
32
|
+
throw new oauth2_core_1.OAuth2AuthenticationError({
|
|
33
|
+
errorCode: endpoint_protocol_1.MISSING_USER_NAME_ATTRIBUTE_ERROR_CODE,
|
|
34
|
+
description: `Missing required \"user name\" attribute name in UserInfoEndpoint for Client Registration: ${clientRegistration.registrationId}`
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
let response;
|
|
38
|
+
try {
|
|
39
|
+
const httpMethod = providerDetails.userInfoEndpoint.authenticationMethod === oauth2_core_1.AuthenticationMethod.Form ? http_1.HttpMethod.POST : http_1.HttpMethod.GET;
|
|
40
|
+
const config = {
|
|
41
|
+
url: (_c = providerDetails === null || providerDetails === void 0 ? void 0 : providerDetails.userInfoEndpoint) === null || _c === void 0 ? void 0 : _c.uri,
|
|
42
|
+
method: httpMethod,
|
|
43
|
+
headers: {
|
|
44
|
+
[http_1.HttpHeaders.ACCEPT]: http_1.MediaType.APPLICATION_JSON
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
if (httpMethod === http_1.HttpMethod.POST) {
|
|
48
|
+
config.headers[http_1.HttpHeaders.CONTENT_TYPE] = `${http_1.MediaType.APPLICATION_FORM_URLENCODED};charset=UTF-8`;
|
|
49
|
+
config.data = qs.stringify({
|
|
50
|
+
[oauth2_core_1.OAuth2ParameterNames.ACCESS_TOKEN]: accessToken.tokenValue
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
config.headers[http_1.HttpHeaders.AUTHORIZATION] = `Bearer ${accessToken.tokenValue}`;
|
|
55
|
+
}
|
|
56
|
+
response = await this.restOperations.request(config);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
const oauth2Error = {
|
|
60
|
+
errorCode: endpoint_protocol_1.INVALID_USER_INFO_RESPONSE_ERROR_CODE,
|
|
61
|
+
description: `An error occurred while attempting to retrieve the UserInfo Resource: ${(error === null || error === void 0 ? void 0 : error.message) || error}`
|
|
62
|
+
};
|
|
63
|
+
throw new oauth2_core_1.OAuth2AuthorizationError(oauth2Error, error);
|
|
64
|
+
}
|
|
65
|
+
const { data } = response;
|
|
66
|
+
return {
|
|
67
|
+
username: data[userNameAttributeName],
|
|
68
|
+
userAttributes: data
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, core_1.Autowired)(http_1.RestOperations),
|
|
74
|
+
__metadata("design:type", Function)
|
|
75
|
+
], DefaultUserResponseClient.prototype, "restOperations", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, core_1.Autowired)(provider_1.ProviderDetailsManager),
|
|
78
|
+
__metadata("design:type", Object)
|
|
79
|
+
], DefaultUserResponseClient.prototype, "providerDetailsManager", void 0);
|
|
80
|
+
DefaultUserResponseClient = __decorate([
|
|
81
|
+
(0, core_1.Component)(endpoint_protocol_1.UserResponseClient)
|
|
82
|
+
], DefaultUserResponseClient);
|
|
83
|
+
exports.DefaultUserResponseClient = DefaultUserResponseClient;
|
|
84
|
+
//# sourceMappingURL=user-response-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,yBAAyB;AAIlB,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,CAAC,CAAA,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,gBAAgB,0CAAE,GAAG,CAAA,EAAE;YACzC,MAAM,IAAI,uCAAyB,CAAC;gBAChC,SAAS,EAAE,oDAAgC;gBAC3C,WAAW,EAAE,8EAA8E,kBAAkB,CAAC,cAAc,EAAE;aACjI,CAAC,CAAC;SACN;QACD,MAAM,qBAAqB,GAAG,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,gBAAgB,0CAAE,qBAAqB,CAAC;QACvF,IAAI,CAAC,qBAAqB,EAAE;YACxB,MAAM,IAAI,uCAAyB,CAAC;gBAChC,SAAS,EAAE,0DAAsC;gBACjD,WAAW,EAAE,8FAA8F,kBAAkB,CAAC,cAAc,EAAE;aACjJ,CAAC,CAAC;SACN;QAED,IAAI,QAAQ,CAAC;QACb,IAAI;YACA,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;g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EACgC;AANzD,yBAAyB;IADrC,IAAA,gBAAS,EAAC,sCAAkB,CAAC;GACjB,yBAAyB,CA6DrC;AA7DY,8DAAyB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ErrorHandler, Context, RedirectStrategy } from '@celljs/web/lib/node';
|
|
2
|
+
import { OAuth2AuthorizationError, AuthorizationRequest } from '@celljs/oauth2-core';
|
|
3
|
+
import { AuthorizationRequestManager } from '../authorization';
|
|
4
|
+
export declare class OAuth2AuthorizationErrorHandler implements ErrorHandler {
|
|
5
|
+
readonly priority: number;
|
|
6
|
+
protected readonly redirectStrategy: RedirectStrategy;
|
|
7
|
+
protected readonly authorizationRequestManager: AuthorizationRequestManager<AuthorizationRequest>;
|
|
8
|
+
canHandle(ctx: Context, err: Error): Promise<boolean>;
|
|
9
|
+
handle(ctx: Context, err: OAuth2AuthorizationError): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=error-hander.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-hander.d.ts","sourceRoot":"","sources":["../../../src/node/error/error-hander.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;AAG/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;IAI/C,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CAiB3E"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OAuth2AuthorizationErrorHandler = void 0;
|
|
13
|
+
const error_protocol_1 = require("./error-protocol");
|
|
14
|
+
const node_1 = require("@celljs/web/lib/node");
|
|
15
|
+
const core_1 = require("@celljs/core");
|
|
16
|
+
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
17
|
+
const authorization_1 = require("../authorization");
|
|
18
|
+
const crypto_js_1 = require("crypto-js");
|
|
19
|
+
let OAuth2AuthorizationErrorHandler = class OAuth2AuthorizationErrorHandler {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.priority = error_protocol_1.OAUTH2_AUTHORIZATION_ERROR_HANDLER_PRIORITY;
|
|
22
|
+
}
|
|
23
|
+
canHandle(ctx, err) {
|
|
24
|
+
return Promise.resolve(err instanceof oauth2_core_1.OAuth2AuthorizationError);
|
|
25
|
+
}
|
|
26
|
+
async handle(ctx, err) {
|
|
27
|
+
const { oauth2Error } = err;
|
|
28
|
+
const authorizationRequest = await this.authorizationRequestManager.remove();
|
|
29
|
+
let redirectUri = `${authorizationRequest.redirectUri}?${oauth2_core_1.OAuth2ParameterNames.ERROR}=${oauth2Error.errorCode}`;
|
|
30
|
+
if (oauth2Error.description) {
|
|
31
|
+
redirectUri = `${redirectUri}&${oauth2_core_1.OAuth2ParameterNames.ERROR_DESCRIPTION}=${crypto_js_1.enc.Base64.stringify(crypto_js_1.enc.Utf8.parse(oauth2Error.description))}`;
|
|
32
|
+
}
|
|
33
|
+
if (oauth2Error.uri) {
|
|
34
|
+
redirectUri = `${redirectUri}&${oauth2_core_1.OAuth2ParameterNames.ERROR_URI}=${crypto_js_1.enc.Base64.stringify(crypto_js_1.enc.Utf8.parse(oauth2Error.uri))}`;
|
|
35
|
+
}
|
|
36
|
+
await this.redirectStrategy.send(redirectUri);
|
|
37
|
+
ctx.response.end(err.message);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, core_1.Autowired)(node_1.RedirectStrategy),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], OAuth2AuthorizationErrorHandler.prototype, "redirectStrategy", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, core_1.Autowired)(authorization_1.AuthorizationRequestManager),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], OAuth2AuthorizationErrorHandler.prototype, "authorizationRequestManager", void 0);
|
|
48
|
+
OAuth2AuthorizationErrorHandler = __decorate([
|
|
49
|
+
(0, core_1.Component)(node_1.ErrorHandler)
|
|
50
|
+
], OAuth2AuthorizationErrorHandler);
|
|
51
|
+
exports.OAuth2AuthorizationErrorHandler = OAuth2AuthorizationErrorHandler;
|
|
52
|
+
//# sourceMappingURL=error-hander.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-hander.js","sourceRoot":"","sources":["../../../src/node/error/error-hander.ts"],"names":[],"mappings":";;;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,gBAAS,EAAC,uBAAgB,CAAC;;yEAC0B;AAEtD;IAAC,IAAA,gBAAS,EAAC,2CAA2B,CAAC;;oFAC2D;AAPzF,+BAA+B;IAD3C,IAAA,gBAAS,EAAC,mBAAY,CAAC;GACX,+BAA+B,CA8B3C;AA9BY,0EAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/error/error-protocol.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2CAA2C,QAAoC,CAAC;AAE7F,eAAO,MAAM,wCAAwC,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLIENT_AUTHORIZATION_REQUIRED_ERROR_CODE = exports.OAUTH2_AUTHORIZATION_ERROR_HANDLER_PRIORITY = void 0;
|
|
4
|
+
const node_1 = require("@celljs/web/lib/node");
|
|
5
|
+
exports.OAUTH2_AUTHORIZATION_ERROR_HANDLER_PRIORITY = node_1.HTTP_ERROR_HANDLER_PRIORITY + 100;
|
|
6
|
+
exports.CLIENT_AUTHORIZATION_REQUIRED_ERROR_CODE = 'client_authorization_required';
|
|
7
|
+
//# sourceMappingURL=error-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-protocol.js","sourceRoot":"","sources":["../../../src/node/error/error-protocol.ts"],"names":[],"mappings":";;;AAAA,+CAAmE;AAEtD,QAAA,2CAA2C,GAAG,kCAA2B,GAAG,GAAG,CAAC;AAEhF,QAAA,wCAAwC,GAAG,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OAuth2AuthorizationError, OAuth2Error } from '@celljs/oauth2-core';
|
|
2
|
+
export declare class ClientAuthorizationError extends OAuth2AuthorizationError {
|
|
3
|
+
oauth2Error: OAuth2Error;
|
|
4
|
+
clientRegistrationId: string;
|
|
5
|
+
constructor(oauth2Error: OAuth2Error, clientRegistrationId: string, error?: Error);
|
|
6
|
+
}
|
|
7
|
+
export declare class ClientAuthorizationRequiredError extends ClientAuthorizationError {
|
|
8
|
+
constructor(clientRegistrationId: string);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/node/error/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG5E,qBAAa,wBAAyB,SAAQ,wBAAwB;IAEtC,WAAW,EAAE,WAAW;IAAS,oBAAoB,EAAE,MAAM;gBAA7D,WAAW,EAAE,WAAW,EAAS,oBAAoB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAI3G;AAED,qBAAa,gCAAiC,SAAQ,wBAAwB;gBAC9D,oBAAoB,EAAE,MAAM;CAM3C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientAuthorizationRequiredError = exports.ClientAuthorizationError = void 0;
|
|
4
|
+
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
5
|
+
const error_protocol_1 = require("./error-protocol");
|
|
6
|
+
class ClientAuthorizationError extends oauth2_core_1.OAuth2AuthorizationError {
|
|
7
|
+
constructor(oauth2Error, clientRegistrationId, error) {
|
|
8
|
+
super(oauth2Error, error);
|
|
9
|
+
this.oauth2Error = oauth2Error;
|
|
10
|
+
this.clientRegistrationId = clientRegistrationId;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ClientAuthorizationError = ClientAuthorizationError;
|
|
14
|
+
class ClientAuthorizationRequiredError extends ClientAuthorizationError {
|
|
15
|
+
constructor(clientRegistrationId) {
|
|
16
|
+
super({
|
|
17
|
+
errorCode: error_protocol_1.CLIENT_AUTHORIZATION_REQUIRED_ERROR_CODE,
|
|
18
|
+
description: `Authorization required for Client Registration Id: ${clientRegistrationId}`
|
|
19
|
+
}, clientRegistrationId);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ClientAuthorizationRequiredError = ClientAuthorizationRequiredError;
|
|
23
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/node/error/error.ts"],"names":[],"mappings":";;;AAAA,qDAA4E;AAC5E,qDAA4E;AAE5E,MAAa,wBAAyB,SAAQ,sCAAwB;IAElE,YAA4B,WAAwB,EAAS,oBAA4B,EAAE,KAAa;QACpG,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QADF,gBAAW,GAAX,WAAW,CAAa;QAAS,yBAAoB,GAApB,oBAAoB,CAAQ;IAEzF,CAAC;CAEJ;AAND,4DAMC;AAED,MAAa,gCAAiC,SAAQ,wBAAwB;IAC1E,YAAY,oBAA4B;QACpC,KAAK,CAAC;YACF,SAAS,EAAE,yDAAwC;YACnD,WAAW,EAAE,sDAAsD,oBAAoB,EAAE;SAC5F,EAAE,oBAAoB,CAAC,CAAC;IAC7B,CAAC;CACJ;AAPD,4EAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./error-hander"), exports);
|
|
18
|
+
__exportStar(require("./error-protocol"), exports);
|
|
19
|
+
__exportStar(require("./error"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,mDAAiC;AACjC,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./registration"), exports);
|
|
18
|
+
__exportStar(require("./provider"), exports);
|
|
19
|
+
__exportStar(require("./authorization"), exports);
|
|
20
|
+
__exportStar(require("./authentication"), exports);
|
|
21
|
+
__exportStar(require("./endpoint"), exports);
|
|
22
|
+
__exportStar(require("./constants"), exports);
|
|
23
|
+
__exportStar(require("./user"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,6CAA2B;AAC3B,kDAAgC;AAChC,mDAAiC;AACjC,6CAA2B;AAC3B,8CAA4B;AAC5B,yCAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,CAAC;;AAEjB,wBAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,mBAAiB;AAEjB,kBAAe,IAAA,eAAQ,GAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./provider-protocol"), exports);
|
|
18
|
+
__exportStar(require("./provider-details-manager"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/provider/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,6DAA2C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ProviderDetailsManager, ProviderDetails } from './provider-protocol';
|
|
2
|
+
export declare class InMemoryProviderDetailsManager implements ProviderDetailsManager {
|
|
3
|
+
protected providers: {
|
|
4
|
+
[id: string]: ProviderDetails;
|
|
5
|
+
};
|
|
6
|
+
protected readonly providerTemplates: {
|
|
7
|
+
[id: string]: ProviderDetails;
|
|
8
|
+
};
|
|
9
|
+
protected initialized: boolean;
|
|
10
|
+
get(providerId: string): Promise<ProviderDetails | undefined>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=provider-details-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-details-manager.d.ts","sourceRoot":"","sources":["../../../src/node/provider/provider-details-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG9E,qBACa,8BAA+B,YAAW,sBAAsB;IAGzE,SAAS,CAAC,SAAS,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAM;IAG5D,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAM;IAE7E,SAAS,CAAC,WAAW,UAAS;IAExB,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;CAkBtE"}
|