INNER CODE UNIT · Java
toString
bujiio/buji-pac4j · src/main/java/io/buji/pac4j/subject/Pac4jPrincipal.java:103
public String toString() {
return getName();
}
/**
* Returns a name for the principal based upon one of the attributes
* of the main CommonProfile. The attribute name used to query the CommonProfile
* is specified in the constructor.
*
* @return a name for the Principal or null if the attribute is not populated.
*/
@Override
public String getName() {
final UserProfile profile = this.getProfile();
if (null == principalNameAttribute) {
return profile.getId();
}
final Object attrValue = profile.getAttribute(principalNameAttribute);