Skip to content

Commit

Permalink
Merge pull request #69 from ing-bank/fix/missing-session-token-exception
Browse files Browse the repository at this point in the history
Get empty string for logs if request doesn't contain sessionToken
  • Loading branch information
Grekkq authored Mar 24, 2023
2 parents f7fac50 + 05ef1cf commit 873fe91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/com/ing/wbaa/rokku/sts/api/UserApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ trait UserApi extends JwtToken {
verifyInternalToken(bearerToken) {
parameters("accessKey", "sessionToken".?) { (accessKey, sessionToken) =>
containsOnlyAlphanumeric(accessKey, s"bad accessKey format=$accessKey") {
containsOnlyAlphanumeric(sessionToken getOrElse "", s"bad sessionToken format=${sessionToken.get}") {
containsOnlyAlphanumeric(sessionToken getOrElse "", s"bad sessionToken format=${sessionToken getOrElse ""}") {

onSuccess(isCredentialActive(AwsAccessKey(accessKey), sessionToken.map(AwsSessionToken))) {
case Some(userInfo) =>
Expand Down
7 changes: 7 additions & 0 deletions src/test/scala/com/ing/wbaa/rokku/sts/api/UserApiTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ class UserApiTest extends AnyWordSpec
}
}

"check credential and return ok because the accessKey exist and sessionToken is missing (NPA)" in {
Get(s"/isCredentialActive?accessKey=access")
.addHeader(RawHeader("Authorization", generateBearerToken())) ~> testRoute ~> check {
assert(status == StatusCodes.OK)
}
}

}
}
}
Expand Down

0 comments on commit 873fe91

Please sign in to comment.