Skip to content

Refactor HeaderCurrentUserAdapter to SecurityActorAdapter for cle…#36

Merged
mattknatt merged 1 commit intomainfrom
rename/SecurityActorAdapter
Apr 7, 2026
Merged

Refactor HeaderCurrentUserAdapter to SecurityActorAdapter for cle…#36
mattknatt merged 1 commit intomainfrom
rename/SecurityActorAdapter

Conversation

@mattknatt
Copy link
Copy Markdown
Collaborator

@mattknatt mattknatt commented Apr 7, 2026

closes #28

Summary by CodeRabbit

  • Refactor
    • Internal code organization improvements with no impact on user-facing functionality.

…arer naming and consistency across authentication logic
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d74b7ebf-e483-4a7d-833d-6083fd7744c8

📥 Commits

Reviewing files that changed from the base of the PR and between 3630839 and 41bce56.

📒 Files selected for processing (9)
  • AUDIT.md
  • src/main/java/org/example/projektarendehantering/infrastructure/security/SecurityActorAdapter.java
  • src/main/java/org/example/projektarendehantering/infrastructure/web/AuditInterceptor.java
  • src/main/java/org/example/projektarendehantering/presentation/rest/AuditController.java
  • src/main/java/org/example/projektarendehantering/presentation/rest/CaseController.java
  • src/main/java/org/example/projektarendehantering/presentation/rest/EmployeeController.java
  • src/main/java/org/example/projektarendehantering/presentation/rest/PatientController.java
  • src/main/java/org/example/projektarendehantering/presentation/web/AuditUiController.java
  • src/main/java/org/example/projektarendehantering/presentation/web/UiController.java

📝 Walkthrough

Walkthrough

A class-level refactoring renamed HeaderCurrentUserAdapter to SecurityActorAdapter throughout the codebase. All dependency injections, constructor parameters, field references, and method invocations in controllers, interceptors, and documentation were updated consistently to reflect the new adapter name while preserving existing functionality.

Changes

Cohort / File(s) Summary
Core Adapter Rename
src/main/java/org/example/projektarendehantering/infrastructure/security/SecurityActorAdapter.java
Spring @Component class renamed from HeaderCurrentUserAdapter to SecurityActorAdapter; public method currentUser() logic unchanged.
Documentation
AUDIT.md
Updated actor-resolution documentation to reference SecurityActorAdapter instead of HeaderCurrentUserAdapter; control-flow behavior on failure and role-mapping outcomes preserved.
Infrastructure Layer
src/main/java/org/example/projektarendehantering/infrastructure/web/AuditInterceptor.java
Updated injected field type and constructor parameter from HeaderCurrentUserAdapter to SecurityActorAdapter; actor lookup calls now use securityActorAdapter.currentUser().
REST Controllers
src/main/java/org/example/projektarendehantering/presentation/rest/AuditController.java, CaseController.java, EmployeeController.java, PatientController.java
Replaced security dependency injection from HeaderCurrentUserAdapter to SecurityActorAdapter in constructors and all currentUser() call sites within service method invocations.
Web UI Controllers
src/main/java/org/example/projektarendehantering/presentation/web/AuditUiController.java, UiController.java
Updated constructor parameters and stored fields to inject SecurityActorAdapter instead of HeaderCurrentUserAdapter; all service calls now pass securityActorAdapter.currentUser().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~11 minutes

Possibly related issues

  • Rename HeaderCurrentUserAdapter #28 — Directly addresses the same class-level rename from HeaderCurrentUserAdapter to SecurityActorAdapter with corresponding call-site updates across the codebase.

Possibly related PRs

  • Audit class #32 — Relates through audit interceptor and controller implementations that depend on the security adapter being renamed in this PR.
  • Employee entity etc #25 — Shares controller and interceptor call sites that now use the renamed SecurityActorAdapter for current-user resolution.
  • New structure #13 — Modifies the same HeaderCurrentUserAdapter class that is being renamed and replaced in this PR's refactoring.

Poem

🐰 A hop, a skip, from Header's name,
To Security—a clearer claim!
Adapter renamed, with steady care,
All controllers dance without a spare.
The rabbit grins: refactoring's done! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: renaming HeaderCurrentUserAdapter to SecurityActorAdapter, which is accurately reflected across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rename/SecurityActorAdapter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mattknatt mattknatt merged commit cf30359 into main Apr 7, 2026
2 checks passed
@mattknatt mattknatt deleted the rename/SecurityActorAdapter branch April 7, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename HeaderCurrentUserAdapter

1 participant