spring-session-core/src/main/java/org/springframework/session/security/SpringSessionBackedSessionInformation.java
private static String resolvePrincipal(Session session) {
		String principalName = session
				.getAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME);
		if (principalName != null) {
			return principalName;
		}
		SecurityContext securityContext = session
				.getAttribute(SPRING_SECURITY_CONTEXT);
		if (securityContext != null
				&& securityContext.getAuthentication() != null) {
			return securityContext.getAuthentication().getName();
		}
		return "";
	}
private static String resolvePrincipal(Session session) {
		String principalName = session
				.getAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME);
		if (principalName != null) {
			return principalName;
		}
		SecurityContext securityContext = session
				.getAttribute(SPRING_SECURITY_CONTEXT);
		if (securityContext != null
				&& securityContext.getAuthentication() != null) {
			return securityContext.getAuthentication().getName();
		}
		return "";
	}
private static String resolvePrincipal ( Session session ) { String principalName = session . getAttribute ( FindByIndexNameSessionRepository . PRINCIPAL_NAME_INDEX_NAME ) ; if ( principalName != null ) { return principalName ; } SecurityContext securityContext = session . getAttribute ( SPRING_SECURITY_CONTEXT ) ; if ( securityContext != null && securityContext . getAuthentication ( ) != null ) { return securityContext . getAuthentication ( ) . getName ( ) ; } return "" ; }
Tries to determine the principal's name from the given Session.

@param session the session
@return the principal's name, or empty String if it couldn't be determined
Tries to determine the principal s name from the given Session .