Skip to content

feat: implement Infrastructure layer for User Logout / ユーザーログアウトのInfrastructure層実装#536

Merged
zigzagdev merged 2 commits into
feat/user-logoutfrom
feat/user-logout-infra
Jul 15, 2026
Merged

feat: implement Infrastructure layer for User Logout / ユーザーログアウトのInfrastructure層実装#536
zigzagdev merged 2 commits into
feat/user-logoutfrom
feat/user-logout-infra

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

Motivation / 目的

Add revokeCurrentToken to TokenServiceInterface and implement it in SanctumTokenService to support single-session logout.

Logout operates on personal_access_tokens, not on user data, so no changes to UserRepositroyInterface are needed — the plain-text token alone identifies the session to end.

ログアウト時に現在のセッションのみを無効化するため、TokenServiceInterfacerevokeCurrentToken を追加し、SanctumTokenService に実装しました。
ログアウトは personal_access_tokens テーブルのみを操作するため、UserRepositroyInterface の変更は不要です。

What I have done / 実施内容

  • TokenServiceInterface: revokeCurrentToken(string $plainTextToken): void を追加
  • SanctumTokenService: PersonalAccessToken::findToken() でトークンを検索し削除。トークンが存在しない場合は何もしない(冪等)

Test Results / テスト結果

  • SanctumTokenServiceTest::test_revokeCurrentToken_deletes_the_given_token
  • SanctumTokenServiceTest::test_revokeCurrentToken_does_nothing_when_token_not_found

Closes #409

@zigzagdev zigzagdev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@zigzagdev
zigzagdev merged commit e9b1016 into feat/user-logout Jul 15, 2026
26 checks passed
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.83%. Comparing base (7ce1092) to head (d6a5f04).
⚠️ Report is 3 commits behind head on feat/user-logout.

Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                   @@
##             feat/user-logout     #536      +/-   ##
======================================================
+ Coverage               61.75%   61.83%   +0.07%     
- Complexity               1585     1589       +4     
======================================================
  Files                     132      132              
  Lines                    8153     8169      +16     
======================================================
+ Hits                     5035     5051      +16     
  Misses                   3118     3118              
Files with missing lines Coverage Δ
...kages/Domains/User/Service/SanctumTokenService.php 100.00% <100.00%> (ø)
...ins/User/Tests/Service/SanctumTokenServiceTest.php 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zigzagdev
zigzagdev deleted the feat/user-logout-infra branch July 15, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement Infrastructure layer for User Logout / ユーザーログアウトのInfrastructure層実装

1 participant