@Override
    public void build(final AttributeStatement attrStatement, final Attribute attribute) {
        if (!service.isEncryptAttributes() || !shouldEncryptAttribute(attribute) || service.isEncryptAssertions()) {
            LOGGER.debug("Service [{}] is configured to not encrypt attributes for [{}]", service.getName(), attribute.getName());
            super.build(attrStatement, attribute);
            return;
        }

        val encryptedAttribute = samlObjectEncrypter.encode(attribute, service, adaptor);
        if (encryptedAttribute != null) {
            LOGGER.debug("Encrypted attribute [{}] for service [{}]", attribute.getName(), service.getName());
            attrStatement.getEncryptedAttributes().add(encryptedAttribute);
        } else {
            LOGGER.debug("Unable to encrypt attribute [{}] for service [{}]", attribute.getName(), service.getName());
            super.build(attrStatement, attribute);
        }
    }
This is {@link SamlProfileSamlRegisteredServiceAttributeBuilder}.

@author Misagh Moayyed
@since 6.0.0
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/attr/SamlProfileSamlRegisteredServiceAttributeBuilder.java