Run as in servlet or ejb
I want to develop a servlet that does some kind of login verification and then sets the current user if the verification routine passed correctly.
To do this , in the servlet I want to do something like
throw Exception("Not authorized");
This could also be done in a filter.
I know you can set the run-as user (role) in the web.xml but can you do it programmaticaly ?