@universis/janitor 2.4.0 → 2.4.1
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 +21 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- 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
|
|