1 package net.avcompris.examples.users3.dao; 2 3 import java.io.IOException; 4 import java.sql.SQLException; 5 6 import javax.annotation.Nullable; 7 8 import org.joda.time.DateTime; 9 10 public interface AuthDao { 11 12 UserSessionsDto getUserSessions(UserSessionsDtoQuery query) throws SQLException, IOException; 13 14 void setUserPassword(String username, String password) throws SQLException, IOException; 15 16 void removeUserPassword(String username) throws SQLException, IOException; 17 18 @Nullable 19 String getUsernameByAuthorization(String authorization, DateTime updatedAt) throws SQLException, IOException; 20 21 @Nullable 22 String getUsernameBySessionId(String userSessionId, DateTime updatedAt) throws SQLException, IOException; 23 24 boolean isValidUserPassword(String username, String password) throws SQLException, IOException; 25 26 UserSessionDto newUserSession(String username, DateTime createdAt) throws SQLException, IOException; 27 28 @Nullable 29 UserSessionDto getUserSession(String userSessionId, DateTime updatedAt) throws SQLException, IOException; 30 31 void terminateSession(String userSessionId, @Nullable DateTime updatedAt, DateTime expiredAt) 32 throws SQLException, IOException; 33 34 @Nullable 35 DateTime getLastActiveAt(String username) throws SQLException, IOException; 36 }