Skip to content

Commit 35e6249

Browse files
RachanaRachana
authored andcommitted
BUG#AC-9337:Revoking or invalidating previous access tokens upon generating new access token
1 parent 995a05c commit 35e6249

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

app/code/Magento/Integration/Model/CustomerTokenService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function createCustomerAccessToken($username, $password)
5858
$this->getRequestThrottler()->throttle($username, RequestThrottler::USER_TYPE_CUSTOMER);
5959
try {
6060
$customerDataObject = $this->accountManagement->authenticate($username, $password);
61+
$this->revokeCustomerAccessToken($customerDataObject->getId());
6162
} catch (EmailNotConfirmedException $exception) {
6263
$this->getRequestThrottler()->logAuthenticationFailure($username, RequestThrottler::USER_TYPE_CUSTOMER);
6364
throw $exception;

app/code/Magento/JwtUserToken/Model/Revoker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function revokeFor(UserContextInterface $userContext): void
3636
{
3737
//Invalidating all tokens issued before current datetime.
3838
$this->revokedRepo->saveRevoked(
39-
new Revoked((int) $userContext->getUserType(), (int) $userContext->getUserId(), time())
39+
new Revoked((int) $userContext->getUserType(), (int) $userContext->getUserId(), time()-1)
4040
);
4141
}
4242
}

0 commit comments

Comments
 (0)