Compare commits

...

4 Commits

4 changed files with 16 additions and 5 deletions

View File

@@ -433,3 +433,13 @@
### Features
* Change log level to warn for OpenID callback in OpenIDController ([23cdbe9](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/23cdbe9bd127bc26405fd216372bbb2d7e718a77))
## (2026-01-21)
### Features
* Change log level to warn for OpenID callback in OpenIDController ([4a6598f](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/4a6598f102d8934c7502944a0addd400dd0cbcac))
## (2026-01-21)
### Features
* Update ID mapping in OpenIDUserInfo to use hashed value and remove name field ([4b74de1](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/4b74de12610120831fc1529f0409db66aafd4d03))

View File

@@ -61,6 +61,7 @@ class OpenIDController @Inject()(
_ <- Option(sessionProvider.contains(provider))
authCode <- code
} yield {
logger.warn(s"Authentication successful for $provider")
openIDService.exchangeCodeForTokens(provider, authCode, sessionState.get).flatMap {
case Some(tokenResponse) =>
openIDService.getUserInfo(provider, tokenResponse.accessToken).flatMap {
@@ -68,7 +69,7 @@ class OpenIDController @Inject()(
// Check if user already exists
userManager.authenticateOpenID(provider, userInfo.id) match {
case Some(user) =>
logger.info(s"User ${userInfo.name} (${userInfo.id}) already exists, logging them in")
logger.warn(s"User ${userInfo.name} (${userInfo.id}) already exists, logging them in")
// User already exists, log them in
val sessionToken = sessionManager.createSession(user)
Future.successful(Redirect(config.getOptional[String]("openid.mainRoute").getOrElse("/"))
@@ -81,7 +82,7 @@ class OpenIDController @Inject()(
))
.removingFromSession("oauth_state", "oauth_nonce", "oauth_provider", "oauth_access_token"))
case None =>
logger.info(s"User ${userInfo.name} (${userInfo.id}) not found, creating new user")
logger.warn(s"User ${userInfo.name} (${userInfo.id}) not found, creating new user")
// New user, redirect to username selection
Future.successful(Redirect(config.get[String]("openid.selectUserRoute"))
.withSession(

View File

@@ -138,9 +138,9 @@ class OpenIDConnectService@Inject(ws: WSClient, config: Configuration)(implicit
if (response.status == 200) {
val json = response.json
Some(OpenIDUserInfo(
id = (json \ provider.idClaimName).as[String],
id = (json \ provider.idClaimName).as[String].hashCode.toString,
email = (json \ "email").asOpt[String],
name = (json \ "name").asOpt[String].orElse((json \ "login").asOpt[String]),
name = None,
picture = (json \ "picture").asOpt[String].orElse((json \ "avatar_url").asOpt[String]),
provider = providerName,
providerName = provider.name

View File

@@ -1,3 +1,3 @@
MAJOR=4
MINOR=48
MINOR=50
PATCH=0