Skip to content

Refactor authorization, fix issues#13

Merged
butvinm merged 6 commits intomasterfrom
fixes
Dec 26, 2025
Merged

Refactor authorization, fix issues#13
butvinm merged 6 commits intomasterfrom
fixes

Conversation

@butvinm
Copy link
Member

@butvinm butvinm commented Dec 25, 2025

No description provided.

Replace scattered authorization patterns with Spring Security method-level security:
- Add shared-security module with UserPrincipal and HeaderAuthentication
- Add HeaderAuthenticationFilter (MVC) and HeaderAuthenticationWebFilter (WebFlux)
- Replace requireAdmin() with @PreAuthorize("hasRole('ADMIN')") in user-service
- Replace requireMediumOrAdmin() with @PreAuthorize("hasAnyRole('MEDIUM', 'ADMIN')") in divination-service
- Add AccessDeniedException handlers to all GlobalExceptionHandlers
- Owner-based checks remain in service layer to avoid duplicate DB lookups

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Dec 25, 2025

Code Coverage Report

Overall Project 74.78% -1.5% 🍏
Files changed 79.14% 🍏

Module Coverage
user-service 83.38% -2.99% 🍏
notification-service 74.02% -4.13% 🍏
divination-service 72.05% -0.2% 🍏
Files
Module File Coverage
user-service SecurityConfig.kt 100% 🍏
UserController.kt 100% 🍏
HeaderAuthenticationFilter.kt 97.73% -2.27% 🍏
GlobalExceptionHandler.kt 60.23% -11.74%
notification-service SecurityConfig.kt 100% 🍏
NotificationMapper.kt 100% 🍏
Notification.kt 93.88% -4.08% 🍏
EventConsumer.kt 75.86% 🍏
GlobalExceptionHandler.kt 53.03% -16.67%
HeaderAuthenticationWebFilter.kt 42.19% -57.81%
divination-service SecurityConfig.kt 100% 🍏
HeaderAuthenticationWebFilter.kt 92.19% -7.81% 🍏
InterpretationController.kt 69.06% 🍏
GlobalExceptionHandler.kt 53.58% -0.62% 🍏
SpreadMapper.kt 40.29% 🍏

butvinm and others added 5 commits December 26, 2025 03:01
…ences

Replace generic referenceId/referenceType with domain-specific spreadId
and interpretationId fields in notification schema. This provides clearer
semantics for NEW_INTERPRETATION notifications.

Changes:
- Add V2 migration: add spread_id/interpretation_id, migrate data, drop old columns
- Update Notification entity with new nullable fields
- Update NotificationDto, remove ReferenceType enum
- Update EventConsumer to populate both fields from Kafka event
- Update all unit, integration, and E2E tests
- Update CLAUDE.md documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SpreadMapper was creating InterpretationDto objects inline without using
InterpretationMapper, which caused fileUrl to always be null. Now it
delegates to InterpretationMapper.toDto() which correctly includes the
fileUrl field.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Test verifies that interpretations with file attachments include the
correct fileUrl in the spread details endpoint response.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Test verifies that GET /spreads/{id} returns interpretations with
correct fileUrl after file upload through the gateway.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
All phases completed:
- Phase 1: SpreadMapper refactored to use InterpretationMapper
- Phase 2: Integration test added for fileUrl in spread details
- Phase 3: E2E test added and verified
- Phase 4: Documentation updated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@butvinm butvinm merged commit a336d28 into master Dec 26, 2025
1 check passed
butvinm added a commit that referenced this pull request Jan 12, 2026
Reverts:
- a336d28 Refactor authorization, fix issues (#13)
- 3a23bed Notification and file service (#5)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
butvinm added a commit that referenced this pull request Jan 12, 2026
* Revert last two commits to return to lab3 state

Reverts:
- a336d28 Refactor authorization, fix issues (#13)
- 3a23bed Notification and file service (#5)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update highload-config to lab3-compatible state

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Set config-server default-label to revert-to-lab3

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add highload-config management instructions to CLAUDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant