Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6479f68b6c | ||
| 4f52c1a0f3 |
@@ -398,3 +398,8 @@
|
|||||||
### Features
|
### Features
|
||||||
|
|
||||||
* Implement transaction management for user addition and removal in HibernateUserManager ([45dec00](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/45dec00b86a1395457226ed62ac319c61e38739a))
|
* 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 {
|
} yield {
|
||||||
openIDService.exchangeCodeForTokens(provider, authCode, sessionState.get).flatMap {
|
openIDService.exchangeCodeForTokens(provider, authCode, sessionState.get).flatMap {
|
||||||
case Some(tokenResponse) =>
|
case Some(tokenResponse) =>
|
||||||
openIDService.getUserInfo(provider, tokenResponse.accessToken).map {
|
openIDService.getUserInfo(provider, tokenResponse.accessToken).flatMap {
|
||||||
case Some(userInfo) =>
|
case Some(userInfo) =>
|
||||||
// Store user info in session for username selection
|
// Check if user already exists
|
||||||
Redirect(config.get[String]("openid.selectUserRoute"))
|
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(
|
.withSession(
|
||||||
"oauth_user_info" -> Json.toJson(userInfo).toString(),
|
"oauth_user_info" -> Json.toJson(userInfo).toString(),
|
||||||
"oauth_provider" -> provider,
|
"oauth_provider" -> provider,
|
||||||
"oauth_access_token" -> tokenResponse.accessToken
|
"oauth_access_token" -> tokenResponse.accessToken
|
||||||
)
|
))
|
||||||
|
}
|
||||||
case None =>
|
case None =>
|
||||||
Redirect("/login").flashing("error" -> "Failed to retrieve user information")
|
Future.successful(Redirect("/login").flashing("error" -> "Failed to retrieve user information"))
|
||||||
}
|
}
|
||||||
case None =>
|
case None =>
|
||||||
Future.successful(Redirect("/login").flashing("error" -> "Failed to exchange authorization code"))
|
Future.successful(Redirect("/login").flashing("error" -> "Failed to exchange authorization code"))
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Hibernate specific settings -->
|
<!-- Hibernate specific settings -->
|
||||||
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
|
|
||||||
<property name="hibernate.hbm2ddl.auto" value="update"/>
|
<property name="hibernate.hbm2ddl.auto" value="update"/>
|
||||||
<property name="hibernate.archive.autodetection" value="class"/>
|
<property name="hibernate.archive.autodetection" value="class"/>
|
||||||
<property name="hibernate.show_sql" value="false"/>
|
<property name="hibernate.show_sql" value="false"/>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ play.filters.cors {
|
|||||||
# Local Development OpenID Connect Configuration
|
# Local Development OpenID Connect Configuration
|
||||||
openid {
|
openid {
|
||||||
selectUserRoute="http://localhost:5173/select-username"
|
selectUserRoute="http://localhost:5173/select-username"
|
||||||
|
mainRoute="http://localhost:5173/"
|
||||||
|
|
||||||
discord {
|
discord {
|
||||||
clientId = ${?DISCORD_CLIENT_ID}
|
clientId = ${?DISCORD_CLIENT_ID}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ play.filters.cors {
|
|||||||
openid {
|
openid {
|
||||||
|
|
||||||
selectUserRoute="https://knockout.janis-eccarius.de/select-username"
|
selectUserRoute="https://knockout.janis-eccarius.de/select-username"
|
||||||
|
mainRoute="https://knockout.janis-eccarius.de/"
|
||||||
|
|
||||||
discord {
|
discord {
|
||||||
clientId = ${?DISCORD_CLIENT_ID}
|
clientId = ${?DISCORD_CLIENT_ID}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ play.filters.cors {
|
|||||||
openid {
|
openid {
|
||||||
|
|
||||||
selectUserRoute="https://st.knockout.janis-eccarius.de/select-username"
|
selectUserRoute="https://st.knockout.janis-eccarius.de/select-username"
|
||||||
|
mainRoute="https://st.knockout.janis-eccarius.de/"
|
||||||
|
|
||||||
discord {
|
discord {
|
||||||
clientId = ${?DISCORD_CLIENT_ID}
|
clientId = ${?DISCORD_CLIENT_ID}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
MAJOR=4
|
MAJOR=4
|
||||||
MINOR=41
|
MINOR=42
|
||||||
PATCH=0
|
PATCH=0
|
||||||
|
|||||||
Reference in New Issue
Block a user