java - How to get a session Object in the ContainerRequest to can use the annotation @RolesAllowed(Role_user)? -
i building application using app engine jersey. use annotation @rolesallowed(role_user)
permit create filter in request.
the problem need configure class securitycontextfilter
.
my objective id
of user stored in session check role directly in function : public containerrequest filter(containerrequest request)
of class securitycontextfilter
.
i need inject httprequest
session, when inject exception java.lang.null
.
i want session object in class containerrequest
.
how can this?
edit:
i have find solution issue don't know if clean: can inject httprequest directly in function : isuserinrole(_role) use , userid session role user , check if match _role , return true or false.
i'm pretty not sure whether can inject httpservletrequest
on top of containerrequestfilter
in jersey still can programmatically instead of using annotations:
@override public containerrequest filter(containerrequest request) { if(request.isuserinrole("some_role")){ //process treatement } return request; }
br.
Comments
Post a Comment