protected String name(Object principal) {
		if (principal instanceof UserDetails) {
			return ((UserDetails) principal).getUsername();
		}
		if (principal instanceof Principal) {
			return ((Principal) principal).getName();
		}
		return principal.toString();
	}
protected String name(Object principal) {
		if (principal instanceof UserDetails) {
			return ((UserDetails) principal).getUsername();
		}
		if (principal instanceof Principal) {
			return ((Principal) principal).getName();
		}
		return principal.toString();
	}
protected String name ( Object principal ) { if ( principal instanceof UserDetails ) { return ( ( UserDetails ) principal ) . getUsername ( ) ; } if ( principal instanceof Principal ) { return ( ( Principal ) principal ) . getName ( ) ; } return principal . toString ( ) ; }
Derives a String name for the given principal.

@param principal as provided by Spring Security
@return name of the principal, or its {@code toString()} representation if no name
could be derived
Derives a String name for the given principal .