feat(websocket)!: Implement WebSocket connection and event handling
This commit is contained in:
@@ -6,9 +6,11 @@ import model.users.User
|
||||
|
||||
@ImplementedBy(classOf[BaseSessionManager])
|
||||
trait SessionManager {
|
||||
|
||||
|
||||
def createSession(user: User): String
|
||||
|
||||
def getUserBySession(sessionId: String): Option[User]
|
||||
|
||||
def invalidateSession(sessionId: String): Unit
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,13 @@ import model.users.User
|
||||
trait UserManager {
|
||||
|
||||
def addUser(name: String, password: String): Boolean
|
||||
|
||||
def authenticate(name: String, password: String): Option[User]
|
||||
|
||||
def userExists(name: String): Option[User]
|
||||
|
||||
def userExistsById(id: Long): Option[User]
|
||||
|
||||
def removeUser(name: String): Boolean
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.inject.{Inject, Singleton}
|
||||
|
||||
@Singleton
|
||||
class StubUserManager @Inject()(val config: Config) extends UserManager {
|
||||
|
||||
|
||||
private val user: Map[String, User] = Map(
|
||||
"Janis" -> User(
|
||||
internalId = 1L,
|
||||
@@ -53,5 +53,5 @@ class StubUserManager @Inject()(val config: Config) extends UserManager {
|
||||
override def removeUser(name: String): Boolean = {
|
||||
throw new NotImplementedError("StubUserManager.removeUser is not implemented")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user