@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.esm.js
CHANGED
|
@@ -908,7 +908,27 @@ function validateClientScope() {
|
|
|
908
908
|
|
|
909
909
|
function validateScope() {
|
|
910
910
|
return (req, res, next) => {
|
|
911
|
-
|
|
911
|
+
const validateClientScopeHandler = validateClientScope();
|
|
912
|
+
return validateClientScopeHandler(req, res, (err) => {
|
|
913
|
+
if (err) {
|
|
914
|
+
return next(err);
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* @type {ScopeAccessConfiguration}
|
|
918
|
+
*/
|
|
919
|
+
let scopeAccessConfiguration = req.context.getApplication().getConfiguration().getStrategy(ScopeAccessConfiguration);
|
|
920
|
+
if (typeof scopeAccessConfiguration === 'undefined') {
|
|
921
|
+
return next(new Error('Invalid application configuration. Scope access configuration strategy is missing or is in accessible.'));
|
|
922
|
+
}
|
|
923
|
+
scopeAccessConfiguration.verify(req).then((value) => {
|
|
924
|
+
if (value) {
|
|
925
|
+
return next();
|
|
926
|
+
}
|
|
927
|
+
return next(new HttpForbiddenError('Access denied due to authorization scopes.'));
|
|
928
|
+
}).catch((reason) => {
|
|
929
|
+
return next(reason);
|
|
930
|
+
});
|
|
931
|
+
});
|
|
912
932
|
};
|
|
913
933
|
}
|
|
914
934
|
|