fix(oidc): extract JwtService via app_data instead of web::Data param #91

Merged
YousifShkara merged 1 commit from fix/oidc-silent-sso-via-access-token into main 2026-06-10 03:02:54 +02:00
Owner

Previous commit's jwt_service: web::Data<Arc<JwtService>> handler param produced a 500 ("Requested application data is not configured correctly") on every /oauth2/authorize because main.rs registers JwtService as a bare Arc<JwtService> via .app_data(jwt_service.clone()) rather than wrapping it in web::Data::new(...). The web::Data<T> extractor specifically looks for Data<T> in the registry; bare Arc<T> is invisible to it.

Both Drillmark and Mokosh hit the same broken handler (every OIDC client lands at bunyip's /authorize) so both flows 500'd. Fix is to read the bare Arc out of req.app_data directly, matching the pattern bunyip-domain's auth middleware uses (crates/bunyip-domain/src/middleware/auth.rs:160).

AuthService stays as a web::Data<Arc<AuthService>> param because main.rs:594 does wrap that one in web::Data::new(...). The asymmetric registration is preexisting and not worth re-plumbing in this PR; matching the consumer to whichever shape each service is already registered as keeps the diff bounded.

#DMARC-21

Previous commit's `jwt_service: web::Data<Arc<JwtService>>` handler param produced a 500 ("Requested application data is not configured correctly") on every /oauth2/authorize because main.rs registers JwtService as a bare `Arc<JwtService>` via `.app_data(jwt_service.clone())` rather than wrapping it in `web::Data::new(...)`. The `web::Data<T>` extractor specifically looks for `Data<T>` in the registry; bare `Arc<T>` is invisible to it. Both Drillmark and Mokosh hit the same broken handler (every OIDC client lands at bunyip's /authorize) so both flows 500'd. Fix is to read the bare Arc out of `req.app_data` directly, matching the pattern bunyip-domain's auth middleware uses (`crates/bunyip-domain/src/middleware/auth.rs:160`). AuthService stays as a `web::Data<Arc<AuthService>>` param because main.rs:594 does wrap that one in `web::Data::new(...)`. The asymmetric registration is preexisting and not worth re-plumbing in this PR; matching the consumer to whichever shape each service is already registered as keeps the diff bounded. #DMARC-21
fix(oidc): extract JwtService via app_data instead of web::Data param
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt / clippy / build / test (pull_request) Successful in 1m34s
782caa3244
Previous commit's `jwt_service: web::Data<Arc<JwtService>>` handler param produced a 500 ("Requested application data is not configured correctly") on every /oauth2/authorize because main.rs registers JwtService as a bare `Arc<JwtService>` via `.app_data(jwt_service.clone())` rather than wrapping it in `web::Data::new(...)`. The `web::Data<T>` extractor specifically looks for `Data<T>` in the registry; bare `Arc<T>` is invisible to it.

Both Drillmark and Mokosh hit the same broken handler (every OIDC client lands at bunyip's /authorize) so both flows 500'd. Fix is to read the bare Arc out of `req.app_data` directly, matching the pattern bunyip-domain's auth middleware uses (`crates/bunyip-domain/src/middleware/auth.rs:160`).

AuthService stays as a `web::Data<Arc<AuthService>>` param because main.rs:594 does wrap that one in `web::Data::new(...)`. The asymmetric registration is preexisting and not worth re-plumbing in this PR; matching the consumer to whichever shape each service is already registered as keeps the diff bounded.

#DMARC-21
YousifShkara deleted branch fix/oidc-silent-sso-via-access-token 2026-06-10 03:02:54 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/bunyip!91
No description provided.