protected void verifyAuthorizationForService(final RequestContext requestContext) throws Throwable {
            val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext);
            val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(requestContext);
            val webContext = new JEEContext(request, response);
            
            val client = identityProviders.findClient("CasClient", webContext).orElseThrow();
            val service = RegisteredServiceTestUtils.getService(UUID.randomUUID().toString());
            assertTrue(delegatedClientIdentityProviderAuthorizer.isDelegatedClientAuthorizedForService(client, null, request));
            assertFalse(delegatedClientIdentityProviderAuthorizer.isDelegatedClientAuthorizedForService(client, service, request));
            assertFalse(delegatedClientIdentityProviderAuthorizer.isDelegatedClientAuthorizedForService(client, service, requestContext));

            val registeredService = RegisteredServiceTestUtils.getRegisteredService(service.getId(), Map.of());
            registeredService.setAccessStrategy(new DefaultRegisteredServiceAccessStrategy().setEnabled(false));
            servicesManager.save(registeredService);
            assertFalse(delegatedClientIdentityProviderAuthorizer.isDelegatedClientAuthorizedForService(client, service, request));
            assertFalse(delegatedClientIdentityProviderAuthorizer.isDelegatedClientAuthorizedForService(client, service, requestContext));

            val accessStrategy = new DefaultRegisteredServiceAccessStrategy();
            registeredService.setAccessStrategy(new DefaultRegisteredServiceAccessStrategy().setEnabled(true));
            val delegationStrategy = new DefaultRegisteredServiceDelegatedAuthenticationPolicy()
                .setAllowedProviders(List.of("AnotherClient"));
            accessStrategy.setDelegatedAuthenticationPolicy(delegationStrategy);
            registeredService.setAccessStrategy(accessStrategy);
            servicesManager.save(registeredService);
            assertFalse(delegatedClientIdentityProviderAuthorizer.isDelegatedClientAuthorizedForService(client, service, request));
            assertFalse(delegatedClientIdentityProviderAuthorizer.isDelegatedClientAuthorizedForService(client, service, requestContext));

            delegationStrategy.setAllowedProviders(List.of(client.getName()));
            servicesManager.save(registeredService);
            assertTrue(delegatedClientIdentityProviderAuthorizer.isDelegatedClientAuthorizedForService(client, service, request));
            assertTrue(delegatedClientIdentityProviderAuthorizer.isDelegatedClientAuthorizedForService(client, service, requestContext));
        }
This is {@link DefaultDelegatedClientIdentityProviderAuthorizerTests}.

@author Misagh Moayyed
@since 6.6.0
support/cas-server-support-pac4j-webflow/src/test/java/org/apereo/cas/web/flow/authz/DefaultDelegatedClientIdentityProviderAuthorizerTests.java