@nattyjs/core 0.0.1-beta.41 → 0.0.1-beta.42
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/index.cjs +3 -19
- package/dist/index.mjs +3 -19
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -930,7 +930,7 @@ class RequestProcessor extends RouteParser {
|
|
|
930
930
|
const authentication = this.getAuthenticationClass();
|
|
931
931
|
const authenticationFilter = authentication ? this.resolveFilter(authentication) : void 0;
|
|
932
932
|
const anonymousInfo = decoratorStateContainer.getInfo(this.routeInfo.controller.name, this.routeInfo.methodInfo.name, DecoratorType.anonymous);
|
|
933
|
-
if (!anonymousInfo && !authenticationFilter)
|
|
933
|
+
if (!anonymousInfo.controllerConfig && !anonymousInfo.methodConfig && !authenticationFilter)
|
|
934
934
|
throw new UnauthorizedAccessException(DENY_BY_DEFAULT);
|
|
935
935
|
if (authenticationFilter) {
|
|
936
936
|
const result = await authenticationFilter.onAuthentication(this.httpContext);
|
|
@@ -956,19 +956,8 @@ class RequestProcessor extends RouteParser {
|
|
|
956
956
|
throw new ForbiddenAccessException(authorizationFilter.onFailedAuthorization());
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
-
async
|
|
960
|
-
|
|
961
|
-
for (const actionFilter of actionFilters) {
|
|
962
|
-
const filter = this.resolveFilter(actionFilter);
|
|
963
|
-
this.actionFilterInstances.push(filter);
|
|
964
|
-
await filter.onActionExecuting(actionExecutingContext);
|
|
965
|
-
if (actionExecutingContext.result) {
|
|
966
|
-
return actionExecutingContext.result;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
return null;
|
|
970
|
-
}
|
|
971
|
-
getExecutingContext(methodParameters) {
|
|
959
|
+
async onActionExecuting(methodParameters) {
|
|
960
|
+
await this.onAuthorization(methodParameters);
|
|
972
961
|
let actionFilters = common.commonContainer.globalConfig.actionFilters || [];
|
|
973
962
|
const actionFiltersConfig = decoratorStateContainer.getInfo(this.routeInfo.controller.name, this.routeInfo.methodInfo.name, DecoratorType.useFilter);
|
|
974
963
|
actionFilters = [...actionFilters, ...actionFiltersConfig.controllerConfig?.actionFilters || [], ...actionFiltersConfig.methodConfig?.actionFilters || []];
|
|
@@ -977,11 +966,6 @@ class RequestProcessor extends RouteParser {
|
|
|
977
966
|
this.httpContext,
|
|
978
967
|
this.routeInfo
|
|
979
968
|
);
|
|
980
|
-
return { actionFilters, actionExecutingContext };
|
|
981
|
-
}
|
|
982
|
-
async onActionExecuting(methodParameters) {
|
|
983
|
-
await this.onAuthorization(methodParameters);
|
|
984
|
-
const { actionExecutingContext, actionFilters } = this.getExecutingContext(methodParameters);
|
|
985
969
|
for (const actionFilter of actionFilters) {
|
|
986
970
|
const filter = this.resolveFilter(actionFilter);
|
|
987
971
|
this.actionFilterInstances.push(filter);
|
package/dist/index.mjs
CHANGED
|
@@ -928,7 +928,7 @@ class RequestProcessor extends RouteParser {
|
|
|
928
928
|
const authentication = this.getAuthenticationClass();
|
|
929
929
|
const authenticationFilter = authentication ? this.resolveFilter(authentication) : void 0;
|
|
930
930
|
const anonymousInfo = decoratorStateContainer.getInfo(this.routeInfo.controller.name, this.routeInfo.methodInfo.name, DecoratorType.anonymous);
|
|
931
|
-
if (!anonymousInfo && !authenticationFilter)
|
|
931
|
+
if (!anonymousInfo.controllerConfig && !anonymousInfo.methodConfig && !authenticationFilter)
|
|
932
932
|
throw new UnauthorizedAccessException(DENY_BY_DEFAULT);
|
|
933
933
|
if (authenticationFilter) {
|
|
934
934
|
const result = await authenticationFilter.onAuthentication(this.httpContext);
|
|
@@ -954,19 +954,8 @@ class RequestProcessor extends RouteParser {
|
|
|
954
954
|
throw new ForbiddenAccessException(authorizationFilter.onFailedAuthorization());
|
|
955
955
|
}
|
|
956
956
|
}
|
|
957
|
-
async
|
|
958
|
-
|
|
959
|
-
for (const actionFilter of actionFilters) {
|
|
960
|
-
const filter = this.resolveFilter(actionFilter);
|
|
961
|
-
this.actionFilterInstances.push(filter);
|
|
962
|
-
await filter.onActionExecuting(actionExecutingContext);
|
|
963
|
-
if (actionExecutingContext.result) {
|
|
964
|
-
return actionExecutingContext.result;
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
return null;
|
|
968
|
-
}
|
|
969
|
-
getExecutingContext(methodParameters) {
|
|
957
|
+
async onActionExecuting(methodParameters) {
|
|
958
|
+
await this.onAuthorization(methodParameters);
|
|
970
959
|
let actionFilters = commonContainer.globalConfig.actionFilters || [];
|
|
971
960
|
const actionFiltersConfig = decoratorStateContainer.getInfo(this.routeInfo.controller.name, this.routeInfo.methodInfo.name, DecoratorType.useFilter);
|
|
972
961
|
actionFilters = [...actionFilters, ...actionFiltersConfig.controllerConfig?.actionFilters || [], ...actionFiltersConfig.methodConfig?.actionFilters || []];
|
|
@@ -975,11 +964,6 @@ class RequestProcessor extends RouteParser {
|
|
|
975
964
|
this.httpContext,
|
|
976
965
|
this.routeInfo
|
|
977
966
|
);
|
|
978
|
-
return { actionFilters, actionExecutingContext };
|
|
979
|
-
}
|
|
980
|
-
async onActionExecuting(methodParameters) {
|
|
981
|
-
await this.onAuthorization(methodParameters);
|
|
982
|
-
const { actionExecutingContext, actionFilters } = this.getExecutingContext(methodParameters);
|
|
983
967
|
for (const actionFilter of actionFilters) {
|
|
984
968
|
const filter = this.resolveFilter(actionFilter);
|
|
985
969
|
this.actionFilterInstances.push(filter);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nattyjs/core",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.42",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "ajayojha",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"reflect-metadata": "0.2.2",
|
|
19
19
|
"tsyringe": "^4.7.0",
|
|
20
20
|
"path-to-regexp": "6.2.1",
|
|
21
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
21
|
+
"@nattyjs/common": "0.0.1-beta.42"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"unbuild": "1.2.1"
|