@hed-hog/core 0.0.385 → 0.0.386
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/dist/app-command/app-command.registry.d.ts +2 -0
- package/dist/app-command/app-command.registry.d.ts.map +1 -1
- package/dist/app-command/app-command.registry.js.map +1 -1
- package/dist/auth/auth.controller.d.ts +22 -0
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +27 -0
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.service.d.ts +50 -0
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +108 -0
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/dto/complete-account.dto.d.ts +9 -0
- package/dist/auth/dto/complete-account.dto.d.ts.map +1 -0
- package/dist/auth/dto/complete-account.dto.js +43 -0
- package/dist/auth/dto/complete-account.dto.js.map +1 -0
- package/dist/authorize/authorize.controller.d.ts +45 -0
- package/dist/authorize/authorize.controller.d.ts.map +1 -0
- package/dist/authorize/authorize.controller.js +120 -0
- package/dist/authorize/authorize.controller.js.map +1 -0
- package/dist/authorize/authorize.module.d.ts +8 -0
- package/dist/authorize/authorize.module.d.ts.map +1 -0
- package/dist/authorize/authorize.module.js +36 -0
- package/dist/authorize/authorize.module.js.map +1 -0
- package/dist/authorize/authorize.service.d.ts +79 -0
- package/dist/authorize/authorize.service.d.ts.map +1 -0
- package/dist/authorize/authorize.service.js +196 -0
- package/dist/authorize/authorize.service.js.map +1 -0
- package/dist/authorize/dto/authorize-info.dto.d.ts +8 -0
- package/dist/authorize/dto/authorize-info.dto.d.ts.map +1 -0
- package/dist/authorize/dto/authorize-info.dto.js +42 -0
- package/dist/authorize/dto/authorize-info.dto.js.map +1 -0
- package/dist/authorize/dto/consent.dto.d.ts +8 -0
- package/dist/authorize/dto/consent.dto.d.ts.map +1 -0
- package/dist/authorize/dto/consent.dto.js +42 -0
- package/dist/authorize/dto/consent.dto.js.map +1 -0
- package/dist/authorize/dto/token.dto.d.ts +8 -0
- package/dist/authorize/dto/token.dto.d.ts.map +1 -0
- package/dist/authorize/dto/token.dto.js +42 -0
- package/dist/authorize/dto/token.dto.js.map +1 -0
- package/dist/challenge/challenge.service.d.ts +7 -0
- package/dist/challenge/challenge.service.d.ts.map +1 -1
- package/dist/challenge/challenge.service.js +22 -0
- package/dist/challenge/challenge.service.js.map +1 -1
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +2 -0
- package/dist/core.module.js.map +1 -1
- package/dist/file/file.service.d.ts +7 -0
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +16 -0
- package/dist/file/file.service.js.map +1 -1
- package/dist/integration-profile/integration-profile.secrets.d.ts +6 -2
- package/dist/integration-profile/integration-profile.secrets.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.secrets.js +11 -2
- package/dist/integration-profile/integration-profile.secrets.js.map +1 -1
- package/dist/integration-profile/integration-profile.service.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.service.js +18 -2
- package/dist/integration-profile/integration-profile.service.js.map +1 -1
- package/dist/integration-profile/integration-profile.utils.d.ts +10 -0
- package/dist/integration-profile/integration-profile.utils.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.utils.js +24 -1
- package/dist/integration-profile/integration-profile.utils.js.map +1 -1
- package/dist/oauth/interfaces/OAuthProvider.d.ts +1 -1
- package/dist/oauth/interfaces/OAuthProvider.d.ts.map +1 -1
- package/dist/oauth/oauth.controller.d.ts +26 -0
- package/dist/oauth/oauth.controller.d.ts.map +1 -1
- package/dist/oauth/oauth.controller.js +94 -0
- package/dist/oauth/oauth.controller.js.map +1 -1
- package/dist/oauth/oauth.service.d.ts +39 -1
- package/dist/oauth/oauth.service.d.ts.map +1 -1
- package/dist/oauth/oauth.service.js +115 -7
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/oauth/providers/microsoft-entra-id.provider.d.ts +5 -1
- package/dist/oauth/providers/microsoft-entra-id.provider.d.ts.map +1 -1
- package/dist/oauth/providers/microsoft-entra-id.provider.js +37 -6
- package/dist/oauth/providers/microsoft-entra-id.provider.js.map +1 -1
- package/dist/profile/profile.controller.d.ts +1 -1
- package/dist/profile/profile.service.d.ts +1 -1
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.js +7 -1
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
- package/hedhog/data/integration_provider.yaml +8 -0
- package/hedhog/data/integration_type.yaml +6 -0
- package/hedhog/data/mail.yaml +39 -0
- package/hedhog/data/route.yaml +12 -0
- package/hedhog/data/setting_group.yaml +15 -1
- package/hedhog/frontend/app/account/components/regenerate-codes-dialog.tsx.ejs +11 -7
- package/hedhog/frontend/app/account/components/verify-before-add-dialog.tsx.ejs +9 -7
- package/hedhog/frontend/app/account/hooks/use-mfa-setup.ts.ejs +6 -2
- package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +130 -34
- package/hedhog/frontend/messages/en.json +33 -1
- package/hedhog/frontend/messages/pt.json +33 -1
- package/package.json +10 -5
- package/src/app-command/app-command.registry.ts +2 -0
- package/src/auth/auth.controller.ts +21 -0
- package/src/auth/auth.service.ts +133 -0
- package/src/auth/dto/complete-account.dto.ts +24 -0
- package/src/authorize/authorize.controller.ts +99 -0
- package/src/authorize/authorize.module.ts +23 -0
- package/src/authorize/authorize.service.spec.ts +307 -0
- package/src/authorize/authorize.service.ts +245 -0
- package/src/authorize/dto/authorize-info.dto.ts +23 -0
- package/src/authorize/dto/consent.dto.ts +23 -0
- package/src/authorize/dto/token.dto.ts +23 -0
- package/src/challenge/challenge.service.ts +28 -0
- package/src/core.module.ts +2 -0
- package/src/file/file.service.ts +19 -0
- package/src/integration-profile/integration-profile.secrets.spec.ts +114 -0
- package/src/integration-profile/integration-profile.secrets.ts +11 -2
- package/src/integration-profile/integration-profile.service.ts +19 -0
- package/src/integration-profile/integration-profile.utils.ts +40 -0
- package/src/oauth/interfaces/OAuthProvider.ts +5 -1
- package/src/oauth/oauth.controller.ts +89 -0
- package/src/oauth/oauth.service.ts +190 -8
- package/src/oauth/providers/microsoft-entra-id.provider.ts +45 -5
- package/src/webhook-integration/webhook-integration.service.ts +18 -2
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AuthorizeController = void 0;
|
|
16
|
+
const api_1 = require("@hed-hog/api");
|
|
17
|
+
const api_locale_1 = require("@hed-hog/api-locale");
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const throttler_1 = require("@nestjs/throttler");
|
|
20
|
+
const authorize_service_1 = require("./authorize.service");
|
|
21
|
+
const authorize_info_dto_1 = require("./dto/authorize-info.dto");
|
|
22
|
+
const consent_dto_1 = require("./dto/consent.dto");
|
|
23
|
+
const token_dto_1 = require("./dto/token.dto");
|
|
24
|
+
/**
|
|
25
|
+
* Endpoints do fluxo Authorization Code + PKCE.
|
|
26
|
+
*
|
|
27
|
+
* Note o que NÃO existe aqui: um `GET /auth/authorize` que redireciona. O
|
|
28
|
+
* redirect final é feito pelo browser, na página de consent do admin, depois do
|
|
29
|
+
* POST /auth/authorize/consent. Assim toda a validação fica no servidor e o
|
|
30
|
+
* `code` não passa pelo mecanismo de redirect do Nest (nem pelos seus logs).
|
|
31
|
+
*/
|
|
32
|
+
let AuthorizeController = class AuthorizeController {
|
|
33
|
+
constructor(service) {
|
|
34
|
+
this.service = service;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Metadados para a tela de consent. Público: a página precisa validar os
|
|
38
|
+
* parâmetros e mostrar de quem é o app ANTES de exigir login.
|
|
39
|
+
*/
|
|
40
|
+
async authorizeInfo(query) {
|
|
41
|
+
return this.service.getAuthorizationInfo({
|
|
42
|
+
clientId: query.client_id,
|
|
43
|
+
redirectUri: query.redirect_uri,
|
|
44
|
+
scope: query.scope,
|
|
45
|
+
codeChallenge: query.code_challenge,
|
|
46
|
+
codeChallengeMethod: query.code_challenge_method,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/** O usuário logado aprova. O code sai vinculado a ele. */
|
|
50
|
+
async consent({ id }, body) {
|
|
51
|
+
const code = await this.service.issueCode({
|
|
52
|
+
userId: id,
|
|
53
|
+
clientId: body.client_id,
|
|
54
|
+
redirectUri: body.redirect_uri,
|
|
55
|
+
scope: body.scope,
|
|
56
|
+
codeChallenge: body.code_challenge,
|
|
57
|
+
codeChallengeMethod: body.code_challenge_method,
|
|
58
|
+
});
|
|
59
|
+
return { code };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Troca o code por tokens. Público por definição (o cliente ainda não tem
|
|
63
|
+
* token) — quem autentica é a posse do code + do code_verifier.
|
|
64
|
+
*
|
|
65
|
+
* Sem @Res() e sem cookie `rt`: o refreshToken vai no body. Um Set-Cookie aqui
|
|
66
|
+
* seria ruído para um cliente não-browser e um vetor de CSRF a mais.
|
|
67
|
+
*/
|
|
68
|
+
async token(body, locale, ipAddress, userAgent) {
|
|
69
|
+
return this.service.exchangeCode({
|
|
70
|
+
code: body.code,
|
|
71
|
+
codeVerifier: body.code_verifier,
|
|
72
|
+
clientId: body.client_id,
|
|
73
|
+
redirectUri: body.redirect_uri,
|
|
74
|
+
locale,
|
|
75
|
+
ipAddress,
|
|
76
|
+
userAgent,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.AuthorizeController = AuthorizeController;
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, api_1.Public)(),
|
|
83
|
+
(0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
|
|
84
|
+
(0, throttler_1.Throttle)({ default: { limit: 30, ttl: 60000 } }),
|
|
85
|
+
(0, common_1.Get)('authorize/info'),
|
|
86
|
+
__param(0, (0, common_1.Query)()),
|
|
87
|
+
__metadata("design:type", Function),
|
|
88
|
+
__metadata("design:paramtypes", [authorize_info_dto_1.AuthorizeInfoDTO]),
|
|
89
|
+
__metadata("design:returntype", Promise)
|
|
90
|
+
], AuthorizeController.prototype, "authorizeInfo", null);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, api_1.NoRole)(),
|
|
93
|
+
(0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
|
|
94
|
+
(0, throttler_1.Throttle)({ default: { limit: 10, ttl: 60000 } }),
|
|
95
|
+
(0, common_1.Post)('authorize/consent'),
|
|
96
|
+
__param(0, (0, api_1.User)()),
|
|
97
|
+
__param(1, (0, common_1.Body)()),
|
|
98
|
+
__metadata("design:type", Function),
|
|
99
|
+
__metadata("design:paramtypes", [Object, consent_dto_1.ConsentDTO]),
|
|
100
|
+
__metadata("design:returntype", Promise)
|
|
101
|
+
], AuthorizeController.prototype, "consent", null);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, api_1.Public)(),
|
|
104
|
+
(0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
|
|
105
|
+
(0, throttler_1.Throttle)({ default: { limit: 20, ttl: 60000 } }),
|
|
106
|
+
(0, common_1.Post)('token'),
|
|
107
|
+
__param(0, (0, common_1.Body)()),
|
|
108
|
+
__param(1, (0, api_locale_1.Locale)()),
|
|
109
|
+
__param(2, (0, common_1.Ip)()),
|
|
110
|
+
__param(3, (0, common_1.Headers)('user-agent')),
|
|
111
|
+
__metadata("design:type", Function),
|
|
112
|
+
__metadata("design:paramtypes", [token_dto_1.TokenDTO, String, String, String]),
|
|
113
|
+
__metadata("design:returntype", Promise)
|
|
114
|
+
], AuthorizeController.prototype, "token", null);
|
|
115
|
+
exports.AuthorizeController = AuthorizeController = __decorate([
|
|
116
|
+
(0, common_1.Controller)('auth'),
|
|
117
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => authorize_service_1.AuthorizeService))),
|
|
118
|
+
__metadata("design:paramtypes", [authorize_service_1.AuthorizeService])
|
|
119
|
+
], AuthorizeController);
|
|
120
|
+
//# sourceMappingURL=authorize.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.controller.js","sourceRoot":"","sources":["../../src/authorize/authorize.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAoD;AACpD,oDAA6C;AAC7C,2CAWwB;AACxB,iDAA6D;AAC7D,2DAAuD;AACvD,iEAA4D;AAC5D,mDAA+C;AAC/C,+CAA2C;AAE3C;;;;;;;GAOG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YAEmB,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;IACzC,CAAC;IAEJ;;;OAGG;IAKG,AAAN,KAAK,CAAC,aAAa,CAAU,KAAuB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;YACvC,QAAQ,EAAE,KAAK,CAAC,SAAS;YACzB,WAAW,EAAE,KAAK,CAAC,YAAY;YAC/B,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,aAAa,EAA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,CAAC;IACzB,IAAA,oBAAQ,EAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;IAChD,IAAA,aAAI,EAAC,mBAAmB,CAAC;IACX,WAAA,IAAA,UAAI,GAAE,CAAA;IAAU,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,wBAAU;;kDAWrD;AAaK;IAJL,IAAA,YAAM,GAAE;IACR,IAAA,kBAAS,EAAC,0BAAc,CAAC;IACzB,IAAA,oBAAQ,EAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;IAChD,IAAA,aAAI,EAAC,OAAO,CAAC;IAEX,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,mBAAM,GAAE,CAAA;IACR,WAAA,IAAA,WAAE,GAAE,CAAA;IACJ,WAAA,IAAA,gBAAO,EAAC,YAAY,CAAC,CAAA;;qCAHR,oBAAQ;;gDAcvB;8BApEU,mBAAmB;IAD/B,IAAA,mBAAU,EAAC,MAAM,CAAC;IAGd,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,oCAAgB,CAAC,CAAC,CAAA;qCACjB,oCAAgB;GAHjC,mBAAmB,CAqE/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Separado de OAuthModule de propósito: lá o HedHog é *client* de IdPs externos
|
|
3
|
+
* (Google, Apple...). Aqui ele é o *provider*. Misturar os dois confundiria dois
|
|
4
|
+
* papéis opostos no mesmo arquivo.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AuthorizeModule {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=authorize.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.module.d.ts","sourceRoot":"","sources":["../../src/authorize/authorize.module.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,qBAUa,eAAe;CAAG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AuthorizeModule = void 0;
|
|
10
|
+
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const auth_module_1 = require("../auth/auth.module");
|
|
13
|
+
const security_module_1 = require("../security/security.module");
|
|
14
|
+
const authorize_controller_1 = require("./authorize.controller");
|
|
15
|
+
const authorize_service_1 = require("./authorize.service");
|
|
16
|
+
/**
|
|
17
|
+
* Separado de OAuthModule de propósito: lá o HedHog é *client* de IdPs externos
|
|
18
|
+
* (Google, Apple...). Aqui ele é o *provider*. Misturar os dois confundiria dois
|
|
19
|
+
* papéis opostos no mesmo arquivo.
|
|
20
|
+
*/
|
|
21
|
+
let AuthorizeModule = class AuthorizeModule {
|
|
22
|
+
};
|
|
23
|
+
exports.AuthorizeModule = AuthorizeModule;
|
|
24
|
+
exports.AuthorizeModule = AuthorizeModule = __decorate([
|
|
25
|
+
(0, common_1.Module)({
|
|
26
|
+
imports: [
|
|
27
|
+
(0, common_1.forwardRef)(() => api_prisma_1.PrismaModule),
|
|
28
|
+
(0, common_1.forwardRef)(() => security_module_1.SecurityModule),
|
|
29
|
+
(0, common_1.forwardRef)(() => auth_module_1.AuthModule),
|
|
30
|
+
],
|
|
31
|
+
controllers: [authorize_controller_1.AuthorizeController],
|
|
32
|
+
providers: [authorize_service_1.AuthorizeService],
|
|
33
|
+
exports: [authorize_service_1.AuthorizeService],
|
|
34
|
+
})
|
|
35
|
+
], AuthorizeModule);
|
|
36
|
+
//# sourceMappingURL=authorize.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.module.js","sourceRoot":"","sources":["../../src/authorize/authorize.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAmD;AACnD,2CAAoD;AACpD,qDAAiD;AACjD,iEAA6D;AAC7D,iEAA6D;AAC7D,2DAAuD;AAEvD;;;;GAIG;AAWI,IAAM,eAAe,GAArB,MAAM,eAAe;CAAG,CAAA;AAAlB,0CAAe;0BAAf,eAAe;IAV3B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gCAAc,CAAC;YAChC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;SAC7B;QACD,WAAW,EAAE,CAAC,0CAAmB,CAAC;QAClC,SAAS,EAAE,CAAC,oCAAgB,CAAC;QAC7B,OAAO,EAAE,CAAC,oCAAgB,CAAC;KAC5B,CAAC;GACW,eAAe,CAAG"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
+
import { AuthService } from '../auth/auth.service';
|
|
3
|
+
import { SecurityService } from '../security/security.service';
|
|
4
|
+
/**
|
|
5
|
+
* Authorization Code + PKCE — o HedHog como OAuth *provider* para apps
|
|
6
|
+
* first-party (a extensão de navegador; e o que vier depois).
|
|
7
|
+
*
|
|
8
|
+
* Modelado no padrão `web ref` do OAuthService: token opaco de que só o hash é
|
|
9
|
+
* persistido, TTL curto e consumo single-use atômico via UPDATE ... RETURNING.
|
|
10
|
+
*
|
|
11
|
+
* Por que existe, em vez de reusar GET /auth/desktop-token: aquele fluxo entrega
|
|
12
|
+
* accessToken e refreshToken na URL do redirect, e aceita `?scheme=` sem
|
|
13
|
+
* allowlist (open redirect). Para um gerenciador de senhas isso não serve.
|
|
14
|
+
*/
|
|
15
|
+
export declare class AuthorizeService {
|
|
16
|
+
private readonly prisma;
|
|
17
|
+
private readonly security;
|
|
18
|
+
private readonly auth;
|
|
19
|
+
private readonly logger;
|
|
20
|
+
/** Curto de propósito: o code viaja na URL e só precisa sobreviver ao redirect. */
|
|
21
|
+
private readonly codeTtlMs;
|
|
22
|
+
constructor(prisma: PrismaService, security: SecurityService, auth: AuthService);
|
|
23
|
+
private getClient;
|
|
24
|
+
/**
|
|
25
|
+
* A allowlist é comparada por igualdade de string, não por parsing de URL:
|
|
26
|
+
* normalizar/parsear abriria espaço para bypass (barra final, case do host,
|
|
27
|
+
* userinfo, `origin` valendo "null" em esquemas não-http).
|
|
28
|
+
*/
|
|
29
|
+
private assertRedirectUri;
|
|
30
|
+
private assertScope;
|
|
31
|
+
/** Metadados para a tela de consent. Também valida antes de qualquer redirect. */
|
|
32
|
+
getAuthorizationInfo(params: {
|
|
33
|
+
clientId: string;
|
|
34
|
+
redirectUri: string;
|
|
35
|
+
scope: string;
|
|
36
|
+
codeChallenge: string;
|
|
37
|
+
codeChallengeMethod: string;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
clientName: string;
|
|
40
|
+
scopes: string[];
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* `plain` é rejeitado sem exceção: com ele o "verifier" viaja igual ao
|
|
44
|
+
* challenge e o PKCE não protege nada. O RFC 7636 permite; nós não.
|
|
45
|
+
*/
|
|
46
|
+
private assertPkce;
|
|
47
|
+
/** Emite o code já vinculado ao usuário da sessão que aprovou o consent. */
|
|
48
|
+
issueCode(params: {
|
|
49
|
+
userId: number;
|
|
50
|
+
clientId: string;
|
|
51
|
+
redirectUri: string;
|
|
52
|
+
scope: string;
|
|
53
|
+
codeChallenge: string;
|
|
54
|
+
codeChallengeMethod: string;
|
|
55
|
+
}): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Troca o code por tokens. O consumo é atômico (UPDATE ... WHERE consumed_at
|
|
58
|
+
* IS NULL RETURNING): dois requests concorrentes com o mesmo code — o caso de
|
|
59
|
+
* replay — só podem ter um vencedor, decidido pelo banco.
|
|
60
|
+
*/
|
|
61
|
+
exchangeCode(params: {
|
|
62
|
+
code: string;
|
|
63
|
+
codeVerifier: string;
|
|
64
|
+
clientId: string;
|
|
65
|
+
redirectUri: string;
|
|
66
|
+
locale: string;
|
|
67
|
+
ipAddress: string;
|
|
68
|
+
userAgent: string;
|
|
69
|
+
}): Promise<{
|
|
70
|
+
accessToken: string;
|
|
71
|
+
refreshToken: string;
|
|
72
|
+
tokenType: string;
|
|
73
|
+
expiresIn: number;
|
|
74
|
+
scope: string;
|
|
75
|
+
}>;
|
|
76
|
+
/** base64url(sha256(verifier)) === challenge, em tempo constante. */
|
|
77
|
+
private verifyPkce;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=authorize.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.service.d.ts","sourceRoot":"","sources":["../../src/authorize/authorize.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAS5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;;;;;;;;;GAUG;AACH,qBACa,gBAAgB;IAQzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAXvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAE5D,mFAAmF;IACnF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;gBAIjB,MAAM,EAAE,aAAa,EAErB,QAAQ,EAAE,eAAe,EAEzB,IAAI,EAAE,WAAW;YAGtB,SAAS;IAYvB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,WAAW;IAYnB,kFAAkF;IAC5E,oBAAoB,CAAC,MAAM,EAAE;QACjC,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;QACtB,mBAAmB,EAAE,MAAM,CAAC;KAC7B;;;;IAYD;;;OAGG;IACH,OAAO,CAAC,UAAU;IAclB,4EAA4E;IACtE,SAAS,CAAC,MAAM,EAAE;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;QACtB,mBAAmB,EAAE,MAAM,CAAC;KAC7B,GAAG,OAAO,CAAC,MAAM,CAAC;IA8BnB;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB;;;;;;;IAwDD,qEAAqE;IACrE,OAAO,CAAC,UAAU;CAiBnB"}
|
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var AuthorizeService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.AuthorizeService = void 0;
|
|
17
|
+
// `Prisma` vem de @hed-hog/api-prisma, não de '@prisma/client': o tsconfig do
|
|
18
|
+
// monorepo mapeia '@prisma/client' para o client gerado (.prisma/client), que
|
|
19
|
+
// não expõe o helper `Prisma.sql`. É a convenção do repo inteiro.
|
|
20
|
+
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
21
|
+
const common_1 = require("@nestjs/common");
|
|
22
|
+
const crypto_1 = require("crypto");
|
|
23
|
+
const auth_service_1 = require("../auth/auth.service");
|
|
24
|
+
const security_service_1 = require("../security/security.service");
|
|
25
|
+
/**
|
|
26
|
+
* Authorization Code + PKCE — o HedHog como OAuth *provider* para apps
|
|
27
|
+
* first-party (a extensão de navegador; e o que vier depois).
|
|
28
|
+
*
|
|
29
|
+
* Modelado no padrão `web ref` do OAuthService: token opaco de que só o hash é
|
|
30
|
+
* persistido, TTL curto e consumo single-use atômico via UPDATE ... RETURNING.
|
|
31
|
+
*
|
|
32
|
+
* Por que existe, em vez de reusar GET /auth/desktop-token: aquele fluxo entrega
|
|
33
|
+
* accessToken e refreshToken na URL do redirect, e aceita `?scheme=` sem
|
|
34
|
+
* allowlist (open redirect). Para um gerenciador de senhas isso não serve.
|
|
35
|
+
*/
|
|
36
|
+
let AuthorizeService = AuthorizeService_1 = class AuthorizeService {
|
|
37
|
+
constructor(prisma, security, auth) {
|
|
38
|
+
this.prisma = prisma;
|
|
39
|
+
this.security = security;
|
|
40
|
+
this.auth = auth;
|
|
41
|
+
this.logger = new common_1.Logger(AuthorizeService_1.name);
|
|
42
|
+
/** Curto de propósito: o code viaja na URL e só precisa sobreviver ao redirect. */
|
|
43
|
+
this.codeTtlMs = 60000;
|
|
44
|
+
}
|
|
45
|
+
async getClient(clientId) {
|
|
46
|
+
const client = await this.prisma.oauth_app_client.findUnique({
|
|
47
|
+
where: { client_id: clientId },
|
|
48
|
+
});
|
|
49
|
+
if (!client || !client.enabled) {
|
|
50
|
+
throw new common_1.BadRequestException('Aplicativo desconhecido ou desabilitado.');
|
|
51
|
+
}
|
|
52
|
+
return client;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A allowlist é comparada por igualdade de string, não por parsing de URL:
|
|
56
|
+
* normalizar/parsear abriria espaço para bypass (barra final, case do host,
|
|
57
|
+
* userinfo, `origin` valendo "null" em esquemas não-http).
|
|
58
|
+
*/
|
|
59
|
+
assertRedirectUri(client, redirectUri) {
|
|
60
|
+
const allowed = client.redirect_uris
|
|
61
|
+
.split('\n')
|
|
62
|
+
.map((uri) => uri.trim())
|
|
63
|
+
.filter(Boolean);
|
|
64
|
+
if (!allowed.includes(redirectUri)) {
|
|
65
|
+
throw new common_1.BadRequestException('redirect_uri não registrado para este aplicativo.');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
assertScope(client, scope) {
|
|
69
|
+
const granted = new Set(client.scopes.split(/[\s,]+/).filter(Boolean));
|
|
70
|
+
const requested = scope.split(/[\s,]+/).filter(Boolean);
|
|
71
|
+
if (requested.length === 0) {
|
|
72
|
+
throw new common_1.BadRequestException('scope é obrigatório.');
|
|
73
|
+
}
|
|
74
|
+
if (!requested.every((s) => granted.has(s))) {
|
|
75
|
+
throw new common_1.BadRequestException('scope não autorizado para este aplicativo.');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** Metadados para a tela de consent. Também valida antes de qualquer redirect. */
|
|
79
|
+
async getAuthorizationInfo(params) {
|
|
80
|
+
const client = await this.getClient(params.clientId);
|
|
81
|
+
this.assertRedirectUri(client, params.redirectUri);
|
|
82
|
+
this.assertScope(client, params.scope);
|
|
83
|
+
this.assertPkce(params.codeChallenge, params.codeChallengeMethod);
|
|
84
|
+
return {
|
|
85
|
+
clientName: client.name,
|
|
86
|
+
scopes: params.scope.split(/[\s,]+/).filter(Boolean),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* `plain` é rejeitado sem exceção: com ele o "verifier" viaja igual ao
|
|
91
|
+
* challenge e o PKCE não protege nada. O RFC 7636 permite; nós não.
|
|
92
|
+
*/
|
|
93
|
+
assertPkce(codeChallenge, method) {
|
|
94
|
+
if (method !== 'S256') {
|
|
95
|
+
throw new common_1.BadRequestException('code_challenge_method deve ser S256.');
|
|
96
|
+
}
|
|
97
|
+
if (!codeChallenge ||
|
|
98
|
+
codeChallenge.length < 43 ||
|
|
99
|
+
codeChallenge.length > 128 ||
|
|
100
|
+
!/^[A-Za-z0-9\-._~]+$/.test(codeChallenge)) {
|
|
101
|
+
throw new common_1.BadRequestException('code_challenge inválido.');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Emite o code já vinculado ao usuário da sessão que aprovou o consent. */
|
|
105
|
+
async issueCode(params) {
|
|
106
|
+
const client = await this.getClient(params.clientId);
|
|
107
|
+
this.assertRedirectUri(client, params.redirectUri);
|
|
108
|
+
this.assertScope(client, params.scope);
|
|
109
|
+
this.assertPkce(params.codeChallenge, params.codeChallengeMethod);
|
|
110
|
+
const code = this.security.randomOpaque(32);
|
|
111
|
+
const codeHash = this.security.hashSha256(code);
|
|
112
|
+
const expiresAt = new Date(Date.now() + this.codeTtlMs);
|
|
113
|
+
await this.prisma.oauth_authorization_code.create({
|
|
114
|
+
data: {
|
|
115
|
+
code_hash: codeHash,
|
|
116
|
+
client_id: params.clientId,
|
|
117
|
+
user_id: params.userId,
|
|
118
|
+
redirect_uri: params.redirectUri,
|
|
119
|
+
scope: params.scope,
|
|
120
|
+
code_challenge: params.codeChallenge,
|
|
121
|
+
code_challenge_method: 'S256',
|
|
122
|
+
expires_at: expiresAt,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
this.logger.debug(`[AuthorizeService] code emitido client=${params.clientId} userId=${params.userId}`);
|
|
126
|
+
return code;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Troca o code por tokens. O consumo é atômico (UPDATE ... WHERE consumed_at
|
|
130
|
+
* IS NULL RETURNING): dois requests concorrentes com o mesmo code — o caso de
|
|
131
|
+
* replay — só podem ter um vencedor, decidido pelo banco.
|
|
132
|
+
*/
|
|
133
|
+
async exchangeCode(params) {
|
|
134
|
+
const client = await this.getClient(params.clientId);
|
|
135
|
+
if (client.client_type !== 'public') {
|
|
136
|
+
throw new common_1.BadRequestException('Fluxo indisponível para este aplicativo.');
|
|
137
|
+
}
|
|
138
|
+
const codeHash = this.security.hashSha256(params.code);
|
|
139
|
+
const rows = await this.prisma.$queryRaw(api_prisma_1.Prisma.sql `
|
|
140
|
+
UPDATE oauth_authorization_code
|
|
141
|
+
SET consumed_at = NOW()
|
|
142
|
+
WHERE code_hash = ${codeHash}
|
|
143
|
+
AND client_id = ${params.clientId}
|
|
144
|
+
AND redirect_uri = ${params.redirectUri}
|
|
145
|
+
AND expires_at > NOW()
|
|
146
|
+
AND consumed_at IS NULL
|
|
147
|
+
RETURNING user_id, code_challenge, scope
|
|
148
|
+
`);
|
|
149
|
+
const row = rows[0];
|
|
150
|
+
if (!row) {
|
|
151
|
+
throw new common_1.BadRequestException('Código inválido, expirado ou já utilizado. Refaça a autorização.');
|
|
152
|
+
}
|
|
153
|
+
if (!this.verifyPkce(params.codeVerifier, row.code_challenge)) {
|
|
154
|
+
// O code já foi consumido acima — um verifier errado não dá segunda chance.
|
|
155
|
+
this.logger.warn(`[AuthorizeService] PKCE falhou client=${params.clientId} userId=${row.user_id}`);
|
|
156
|
+
throw new common_1.BadRequestException('code_verifier inválido.');
|
|
157
|
+
}
|
|
158
|
+
const { accessToken, refreshToken } = await this.auth.getAuthenticationPayload(params.locale, row.user_id, params.ipAddress, params.userAgent);
|
|
159
|
+
return {
|
|
160
|
+
accessToken,
|
|
161
|
+
refreshToken,
|
|
162
|
+
tokenType: 'Bearer',
|
|
163
|
+
// Informativo para o cliente agendar refresh; a verdade é o exp do JWT.
|
|
164
|
+
expiresIn: 3600,
|
|
165
|
+
scope: row.scope,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/** base64url(sha256(verifier)) === challenge, em tempo constante. */
|
|
169
|
+
verifyPkce(codeVerifier, codeChallenge) {
|
|
170
|
+
if (!codeVerifier || codeVerifier.length < 43 || codeVerifier.length > 128) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
// hashSha256 já devolve base64url — o mesmo formato do S256.
|
|
174
|
+
const expected = Buffer.from(this.security.hashSha256(codeVerifier));
|
|
175
|
+
const provided = Buffer.from(codeChallenge);
|
|
176
|
+
if (expected.length !== provided.length)
|
|
177
|
+
return false;
|
|
178
|
+
try {
|
|
179
|
+
return (0, crypto_1.timingSafeEqual)(expected, provided);
|
|
180
|
+
}
|
|
181
|
+
catch (_a) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
exports.AuthorizeService = AuthorizeService;
|
|
187
|
+
exports.AuthorizeService = AuthorizeService = AuthorizeService_1 = __decorate([
|
|
188
|
+
(0, common_1.Injectable)(),
|
|
189
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_prisma_1.PrismaService))),
|
|
190
|
+
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => security_service_1.SecurityService))),
|
|
191
|
+
__param(2, (0, common_1.Inject)((0, common_1.forwardRef)(() => auth_service_1.AuthService))),
|
|
192
|
+
__metadata("design:paramtypes", [api_prisma_1.PrismaService,
|
|
193
|
+
security_service_1.SecurityService,
|
|
194
|
+
auth_service_1.AuthService])
|
|
195
|
+
], AuthorizeService);
|
|
196
|
+
//# sourceMappingURL=authorize.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.service.js","sourceRoot":"","sources":["../../src/authorize/authorize.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,kEAAkE;AAClE,oDAA4D;AAC5D,2CAMwB;AACxB,mCAAyC;AACzC,uDAAmD;AACnD,mEAA+D;AAE/D;;;;;;;;;;GAUG;AAEI,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAM3B,YAEE,MAAsC,EAEtC,QAA0C,EAE1C,IAAkC;QAJjB,WAAM,GAAN,MAAM,CAAe;QAErB,aAAQ,GAAR,QAAQ,CAAiB;QAEzB,SAAI,GAAJ,IAAI,CAAa;QAXnB,WAAM,GAAG,IAAI,eAAM,CAAC,kBAAgB,CAAC,IAAI,CAAC,CAAC;QAE5D,mFAAmF;QAClE,cAAS,GAAG,KAAM,CAAC;IASjC,CAAC;IAEI,KAAK,CAAC,SAAS,CAAC,QAAgB;QACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC;YAC3D,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;SAC/B,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAC/B,MAAM,IAAI,4BAAmB,CAAC,0CAA0C,CAAC,CAAC;QAC5E,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACK,iBAAiB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AAC,WAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAzNY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAQR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,kCAAe,CAAC,CAAC,CAAA;IAEzC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAC,CAAA;qCAHb,0BAAa;QAEX,kCAAe;QAEnB,0BAAW;GAZzB,gBAAgB,CAyN5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize-info.dto.d.ts","sourceRoot":"","sources":["../../../src/authorize/dto/authorize-info.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IAG3B,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,CAAC;IAIrB,KAAK,EAAE,MAAM,CAAC;IAId,cAAc,EAAE,MAAM,CAAC;IAIvB,qBAAqB,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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.AuthorizeInfoDTO = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class AuthorizeInfoDTO {
|
|
15
|
+
}
|
|
16
|
+
exports.AuthorizeInfoDTO = AuthorizeInfoDTO;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], AuthorizeInfoDTO.prototype, "client_id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsString)(),
|
|
24
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], AuthorizeInfoDTO.prototype, "redirect_uri", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], AuthorizeInfoDTO.prototype, "scope", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AuthorizeInfoDTO.prototype, "code_challenge", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], AuthorizeInfoDTO.prototype, "code_challenge_method", void 0);
|
|
42
|
+
//# sourceMappingURL=authorize-info.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize-info.dto.js","sourceRoot":"","sources":["../../../src/authorize/dto/authorize-info.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,gBAAgB;CAoB5B;AApBD,4CAoBC;AAjBC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;mDACK;AAIlB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;sDACQ;AAIrB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;+CACC;AAId;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;wDACU;AAIvB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;+DACiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.dto.d.ts","sourceRoot":"","sources":["../../../src/authorize/dto/consent.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,UAAU;IAGrB,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,CAAC;IAIrB,KAAK,EAAE,MAAM,CAAC;IAId,cAAc,EAAE,MAAM,CAAC;IAIvB,qBAAqB,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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.ConsentDTO = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class ConsentDTO {
|
|
15
|
+
}
|
|
16
|
+
exports.ConsentDTO = ConsentDTO;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], ConsentDTO.prototype, "client_id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsString)(),
|
|
24
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], ConsentDTO.prototype, "redirect_uri", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], ConsentDTO.prototype, "scope", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], ConsentDTO.prototype, "code_challenge", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], ConsentDTO.prototype, "code_challenge_method", void 0);
|
|
42
|
+
//# sourceMappingURL=consent.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.dto.js","sourceRoot":"","sources":["../../../src/authorize/dto/consent.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,UAAU;CAoBtB;AApBD,gCAoBC;AAjBC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;6CACK;AAIlB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;gDACQ;AAIrB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yCACC;AAId;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;kDACU;AAIvB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yDACiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.dto.d.ts","sourceRoot":"","sources":["../../../src/authorize/dto/token.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,QAAQ;IAGnB,UAAU,EAAE,MAAM,CAAC;IAInB,IAAI,EAAE,MAAM,CAAC;IAIb,aAAa,EAAE,MAAM,CAAC;IAItB,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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.TokenDTO = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class TokenDTO {
|
|
15
|
+
}
|
|
16
|
+
exports.TokenDTO = TokenDTO;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
(0, class_validator_1.IsIn)(['authorization_code']),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], TokenDTO.prototype, "grant_type", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsString)(),
|
|
24
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], TokenDTO.prototype, "code", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], TokenDTO.prototype, "code_verifier", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], TokenDTO.prototype, "client_id", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], TokenDTO.prototype, "redirect_uri", void 0);
|
|
42
|
+
//# sourceMappingURL=token.dto.js.map
|