--- a/src/main/java/de/uapcore/lightpit/dao/UserDao.java Fri Oct 09 19:06:51 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/dao/UserDao.java Fri Oct 09 19:07:05 2020 +0200 @@ -32,8 +32,19 @@ import java.sql.SQLException; import java.util.List; +import java.util.Optional; public interface UserDao extends GenericDao<User> { List<User> list() throws SQLException; + + /** + * Tries to find a user by their username. + * The search is case-insensitive. + * + * @param username the username + * @return the user object or an empty optional if no such user exists + * @throws SQLException + */ + Optional<User> findByUsername(String username) throws SQLException; }