@Bean
    @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    @ConditionalOnMissingBean(name = "userGraphicalAuthenticationRepository")
    public UserGraphicalAuthenticationRepository userGraphicalAuthenticationRepository(
        final CasConfigurationProperties casProperties) {
        val gua = casProperties.getAuthn().getGua();
        if (!gua.getSimple().isEmpty()) {
            val accounts = gua.getSimple().entrySet().stream().map(Unchecked.function(entry -> {
                val res = ResourceUtils.getResourceFrom(entry.getValue());
                return Pair.of(entry.getKey(), (Resource) res);
            })).collect(Collectors.toMap(Pair::getKey, Pair::getValue));
            return new StaticUserGraphicalAuthenticationRepository(accounts);
        }
        val ldap = gua.getLdap();
        if (StringUtils.isNotBlank(ldap.getLdapUrl()) && StringUtils.isNotBlank(ldap.getSearchFilter())
            && StringUtils.isNotBlank(ldap.getBaseDn()) && StringUtils.isNotBlank(ldap.getImageAttribute())) {
            val connectionFactory = new LdapConnectionFactory(LdapUtils.newLdaptiveConnectionFactory(gua.getLdap()));
            return new LdapUserGraphicalAuthenticationRepository(casProperties, connectionFactory);
        }
        throw new BeanCreationException("A repository instance must be configured to locate user-defined graphics");
    }
This is {@link CasGraphicalUserAuthenticationAutoConfiguration}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-gua/src/main/java/org/apereo/cas/config/CasGraphicalUserAuthenticationAutoConfiguration.java