Skip to content

fix(ocm): OCM token refresh and remote detection - #2

Closed
MahdiBaghbani wants to merge 126 commits into
enriquepablo:masterfrom
MahdiBaghbani:sta-milestone-6/ocm-code-flow
Closed

fix(ocm): OCM token refresh and remote detection#2
MahdiBaghbani wants to merge 126 commits into
enriquepablo:masterfrom
MahdiBaghbani:sta-milestone-6/ocm-code-flow

Conversation

@MahdiBaghbani

@MahdiBaghbani MahdiBaghbani commented Mar 25, 2026

Copy link
Copy Markdown

This PR is a part of cs3org/OCM-STA#16

Summary

This work improves OCM interoperability when Nextcloud federates with a Reva peer that supports the authorization code flow.

Bearer tokens obtained through OCM exchange are now stored in the dedicated access-token fields (with persisted expiry), and are reloaded when external shares are remounted. They are no longer carried via the legacy password path.

Token refresh honors the expiry signaled by the sender, avoids duplicate refresh when another process has already renewed the token, and applies backoff on repeated exchange attempts so a failing refresh does not overload the remote token endpoint.

After refresh, cloud-federation share metadata stays consistent with the live OCM response (share URI, permissions, and related fields). status.php handling is tightened so a Reva-branded response is not classified as an ownCloud-style peer when it is not, while legitimate OCM discovery continues to succeed.

There is also a complementary PR in Reva as well cs3org/reva#5552

Motivation

The issues above appeared in end-to-end testing against a code-flow-capable Reva. Addressing status.php misclassification on the Nextcloud side avoids depending on a long-lived Reva-side status.php compatibility shim.

For Enrique

This PR is against your branch because that is where the work should land first. You already have a PR from that branch into nextcloud/server master, so once you fold this in, the same commits should show up in that upstream PR without opening a parallel PR from my fork.

Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
…okens

Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
…h token rather that request

Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
…ing a remote share

Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
…en, it may be an access token

Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
… get an access token to use as bearer token

Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
…urlencoded

Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
… requirement, in addition to the exchaange-token capability

Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
…ent the IUserSession interface

Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
@mickenordin
mickenordin force-pushed the master branch 10 times, most recently from f7632f8 to 19f76b9 Compare May 13, 2026 09:32
@mickenordin
mickenordin force-pushed the master branch 5 times, most recently from 63f9205 to e97cfe9 Compare May 17, 2026 17:05
@enriquepablo
enriquepablo force-pushed the master branch 2 times, most recently from 6c86ce4 to a90d003 Compare May 22, 2026 15:19
@mickenordin
mickenordin force-pushed the master branch 11 times, most recently from 54b788c to 925817e Compare May 29, 2026 10:36
@enriquepablo

Copy link
Copy Markdown
Owner

outdated

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.

2 participants