@Bean
    @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    @ConditionalOnMissingBean(name = "delegatedSaml2ClientAmazonS3MetadataCustomizer")
    public DelegatedClientFactoryCustomizer delegatedSaml2ClientAmazonS3MetadataCustomizer(
        final CasConfigurationProperties casProperties,
        @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext) {
        return client -> {
            if (client instanceof final SAML2Client saml2Client) {
                val configuration = saml2Client.getConfiguration();
                casProperties.getAuthn().getPac4j().getSaml().forEach(saml -> {
                    val amz = saml.getMetadata().getServiceProvider().getAmazonS3();
                    val credentials = ChainingAWSCredentialsProvider.getInstance(amz.getCredentialAccessKey(),
                        amz.getCredentialSecretKey(), amz.getProfilePath(), amz.getProfileName());
                    val builder = S3Client.builder();
                    AmazonClientConfigurationBuilder.prepareSyncClientBuilder(builder, credentials, amz);
                    val s3Client = builder.build();
                    val metadataGenerator = new SAML2S3MetadataGenerator(s3Client, configuration.getServiceProviderEntityId());
                    
                    configuration.setServiceProviderMetadataResource(ResourceUtils.NULL_RESOURCE);
                    configuration.setMetadataGenerator(metadataGenerator);
                });
            }
        };
    }
This is {@link DelegatedAuthenticationSaml2AmazonS3Configuration}.

@author Misagh Moayyed
@since 7.1.0
support/cas-server-support-pac4j-saml/src/main/java/org/apereo/cas/config/DelegatedAuthenticationSaml2AmazonS3Configuration.java