From b557a866363390bac7d2a2cf9cb4ae35d1544051 Mon Sep 17 00:00:00 2001 From: Krzysztof Zmij Date: Mon, 24 Jul 2023 14:09:36 +0200 Subject: [PATCH] test --- src/main/scala/com/ing/wbaa/rokku/sts/api/STSApi.scala | 6 +++++- .../ing/wbaa/rokku/sts/keycloak/KeycloakTokenVerifier.scala | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/scala/com/ing/wbaa/rokku/sts/api/STSApi.scala b/src/main/scala/com/ing/wbaa/rokku/sts/api/STSApi.scala index 629ac41..ba61479 100644 --- a/src/main/scala/com/ing/wbaa/rokku/sts/api/STSApi.scala +++ b/src/main/scala/com/ing/wbaa/rokku/sts/api/STSApi.scala @@ -25,12 +25,16 @@ trait STSApi extends LazyLogging with TokenXML { private def parseDurationSeconds(aui: AuthenticationUserInfo, durationSeconds: Option[Int]): Duration = { val maxTokenSession = if (aui.isNPA) stsSettings.maxTokenSessionForNPADuration else stsSettings.maxTokenSessionDuration val durationRequested = durationSeconds.map(ds => Duration(ds, TimeUnit.SECONDS)) - durationRequested match { + val d = durationRequested match { case None => stsSettings.defaultTokenSessionDuration case Some(durationRequested) => if (durationRequested > maxTokenSession) maxTokenSession else durationRequested } + logger.info("stsSettings.maxTokenSessionForNPADuration {}", stsSettings.maxTokenSessionForNPADuration) + logger.info("stsSettings.maxTokenSessionDuration {}", stsSettings.maxTokenSessionDuration) + logger.info("durationRequested", durationRequested) + d } private def getSessionTokenInputs(aui: AuthenticationUserInfo) = { diff --git a/src/main/scala/com/ing/wbaa/rokku/sts/keycloak/KeycloakTokenVerifier.scala b/src/main/scala/com/ing/wbaa/rokku/sts/keycloak/KeycloakTokenVerifier.scala index 853e8e4..79493b0 100644 --- a/src/main/scala/com/ing/wbaa/rokku/sts/keycloak/KeycloakTokenVerifier.scala +++ b/src/main/scala/com/ing/wbaa/rokku/sts/keycloak/KeycloakTokenVerifier.scala @@ -23,6 +23,8 @@ trait KeycloakTokenVerifier extends LazyLogging { import scala.jdk.CollectionConverters._ private def isNPA(keycloakToken: AccessToken): Boolean = { + logger.info("user getName={}", keycloakToken.getName) + logger.info("is NPA={}", keycloakToken.getName == "NPA NPA") keycloakToken.getName == "NPA NPA" }