Skip to content

Commit

Permalink
Allow multiple Direct Login tokens per User
Browse files Browse the repository at this point in the history
  • Loading branch information
simonredfern committed Sep 26, 2023
1 parent e880c33 commit 6341106
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ COUNTERPARTY_OTP_INSTRUCTION_TRANSPORT=dummy
SEPA_CREDIT_TRANSFERS_OTP_INSTRUCTION_TRANSPORT=dummy


# control the create and access to public views.
# control the create and access to public views.
allow_public_views =true

# Used to run external test against some OBP-API instance
Expand Down
4 changes: 2 additions & 2 deletions obp-api/src/main/scala/code/api/directlogin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ object DirectLogin extends RestHelper with MdcLoggable {

def validAccessTokenFuture(tokenKey: String) = {
Tokens.tokens.vend.getTokenByKeyAndTypeFuture(tokenKey, TokenType.Access) map {
case Full(token) => token.isValid match {
case Full(token) => token.isValid /*match {
case true =>
// Only last issued token is considered as a valid one
val isNotLastIssuedToken = Token.findAll(
Expand All @@ -349,7 +349,7 @@ object DirectLogin extends RestHelper with MdcLoggable {
).size > 0
if(isNotLastIssuedToken) false else true
case false => false
}
}*/
case _ => false
}
}
Expand Down
12 changes: 7 additions & 5 deletions obp-api/src/test/scala/code/api/DirectLoginTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,13 @@ class DirectLoginTest extends ServerSetup with BeforeAndAfter {

When("When we issue a new token")
makePostRequestAdditionalHeader(request, "", validHeaders)
Then("The previous one should be invalid")
val failedResponse = makeGetRequest(requestCurrentUserNewStyle, validHeadersWithToken)
And("We should get a 400")
failedResponse.code should equal(400)
assertResponse(failedResponse, DirectLoginInvalidToken)
Then("The previous one should be valid")
val secondResponse = makeGetRequest(requestCurrentUserNewStyle, validHeadersWithToken)
And("We should get a 200")
secondResponse.code should equal(200)
// assertResponse(failedResponse, DirectLoginInvalidToken)


}


Expand Down

0 comments on commit 6341106

Please sign in to comment.