@Override
    public Optional<PasswordlessAuthenticationToken> findToken(final String username) {
        val query = SELECT_QUERY.concat(" WHERE t.username = :username");
        val results = entityManager.createQuery(query, JpaPasswordlessAuthenticationEntity.class)
            .setParameter(QUERY_PARAM_USERNAME, username)
            .setMaxResults(1)
            .getResultList();
        if (!results.isEmpty()) {
            val token = results.getFirst();
            val authnToken = decodePasswordlessAuthenticationToken(token.getToken());
            if (authnToken.isExpired()) {
                LOGGER.warn("Token [{}] has expired", token);
                return Optional.empty();
            }
            LOGGER.debug("Located token [{}]", authnToken);
            return Optional.of(authnToken);
        }
        return Optional.empty();
    }
This is {@link JpaPasswordlessTokenRepository}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-passwordless-jpa/src/main/java/org/apereo/cas/impl/token/JpaPasswordlessTokenRepository.java