@Override
    public String findEmail(final PasswordManagementQuery query) {
        val queryFindEmail = casProperties.getAuthn().getPm().getJdbc().getSqlFindEmail();
        if (StringUtils.isBlank(queryFindEmail)) {
            LOGGER.debug("No SQL query is defined to retrieve email addresses");
            return null;
        }

        try {
            return this.transactionTemplate.execute(action -> {
                val email = this.jdbcTemplate.queryForObject(queryFindEmail, String.class, query.getUsername());
                if (StringUtils.isNotBlank(email) && EmailValidator.getInstance().isValid(email)) {
                    return email;
                }
                LOGGER.debug("Username [{}] not found when searching for email", query.getUsername());
                return null;
            });
        } catch (final EmptyResultDataAccessException e) {
            LOGGER.debug("Username [{}] not found when searching for email", query.getUsername());
            return null;
        }
    }
This is {@link JdbcPasswordManagementService}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-pm-jdbc/src/main/java/org/apereo/cas/pm/jdbc/JdbcPasswordManagementService.java