@Override
    public CasConsentableAttribute build(final CasConsentableAttribute attribute) {
        val result = attributeDefinitionStore.locateAttributeDefinition(defn -> {
            if (defn instanceof final SamlIdPAttributeDefinition samlAttr) {
                return (StringUtils.equalsIgnoreCase(samlAttr.getKey(), attribute.getName())
                       || StringUtils.equalsIgnoreCase(samlAttr.getUrn(), attribute.getName()))
                          && StringUtils.isNotBlank(samlAttr.getFriendlyName());
            }
            return false;
        });
        if (result.isPresent()) {
            val samlAttr = (SamlIdPAttributeDefinition) result.get();
            attribute.setFriendlyName(samlAttr.getFriendlyName());
        }
        val attributeValues = ObjectUtils.defaultIfNull(attribute.getValues(), new ArrayList<>());
        attributeValues.replaceAll(o -> {
            if (o instanceof final XSString value) {
                return value.getValue();
            }
            if (o instanceof final XSURI value) {
                return value.getURI();
            }
            if (o instanceof Serializable) {
                return o;
            }
            return o.toString();
        });
        return attribute;
    }
This is {@link SamlIdPConsentableAttributeBuilder}.

@author Misagh Moayyed
@since 6.5.0
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/consent/SamlIdPConsentableAttributeBuilder.java