login - How to fetch the username of a person logged into a JSP webapp using the memoryrealm? -
so have simple jsp web app running composed of several .jsp files, , protect using memoryrealm system asks username , password upon entering of .jsp pages, , remembers session, until browser closed. question is, how fetch username of person show him on 1 of pages?
p.s. running webapp on apache tomcat 7.0.35
// username.
string user = request.getremoteuser();
// user principal.
string userprincipal = request.getuserprincipal().getname();
// user in specific role? boolean isuserinrole = request.isuserinrole(role);
boolean isuserinjsprole = request.isuserinrole("jspuser");
from: http://sourceforge.net/apps/trac/ogsa-dai/wiki/faqhowtopasswordprotectjsppages
Comments
Post a Comment