public void convertAndAdd(final UserProfile profile, final AttributeLocation attributeLocation, final String name,
            final Object value) {
        if (value != null) {
            final Object convertedValue;
            val converter = this.converters.get(name);
            if (converter != null) {
                convertedValue = converter.convert(value);
                if (convertedValue != null) {
                    logger.debug("converted to => key: {} / value: {} / {}", name, convertedValue, convertedValue.getClass());
                }
            } else {
                convertedValue = value;
                logger.debug("no conversion => key: {} / value: {} / {}", name, convertedValue, convertedValue.getClass());
            }

            if (attributeLocation.equals(AUTHENTICATION_ATTRIBUTE)) {
                profile.addAuthenticationAttribute(name, convertedValue);
            } else {
                profile.addAttribute(name, convertedValue);
            }
        }
    }
Convert a profile or authentication attribute, if necessary, and add it to the profile.

@param profile The profile.
@param attributeLocation Location of the attribute inside the profile: classic profile attribute, authentication attribute, ...
@param name The attribute name.
@param value The attribute value.
pac4j-core/src/main/java/org/pac4j/core/profile/definition/ProfileDefinition.java