java - How to use Spring authorization in client side in GWT -
i have been trying implement role base authorization in client side code limit views specific users.
i'm trying use following code limit view
@preauthorize("hasrole('role_user')") public void create(contact contact);
i'm trying add following code
authentication = securitycontextholder.getcontext().getauthentication(); userdetails currentuserdetails = (userdetails) a.getprincipal();
and added following in module.gwt.xml file
<inherits name='org.springframework.security.core.authentication' /> <inherits name='org.springframework.security.core.context.securitycontextholder' /> <inherits name='org.springframework.security.core.userdetails.userdetails' />
but giving following error while compiling
[error] unable find 'org/springframework/security/core/authentication.gwt.xml' on classpath; typo, or maybe forgot include classpath entry source? [java][error] line 22: unexpected exception while processing element 'inherits'
please suggest me i'm going wrong , can make work.
the short answer is: it's not possible.
on client side, a specific subset of java emulated, , libraries use have made work gwt (including having own .gwt.xml).
when try use spring classes on client side, gwt not know them , throw error, , if try import modules, corresponding .gwt.xml file (which doesn't exist because spring project not made work gwt).
so, can ?
protect rpc calls server side: event if user can load view, not able load datas.
protect .html page non authenticated users (you have create different page login). prevent access application users not logged. can have here other ideas including servlets/jsp.
make rpc call every time user request view check if authenticated/if have rights. idea cache information client-side avoid slowing down application (don't forget clean cache when user log-out).
Comments
Post a Comment