Skip to content

Commit

Permalink
docfix/Tweak debugging of OIDC
Browse files Browse the repository at this point in the history
  • Loading branch information
constantine2nd committed Nov 5, 2024
1 parent f4fa0df commit 230afb0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions obp-api/src/main/scala/code/api/openidconnect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,16 @@ object OpenIdConnect extends OBPRestHelper with MdcLoggable {
logger.debug("Error at getOrCreateResourceUser: " + everythingElse)
(401, ErrorMessages.CouldNotSaveOpenIDConnectUser, None)
}
case badObj@Failure(_, _, _) => chainErrorMessage(badObj, ErrorMessages.CouldNotValidateIDToken)
case badObj@Failure(_, _, _) =>
logger.debug("Error at JwtUtil.validateIdToken: " + badObj)
chainErrorMessage(badObj, ErrorMessages.CouldNotValidateIDToken)
case everythingElse =>
logger.debug("Error at JwtUtil.validateIdToken: " + everythingElse)
(401, ErrorMessages.CouldNotValidateIDToken, None)
}
case badObj@Failure(_, _, _) => chainErrorMessage(badObj, ErrorMessages.CouldNotExchangeAuthorizationCodeForTokens)
case badObj@Failure(_, _, _) =>
logger.debug("Error at exchangeAuthorizationCodeForTokens: " + badObj)
chainErrorMessage(badObj, ErrorMessages.CouldNotExchangeAuthorizationCodeForTokens)
case everythingElse =>
logger.debug("Error at exchangeAuthorizationCodeForTokens: " + everythingElse)
(401, ErrorMessages.CouldNotExchangeAuthorizationCodeForTokens, None)
Expand Down Expand Up @@ -271,10 +275,15 @@ object OpenIdConnect extends OBPRestHelper with MdcLoggable {
refreshToken <- tryo{(tokenResponse \ "refresh_token").extractOrElse[String]("")}
scope <- tryo{(tokenResponse \ "scope").extractOrElse[String]("")}
} yield {
logger.debug(s"(idToken: $idToken, accessToken: $accessToken, tokenType: $tokenType, expiresIn.toLong: ${expiresIn.toLong}, refreshToken: $refreshToken, scope: $scope)")
(idToken, accessToken, tokenType, expiresIn.toLong, refreshToken, scope)
}
case badObject@Failure(_, _, _) => badObject
case _ => Failure(ErrorMessages.InternalServerError + " - exchangeAuthorizationCodeForTokens")
case badObject@Failure(_, _, _) =>
logger.debug("Error at exchangeAuthorizationCodeForTokens: " + badObject)
badObject
case everythingElse =>
logger.debug("Error at exchangeAuthorizationCodeForTokens: " + everythingElse)
Failure(ErrorMessages.InternalServerError + " - exchangeAuthorizationCodeForTokens")
}
}

Expand Down

0 comments on commit 230afb0

Please sign in to comment.