We have created our own custom principal class by implementing the java.security.Principal interface. It's a very simple class in which we take in the username through a constructor and then use that to return in the getName method:
public class JaasPrincipal implements Principal, Serializable {
private String username;
public JaasPrincipal(String username) {
this.username = username;
}
@Override
public String getName() {
return "Authenticated_"+this.username;
}
}