@ConditionalOnMissingBean(name = "amazonCognitoAuthenticationJwtProcessor")
    @Bean
    @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    public ConfigurableJWTProcessor amazonCognitoAuthenticationJwtProcessor(
        final CasConfigurationProperties casProperties) throws Exception {
        val cognito = casProperties.getAuthn().getCognito();
        val resourceRetriever = new DefaultResourceRetriever(
            (int) Beans.newDuration(cognito.getConnectionTimeout()).toMillis(),
            (int) Beans.newDuration(cognito.getSocketTimeout()).toMillis());
        val region = StringUtils.defaultIfBlank(cognito.getRegion(), Region.AWS_GLOBAL.id());
        val url = String.format("https://cognito-idp.%s.amazonaws.com/%s/.well-known/jwks.json", region, cognito.getUserPoolId());
        val jwkSetURL = new URI(url).toURL();
        val keySource = new RemoteJWKSet(jwkSetURL, resourceRetriever);
        val jwtProcessor = new DefaultJWTProcessor();
        val keySelector = new JWSVerificationKeySelector(JWSAlgorithm.RS256, keySource);
        jwtProcessor.setJWSKeySelector(keySelector);
        return jwtProcessor;
    }
This is {@link CasAmazonCognitoAuthenticationAutoConfiguration}.

@author Misagh Moayyed
@since 6.0.0
support/cas-server-support-aws-cognito-authentication/src/main/java/org/apereo/cas/config/CasAmazonCognitoAuthenticationAutoConfiguration.java