25 Commits
Author SHA1 Message Date
Dat Dang c864e3afcc TF-4827 Replayable upload body (#4850) 2026-10-13 13:56:25 +07:00
Dang Dat f3f76878e7 2509 Never send credentials with WebFinger discovery requests 2026-10-01 17:06:29 +07:00
Dat Dang e6f9463c61 Allow workplace to refresh jmap token (#4810) 2026-09-15 15:58:43 +07:00
dab246 23818d9959 TF-4790 Add attachment upload regression coverage 2026-09-05 16:10:10 +07:00
dab246 d953645eeb TF-4790 Guard the mobile replay body in _retryUploadRequest and assert probed charset samples 2026-09-05 16:10:10 +07:00
dab246 26e2b0ac1e TF-4790 Replay the upload body with the original RequestOptions on mobile 401 2026-09-05 16:10:10 +07:00
Dat Dang c36ccffc96 TF-4728 Sentry logging drive attachment failure (#4776) 2026-08-28 17:03:51 +07:00
Dat H. Pham bfde3527ab refactor(auth): decouple web refresh error handling from the mobile handler
The web handler routed its two keep-the-session paths through the mobile one,
which had since grown a leading force-logout branch. That branch could not fire
on web — it re-tests the same classifier call the web handler had already
evaluated to false — but the safety rested on a call-ordering invariant inside
the web handler rather than on anything structural. Adding an earlier delegation
would have quietly made it live and started logging web users out on failures
already ruled transient.

Extract the tail both handlers shared into _propagateKeepingSession and have web
call it directly, so the logout branch leaves web's call graph entirely.

Cover the behaviour too: an OAuthAuthorizationError — the mobile error shape —
arriving on web must keep the session. Verified by mutation: re-coupling both
delegation sites and pointing the guard at the mobile classifier fails exactly
these two tests.

Pure move, no behaviour change. Also splits a doc comment that had been merged
into the paragraph above it.
2026-08-12 11:20:53 +07:00
Dat H. Pham fa12f71986 fix(auth): stop double-reporting a rejected mobile token refresh to Sentry
A confirmed mobile rejection was rethrown out of the refresh helper, caught by
the outer handler in onError(), logged there as a generic event, and only then
routed to the platform handler that logged the real structured one. One failure,
two events, the less useful of them arriving first.

Route a rejection the platform handler already classifies straight to it, so the
outer catch never sees it.

Failures that stay unclassified are still rethrown on purpose: the generic event
is then their only trace, and dropping it would make them invisible. Both halves
are covered — one event for a rejection, the generic event retained for the rest.
2026-08-12 11:20:53 +07:00
Dat H. Pham aad7df7b34 fix(auth): force logout when mobile refresh is rejected by the token endpoint
On mobile the refresh runs through flutter_appauth (native), so a rejected
refresh token never reaches Dio and the statusCode == 400 branch is unreachable.
The rejection arrives as an OAuthAuthorizationError carrying the RFC 6749 code
from the response body, and nothing handled it: the dead session was kept, and
because the refresh-attempt marker lives on the request, every new request
retried the same doomed refresh. The mailbox spun forever instead of sending
the user back to login.

Force the logout when — and only when — the classifier confirms a bad-grant
code. Transient codes (server_error, temporarily_unavailable) and failures that
never reached the OAuth server keep the session, so a flaky mobile connection
still does not sign the user out.

Also pin the native-error to domain-error boundary the fix depends on. Every
test so far constructed OAuthAuthorizationError directly, leaving both the
conversion in handleException and the wiring that reaches it unproven — a
plugin upgrade that stopped populating platformErrorDetails.error would have
resurrected the bug with the suite still green. The client test is verified by
mutation: dropping the catch that calls handleException fails it.

The mobile invalid_grant case in the stale-401 group changes verdict here: it
asserted the session survived, which was the bug.
2026-08-12 11:20:53 +07:00
Dat Vu 12f72873e8 TF-4598 Add log to tracing Sentry [Web] - Refresh token invalid grant (#4604) 2026-06-17 14:01:58 +07:00
Dat H. Pham fa325f5b3f add more log and try to write token before prune safety for update token (#4605) 2026-06-11 22:05:18 +07:00
dab246 2574798771 fix: keep session on PlatformException(token_failed) network failure in AuthorizationInterceptors 2026-06-11 10:15:35 +07:00
Dat H. Pham 5233a65c82 Handle refreshToken failed for web (#4559) 2026-05-27 09:23:42 +07:00
Dat Dang bdf59ce9e3 TF-4081 Prevent network error log user out on mobile (#4531) 2026-05-22 14:12:33 +07:00
dab246 8a21e35d1e fix: Prefer reusing AppBaseException instead of redefining the exception contract CacheException and RemoteException 2026-03-10 11:06:16 +07:00
Dat H. Pham d02676dfb7 Retry with separated Dio to avoid Deadlock in error queue 2026-02-10 16:58:58 +07:00
Dat H. Pham b14bb6acc0 Update ADR for OIDC token refresh 2026-02-10 16:58:58 +07:00
Dat H. Pham 8fe935ac30 fix infinitive loop when 401 before expired token 2026-02-10 16:58:58 +07:00
dab246 6e2fbea0c0 test(auth): add unit tests for handling 400 Bad Request during token refresh 2026-02-10 16:58:58 +07:00
dab246 fdda936ac2 TF-4136 Remove all content-length in header request of mock unit test avoid run test fail 2026-01-15 09:46:51 +07:00
dab246 623826d29f TF-2387 Handle logout twake workplace 2024-11-08 14:25:09 +07:00
Dat Vu ca4cf68f87 TF-825 Download email as EML file (#2854) 2024-05-16 15:50:01 +07:00
dab246 498d3cb77b Fix mobile app force logout with multiples request in onError queue 2024-05-03 05:39:36 +07:00
dab246 d98fcf72e0 TF-2461 Write unit test for login AuthorizationInterceptors
Signed-off-by: dab246 <tdvu@linagora.com>

Signed-off-by: dab246 <tdvu@linagora.com>
2024-01-26 07:54:15 +01:00