@Test
    void verifyAuthnRequestWithExtensionsAllowed() throws Throwable {
        val filter = new AuthnRequestRequestedAttributesAttributeReleasePolicy();
        filter.setAllowedAttributes(List.of("eduPersonPrincipalName"));
        filter.setUseFriendlyName(false);

        val registeredService = SamlIdPTestUtils.getSamlRegisteredService();
        registeredService.setAttributeReleasePolicy(filter);

        val builder = new SAML2AuthnRequestBuilder();
        val authnRequest = builder.build(saml2MessageContext);
        val extensions = ((SAMLObjectBuilder<Extensions>) openSamlConfigBean.getBuilderFactory()
            .getBuilder(Extensions.DEFAULT_ELEMENT_NAME)).buildObject();

        val attrBuilder = (SAMLObjectBuilder<RequestedAttribute>)
            openSamlConfigBean.getBuilderFactory().getBuilder(RequestedAttribute.DEFAULT_ELEMENT_NAME);

        val requestAttribute = attrBuilder.buildObject(RequestedAttribute.DEFAULT_ELEMENT_NAME);
        requestAttribute.setIsRequired(false);
        requestAttribute.setName("eduPersonPrincipalName");
        extensions.getUnknownXMLObjects().add(requestAttribute);
        authnRequest.setExtensions(extensions);
        authnRequest.setID(UUID.randomUUID().toString());

        storeSamlAuthnRequest(authnRequest);

        val releasePolicyContext = RegisteredServiceAttributeReleasePolicyContext.builder()
            .registeredService(registeredService)
            .service(CoreAuthenticationTestUtils.getService())
            .applicationContext(applicationContext)
            .principal(CoreAuthenticationTestUtils.getPrincipal("casuser",
                CollectionUtils.wrap("eduPersonPrincipalName", "casuser", "givenName", "CAS")))
            .build();
        val attributes = filter.getAttributes(releasePolicyContext);
        assertTrue(attributes.containsKey("eduPersonPrincipalName"));
        val definitions = filter.determineRequestedAttributeDefinitions(releasePolicyContext);
        assertTrue(definitions.contains("eduPersonPrincipalName"));
    }
This is {@link AuthnRequestRequestedAttributesAttributeReleasePolicyTests}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-saml-idp/src/test/java/org/apereo/cas/support/saml/services/AuthnRequestRequestedAttributesAttributeReleasePolicyTests.java