@seidor-cloud-produtos/orbit-backend-lib 0.0.41 → 0.0.43
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/clean-arch/infra/authorizations/authorization.d.ts +1 -0
- package/dist/clean-arch/infra/authorizations/authorization.js +3 -0
- package/dist/frameworks/express/authorizations/authorization-express.d.ts +1 -0
- package/dist/frameworks/express/authorizations/authorization-express.js +3 -0
- package/dist/infra/authorizations/validator/api/api-validator.d.ts +1 -0
- package/dist/infra/authorizations/validator/api/api-validator.js +10 -2
- package/package.json +1 -1
|
@@ -20,5 +20,8 @@ class Authorization extends api_validator_1.APIAuthValidator {
|
|
|
20
20
|
getAuthorizationsHeader() {
|
|
21
21
|
return this.controller.request.headers.authorizations;
|
|
22
22
|
}
|
|
23
|
+
getAuthsHeader() {
|
|
24
|
+
return this.controller.request.headers.auths;
|
|
25
|
+
}
|
|
23
26
|
}
|
|
24
27
|
exports.default = Authorization;
|
|
@@ -26,5 +26,8 @@ class AuthorizationExpress extends api_validator_1.APIAuthValidator {
|
|
|
26
26
|
getAuthorizationsHeader() {
|
|
27
27
|
return this.controller.request.headers.authorizations;
|
|
28
28
|
}
|
|
29
|
+
getAuthsHeader() {
|
|
30
|
+
return this.controller.request.headers.auths;
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
exports.default = AuthorizationExpress;
|
|
@@ -14,4 +14,5 @@ export declare abstract class APIAuthValidator extends AuthValidator {
|
|
|
14
14
|
protected abstract unauthorize(response: UnauthorizedResponse): any;
|
|
15
15
|
protected abstract getRequestId(): string;
|
|
16
16
|
protected abstract getAuthorizationsHeader(): string;
|
|
17
|
+
protected abstract getAuthsHeader(): string;
|
|
17
18
|
}
|
|
@@ -24,9 +24,17 @@ class APIAuthValidator extends auth_validator_1.default {
|
|
|
24
24
|
return this;
|
|
25
25
|
}
|
|
26
26
|
async getAuthorizations() {
|
|
27
|
-
const authorizations =
|
|
27
|
+
const authorizations =
|
|
28
|
+
this.getAuthorizationsHeader() || this.getAuthsHeader();
|
|
28
29
|
if (typeof authorizations === 'string') {
|
|
29
|
-
|
|
30
|
+
try {
|
|
31
|
+
return JSON.parse(authorizations);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.log('AuthorizationsHeader', this.getAuthorizationsHeader());
|
|
34
|
+
console.log('AuthsHeader', this.getAuthsHeader());
|
|
35
|
+
console.log('authorizations', authorizations);
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
39
|
return authorizations;
|
|
32
40
|
}
|