Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6479f68b6c | ||
| 4f52c1a0f3 |
@@ -398,3 +398,8 @@
|
||||
### Features
|
||||
|
||||
* Implement transaction management for user addition and removal in HibernateUserManager ([45dec00](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/45dec00b86a1395457226ed62ac319c61e38739a))
|
||||
## (2026-01-20)
|
||||
|
||||
### Features
|
||||
|
||||
* Add mainRoute configuration for OpenID in application and environment files ([4f52c1a](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/4f52c1a0f30cf0b917452149a52b53b94d82a7c9))
|
||||
|
||||
Submodule knockoutwhistfrontend updated: c2dfa0e701...cd950e9521
@@ -58,17 +58,33 @@ class OpenIDController @Inject()(
|
||||
} yield {
|
||||
openIDService.exchangeCodeForTokens(provider, authCode, sessionState.get).flatMap {
|
||||
case Some(tokenResponse) =>
|
||||
openIDService.getUserInfo(provider, tokenResponse.accessToken).map {
|
||||
openIDService.getUserInfo(provider, tokenResponse.accessToken).flatMap {
|
||||
case Some(userInfo) =>
|
||||
// Store user info in session for username selection
|
||||
Redirect(config.get[String]("openid.selectUserRoute"))
|
||||
// Check if user already exists
|
||||
userManager.authenticateOpenID(provider, userInfo.id) match {
|
||||
case Some(user) =>
|
||||
// User already exists, log them in
|
||||
val sessionToken = sessionManager.createSession(user)
|
||||
Future.successful(Redirect(config.getOptional[String]("openid.mainRoute").getOrElse("/"))
|
||||
.withCookies(Cookie(
|
||||
name = "accessToken",
|
||||
value = sessionToken,
|
||||
httpOnly = true,
|
||||
secure = false,
|
||||
sameSite = Some(Lax)
|
||||
))
|
||||
.removingFromSession("oauth_state", "oauth_nonce", "oauth_provider", "oauth_access_token"))
|
||||
case None =>
|
||||
// New user, redirect to username selection
|
||||
Future.successful(Redirect(config.get[String]("openid.selectUserRoute"))
|
||||
.withSession(
|
||||
"oauth_user_info" -> Json.toJson(userInfo).toString(),
|
||||
"oauth_provider" -> provider,
|
||||
"oauth_access_token" -> tokenResponse.accessToken
|
||||
)
|
||||
))
|
||||
}
|
||||
case None =>
|
||||
Redirect("/login").flashing("error" -> "Failed to retrieve user information")
|
||||
Future.successful(Redirect("/login").flashing("error" -> "Failed to retrieve user information"))
|
||||
}
|
||||
case None =>
|
||||
Future.successful(Redirect("/login").flashing("error" -> "Failed to exchange authorization code"))
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
<properties>
|
||||
<!-- Hibernate specific settings -->
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
|
||||
<property name="hibernate.hbm2ddl.auto" value="update"/>
|
||||
<property name="hibernate.archive.autodetection" value="class"/>
|
||||
<property name="hibernate.show_sql" value="false"/>
|
||||
|
||||
@@ -29,6 +29,7 @@ play.filters.cors {
|
||||
# Local Development OpenID Connect Configuration
|
||||
openid {
|
||||
selectUserRoute="http://localhost:5173/select-username"
|
||||
mainRoute="http://localhost:5173/"
|
||||
|
||||
discord {
|
||||
clientId = ${?DISCORD_CLIENT_ID}
|
||||
|
||||
@@ -18,6 +18,7 @@ play.filters.cors {
|
||||
openid {
|
||||
|
||||
selectUserRoute="https://knockout.janis-eccarius.de/select-username"
|
||||
mainRoute="https://knockout.janis-eccarius.de/"
|
||||
|
||||
discord {
|
||||
clientId = ${?DISCORD_CLIENT_ID}
|
||||
|
||||
@@ -15,6 +15,7 @@ play.filters.cors {
|
||||
openid {
|
||||
|
||||
selectUserRoute="https://st.knockout.janis-eccarius.de/select-username"
|
||||
mainRoute="https://st.knockout.janis-eccarius.de/"
|
||||
|
||||
discord {
|
||||
clientId = ${?DISCORD_CLIENT_ID}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
MAJOR=4
|
||||
MINOR=41
|
||||
MINOR=42
|
||||
PATCH=0
|
||||
|
||||
Reference in New Issue
Block a user