GWT RequestFactory support for user permissions?

116 views
Skip to first unread message

Marius Grama

unread,
Sep 19, 2011, 8:08:46 AM9/19/11
to Google Web Toolkit
Hi,

is there a possibility/tweak in the newly released GWT 2.4.0
RequestFactory API to integrate user permissions for executing
specific service actions (like an ActionValidator used in gwtp library
http://code.google.com/p/gwt-platform/wiki/IntroductionActionValidator
) ?

Say there is a need in the Employee entity from the RequestFactory
DevGuide : http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html
to allow add/remove operations to be executed only by users with
administrative rights. Could there be this functionality integrated
with the currently released RequestFactory ?

Y2i

unread,
Sep 19, 2011, 4:02:46 PM9/19/11
to google-we...@googlegroups.com
This seems to be related to issue 6051.

Marius Grama

unread,
Sep 20, 2011, 4:43:44 PM9/20/11
to google-we...@googlegroups.com
The technique evoqued on the ticket that you reffer could be applied into adding permission based annotations on the methods and verifying on the user if the user contains the permissions required by the annotation.

This would come with the overhead of adding an own ServiceLayerDecorator implementation. But in the ServiceLayerDecorator I'd need to obtain the User object from the session (with its rights associated in order to query if they match the security annotation on the service method to be called),but from the source code of the RequestFactoryServlet class i see (line 131 on http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/server/RequestFactoryServlet.java?r=10212)

that only the jsonString contained on the request is passed to be processed:

String payload = processor.process(jsonRequestString);

and not the whole HttpServletRequest object.

Any hints on how I could obtain the currently logged in user in the ServiceLayerDecorator implementation?

Thomas Broyer

unread,
Sep 20, 2011, 5:57:03 PM9/20/11
to google-we...@googlegroups.com
RequestFactoryServlet.getThreadLocalRequest().getRemoteUser() (or getUserPrincipal()) ?

Marius Grama

unread,
Sep 20, 2011, 6:11:51 PM9/20/11
to google-we...@googlegroups.com
Thanks for the hint. This is what i was looking for.


Reply all
Reply to author
Forward
0 new messages