Parent Issue / 親Issue
#408
Motivation / 目的
Add revokeCurrentToken to TokenServiceInterface and implement it in SanctumTokenService for single-session logout.
ログアウト時に現在のトークンだけを削除するため、TokenServiceInterface にメソッドを追加し、SanctumTokenService に実装します。
What to do / 実施内容
TokenServiceInterface.php: revokeCurrentToken(string $plainTextToken): void を追加
SanctumTokenService.php: revokeCurrentToken を実装
PersonalAccessToken::findToken($plainTextToken) でトークンを検索し削除
- トークンが存在しない場合は何もしない(冪等)
Note: revokeAllTokens は既に実装済み。今回は現在のセッションのみ削除する revokeCurrentToken を追加する。
Tests / テスト
test_revokeCurrentToken_deletes_the_given_token
test_revokeCurrentToken_does_nothing_when_token_not_found
Parent Issue / 親Issue
#408
Motivation / 目的
Add
revokeCurrentTokentoTokenServiceInterfaceand implement it inSanctumTokenServicefor single-session logout.ログアウト時に現在のトークンだけを削除するため、
TokenServiceInterfaceにメソッドを追加し、SanctumTokenServiceに実装します。What to do / 実施内容
TokenServiceInterface.php:revokeCurrentToken(string $plainTextToken): voidを追加SanctumTokenService.php:revokeCurrentTokenを実装PersonalAccessToken::findToken($plainTextToken)でトークンを検索し削除Tests / テスト
test_revokeCurrentToken_deletes_the_given_tokentest_revokeCurrentToken_does_nothing_when_token_not_found