@Override
    public void destroy() throws Exception {
        val clients = retrieve(casProperties.getServer().getName());
        Optional.ofNullable(clients)
            .stream()
            .filter(Closeable.class::isInstance)
            .map(Closeable.class::cast)
            .forEach(Unchecked.consumer(Closeable::close));
    }
This is {@link BaseDelegatedIdentityProviderFactory}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-pac4j-core-clients/src/main/java/org/apereo/cas/support/pac4j/authentication/clients/BaseDelegatedIdentityProviderFactory.java