I have configured a form based log in in my JSF 2.0 Application on GlassFish 3 server, using a custom Realm. What is the simpliest way of getting information about a logged in user, i.e. the users name.
Is this possible? Or is the current session just associated with a security role? If so, is there some way of making this possible without changing the log in configuration?
Simply put, what I want is to display a simple message like:
Logged in as username
on my webpages.
Integer id = Integer.parseInt(externalContext.getUserPrincipal().getName());
You are trying to parse name as int? – Fluoroscope