Puzzled and frustrated :-(
I managed in changing the principal by overriding the method getUsernameAndPassword().
protected String getUsernameAndPassword()
String s = super.getUsernameAndPassword();
s = getChangedPrincipalName(s);
It *seemed* to work because the getIdentity() method now returns what I want.
protected Principal getIdentity()
Principal p = super.getIdentity();
log.info("********* " + p);
But both in servlets and ejbs the Principal is still "johnsmith". What am I doing wrong? :(