Wrap with the CheckTermsHandler is necessary.

This commit is contained in:
Anatoly Sablin
2019-11-25 23:35:56 +03:00
parent f9daf4d58a
commit a97273fe77
2 changed files with 9 additions and 1 deletions

View File

@@ -219,7 +219,10 @@ public class HttpMxisd {
routingHandler.add(method, apiHandler.getPath(IdentityServiceAPI.V1), httpHandler);
}
if (matrixConfig.isV2()) {
HttpHandler handlerWithTerms = CheckTermsHandler.around(m.getAccMgr(), httpHandler, getPolicyObjects(apiHandler));
List<PolicyConfig.PolicyObject> policyObjects = getPolicyObjects(apiHandler);
HttpHandler handlerWithTerms = policyObjects.isEmpty()
? httpHandler
: CheckTermsHandler.around(m.getAccMgr(), httpHandler, policyObjects);
HttpHandler wrappedHandler = useAuthorization ? AuthorizationHandler.around(m.getAccMgr(), handlerWithTerms) : handlerWithTerms;
routingHandler.add(method, apiHandler.getPath(IdentityServiceAPI.V2), wrappedHandler);
}