From 6341106bddaab19fcd66953e8cd55654d5f70f6c Mon Sep 17 00:00:00 2001 From: Simon Redfern Date: Tue, 26 Sep 2023 17:08:17 +0200 Subject: [PATCH] Allow multiple Direct Login tokens per User --- .../main/resources/props/test.default.props.template | 2 +- obp-api/src/main/scala/code/api/directlogin.scala | 4 ++-- .../src/test/scala/code/api/DirectLoginTest.scala | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/obp-api/src/main/resources/props/test.default.props.template b/obp-api/src/main/resources/props/test.default.props.template index 3ddd8ebe24..8f5102df60 100644 --- a/obp-api/src/main/resources/props/test.default.props.template +++ b/obp-api/src/main/resources/props/test.default.props.template @@ -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 diff --git a/obp-api/src/main/scala/code/api/directlogin.scala b/obp-api/src/main/scala/code/api/directlogin.scala index 190482f932..62b45943c5 100644 --- a/obp-api/src/main/scala/code/api/directlogin.scala +++ b/obp-api/src/main/scala/code/api/directlogin.scala @@ -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( @@ -349,7 +349,7 @@ object DirectLogin extends RestHelper with MdcLoggable { ).size > 0 if(isNotLastIssuedToken) false else true case false => false - } + }*/ case _ => false } } diff --git a/obp-api/src/test/scala/code/api/DirectLoginTest.scala b/obp-api/src/test/scala/code/api/DirectLoginTest.scala index 5f5a8f79ac..0cc5338886 100644 --- a/obp-api/src/test/scala/code/api/DirectLoginTest.scala +++ b/obp-api/src/test/scala/code/api/DirectLoginTest.scala @@ -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) + + }