web/src/main/java/org/springframework/security/web/authentication/preauth/RequestAttributeAuthenticationFilter.java
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
		String principal = (String) request.getAttribute(principalEnvironmentVariable);

		if (principal == null && exceptionIfVariableMissing) {
			throw new PreAuthenticatedCredentialsNotFoundException(
					principalEnvironmentVariable + " variable not found in request.");
		}

		return principal;
	}
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
		String principal = (String) request.getAttribute(principalEnvironmentVariable);

		if (principal == null && exceptionIfVariableMissing) {
			throw new PreAuthenticatedCredentialsNotFoundException(
					principalEnvironmentVariable + " variable not found in request.");
		}

		return principal;
	}
Read and returns the variable named by {@code principalEnvironmentVariable} from
the request.

@throws PreAuthenticatedCredentialsNotFoundException if the environment variable is
missing and {@code exceptionIfVariableMissing} is set to {@code true}.