public String determinePrincipalIdFromAttributes(final String defaultId, final Map<String, List<Object>> attributes) {
        return FunctionUtils.doIf(
            StringUtils.isNotBlank(this.attribute) && attributes.containsKey(this.attribute),
            () -> {
                val attributeValue = attributes.get(this.attribute);
                LOGGER.debug("Using attribute [{}] to establish principal id", this.attribute);
                val element = CollectionUtils.firstElement(attributeValue);
                return element.map(Object::toString).orElse(null);
            },
            () -> {
                LOGGER.debug("Using principal id [{}] to generate persistent identifier", defaultId);
                return defaultId;
            }).get();
    }
Determine principal id from attributes.

@param defaultId  the default id
@param attributes the attributes
@return the string
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/principal/ShibbolethCompatiblePersistentIdGenerator.java