This is my backing bean (deployed to GlassFish):
@ManagedBean
@DeclareRoles({ "USER" })
@RolesAllowed("USER")
public class MyBean {
public MyBean() {}
public final String getId() {
Principal p = .. // how and where?
return p.getName();
}
}
How and where I can get java.security.Principal
object to understand who is logged in now?