@universis/janitor 2.4.0 → 2.4.2
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.esm.js +23 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/{src → listeners}/OnAccountUpdate.js +1 -1
- package/package.json +1 -1
- package/src/NetworkRestrictAccess.js +2 -2
- package/src/validateScope.js +2 -1
package/dist/index.js
CHANGED
|
@@ -910,7 +910,27 @@ function validateClientScope() {
|
|
|
910
910
|
|
|
911
911
|
function validateScope() {
|
|
912
912
|
return (req, res, next) => {
|
|
913
|
-
|
|
913
|
+
const validateClientScopeHandler = validateClientScope();
|
|
914
|
+
return validateClientScopeHandler(req, res, (err) => {
|
|
915
|
+
if (err) {
|
|
916
|
+
return next(err);
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* @type {ScopeAccessConfiguration}
|
|
920
|
+
*/
|
|
921
|
+
let scopeAccessConfiguration = req.context.getApplication().getConfiguration().getStrategy(ScopeAccessConfiguration);
|
|
922
|
+
if (typeof scopeAccessConfiguration === 'undefined') {
|
|
923
|
+
return next(new Error('Invalid application configuration. Scope access configuration strategy is missing or is in accessible.'));
|
|
924
|
+
}
|
|
925
|
+
scopeAccessConfiguration.verify(req).then((value) => {
|
|
926
|
+
if (value) {
|
|
927
|
+
return next();
|
|
928
|
+
}
|
|
929
|
+
return next(new common.HttpForbiddenError('Access denied due to authorization scopes.'));
|
|
930
|
+
}).catch((reason) => {
|
|
931
|
+
return next(reason);
|
|
932
|
+
});
|
|
933
|
+
});
|
|
914
934
|
};
|
|
915
935
|
}
|
|
916
936
|
|
|
@@ -1811,11 +1831,11 @@ class NetworkRestrictAccess extends common.ApplicationService {
|
|
|
1811
1831
|
index = model.eventListeners.length - 1;
|
|
1812
1832
|
}
|
|
1813
1833
|
let otherIndex = model.eventListeners.findIndex((listener) => {
|
|
1814
|
-
return listener.type ===
|
|
1834
|
+
return listener.type === '@universis/janitor/listeners/OnAccountUpdate';
|
|
1815
1835
|
});
|
|
1816
1836
|
if (otherIndex < 0) {
|
|
1817
1837
|
model.eventListeners.splice(index, 0, {
|
|
1818
|
-
type:
|
|
1838
|
+
type: '@universis/janitor/listeners/OnAccountUpdate'
|
|
1819
1839
|
});
|
|
1820
1840
|
}
|
|
1821
1841
|
schemaLoader.setModelDefinition(model);
|