Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbb3f48b6d | ||
| e32f4eb8ff |
@@ -388,3 +388,8 @@
|
||||
### Features
|
||||
|
||||
* Add logging for user management operations in HibernateUserManager ([9ca1813](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/9ca1813f06539cffeb573d0e00571e4f2d5144f1))
|
||||
## (2026-01-20)
|
||||
|
||||
### Features
|
||||
|
||||
* Integrate UserManager and HibernateUserManager in session management ([e32f4eb](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/e32f4eb8fff9daec46f20284e28e94a59231d033))
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package di
|
||||
|
||||
import com.google.inject.AbstractModule
|
||||
import com.google.inject.name.Names
|
||||
import logic.user.impl.HibernateUserManager
|
||||
import play.api.db.DBApi
|
||||
import play.api.{Configuration, Environment}
|
||||
|
||||
class ProductionModule(
|
||||
environment: Environment,
|
||||
configuration: Configuration
|
||||
) extends AbstractModule {
|
||||
|
||||
override def configure(): Unit = {
|
||||
// Bind HibernateUserManager for production
|
||||
bind(classOf[logic.user.UserManager])
|
||||
.to(classOf[logic.user.impl.HibernateUserManager])
|
||||
.asEagerSingleton()
|
||||
|
||||
// Bind EntityManager for JPA
|
||||
bind(classOf[jakarta.persistence.EntityManager])
|
||||
.toProvider(classOf[EntityManagerProvider])
|
||||
.asEagerSingleton()
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import com.auth0.jwt.algorithms.Algorithm
|
||||
import com.auth0.jwt.{JWT, JWTVerifier}
|
||||
import com.github.benmanes.caffeine.cache.{Cache, Caffeine}
|
||||
import com.typesafe.config.Config
|
||||
import logic.user.SessionManager
|
||||
import logic.user.{SessionManager, UserManager}
|
||||
import model.users.User
|
||||
import scalafx.util.Duration
|
||||
import services.JwtKeyProvider
|
||||
@@ -16,7 +16,7 @@ import javax.inject.{Inject, Singleton}
|
||||
import scala.util.Try
|
||||
|
||||
@Singleton
|
||||
class BaseSessionManager @Inject()(val keyProvider: JwtKeyProvider, val userManager: StubUserManager, val config: Config) extends SessionManager {
|
||||
class BaseSessionManager @Inject()(val keyProvider: JwtKeyProvider, val userManager: UserManager, val config: Config) extends SessionManager {
|
||||
|
||||
private val algorithm = Algorithm.RSA512(keyProvider.publicKey, keyProvider.privateKey)
|
||||
private val verifier: JWTVerifier = JWT.require(algorithm)
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
package modules
|
||||
|
||||
import com.google.inject.AbstractModule
|
||||
import di.EntityManagerProvider
|
||||
import jakarta.persistence.EntityManager
|
||||
import logic.Gateway
|
||||
import logic.user.UserManager
|
||||
import logic.user.impl.HibernateUserManager
|
||||
|
||||
class GatewayModule extends AbstractModule {
|
||||
override def configure(): Unit = {
|
||||
bind(classOf[Gateway]).asEagerSingleton()
|
||||
|
||||
// Bind HibernateUserManager for production (when GatewayModule is used)
|
||||
bind(classOf[UserManager])
|
||||
.to(classOf[HibernateUserManager])
|
||||
.asEagerSingleton()
|
||||
|
||||
// Bind EntityManager for JPA
|
||||
bind(classOf[EntityManager])
|
||||
.toProvider(classOf[EntityManagerProvider])
|
||||
.asEagerSingleton()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
<persistence-unit name="defaultPersistenceUnit">
|
||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||
|
||||
<class>model.users.UserEntity</class>
|
||||
|
||||
<properties>
|
||||
<!-- Hibernate specific settings -->
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
MAJOR=4
|
||||
MINOR=39
|
||||
MINOR=40
|
||||
PATCH=0
|
||||
|
||||
Reference in New Issue
Block a user