I want to apply ACLs to all the requests going through my request factory. Therefore I override the RequestFactoryServlet and its doPost()-Methode. Now I can get the user from the session, check if his logged in and so on. But I also want to check his rights and only allow the user to call specific methods. So for example only admin users are allowed to call methods, which write data to the database.
Now my questions:
String jsonRequestString = RPCServletUtils.readContent(request, JSON_CONTENT_TYPE, JSON_CHARSET);
But it only provides a very cryptic string.My code would look like this:
public class MyRequestFactoryServlet extends RequestFactoryServlet {
@Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
HttpSession session = getThreadLocalRequest().getSession();
User user = (User)session.getAttribute("user");
// check rights for user and only allow some methods
super.doPost(request, response);
}
}
The solution is create standard RequestFactoryServlet
with your ServiceLayerDecorator
.
In your ServiceLayerDecorator
, you can override the invoke
method.
However I would prefer do ACL in business object directly.