protected String getAlternatePrincipal(final X509Certificate certificate) {
        if (StringUtils.isBlank(alternatePrincipalAttribute)) {
            return null;
        }
        val attributes = extractPersonAttributes(certificate);
        val attribute = attributes.get(alternatePrincipalAttribute);
        if (attribute == null) {
            LOGGER.debug("Attempt to get alternate principal with attribute [{}] was unsuccessful.", alternatePrincipalAttribute);
            return null;
        }
        val optionalAttribute = CollectionUtils.firstElement(attribute);
        return optionalAttribute
            .map(Object::toString)
            .filter(StringUtils::isNotEmpty)
            .map(alternatePrincipal -> {
                LOGGER.debug("Using alternate principal attribute [{}]", alternatePrincipal);
                return alternatePrincipal;
            }).orElseGet(() -> {
                LOGGER.trace("Returning null principal id...");
                return null;
            });
    }
Get alternate principal if alternate attribute configured.

@param certificate X509 Certificate of user
@return principal using alternate attribute or null if none configured
support/cas-server-support-x509-core/src/main/java/org/apereo/cas/adaptors/x509/authentication/principal/AbstractX509PrincipalResolver.java