Kévin Commaille
78b79a758f
feat(oauth-cli): Use OAuthRegistrationStore
...
It's probably the recommended way to do registration when the client can create files.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-24 09:32:05 +00:00
Kévin Commaille
29f6606d99
refactor(examples): Rename oidc_cli to oauth_cli
...
And update the docs.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-24 09:32:05 +00:00
Kévin Commaille
94f0beec51
chore: Add changelog for login with registration methods
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 19:17:13 +01:00
Kévin Commaille
590d1d7890
test(oauth): Add test for OAuth::use_registration_method
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 19:17:13 +01:00
Kévin Commaille
400c92fc89
refactor(oauth): Reuse the AuthorizationServerMetadata when possible
...
Avoids repeated calls to the same endpoint in the same flow.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 19:17:13 +01:00
Kévin Commaille
b3e82a05db
refactor(oauth): Merge OAuth::login_with_oidc_callback() and OAuth::finish_login()
...
Accept a URL or a query string for simplicity.
That way we don't need to expose AuthorizationResponse.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 19:17:13 +01:00
Kévin Commaille
a8aa364757
refactor(oauth): Allow to use any registration method with OAuth::login
...
Gets rid of OAuth::url_for_oidc since it can be replaced by a call to
OAuth::login now.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 19:17:13 +01:00
Kévin Commaille
7457ecb1a8
feat(oauth): Allow to use any registration method with login_with_qr_code
...
Introduces the ClientRegistrationMethod type
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 19:17:13 +01:00
Kévin Commaille
01caf56edc
refactor(oauth): Rename OAuth::configure to restore_or_register_client
...
The name is more explicit about what the function does.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 19:17:13 +01:00
Kévin Commaille
6f07d008c9
refactor(oauth): Inline store_client_registration and load_client_registration
...
They are one- or two-liners and are only used once.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 19:17:13 +01:00
Kévin Commaille
b408087320
refactor(oauth): OAuth::login doesn't return a Result
...
There is actually no way to get an error.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 19:17:13 +01:00
Kévin Commaille
22cbce82ce
refactor(oauth): Use tokio::fs APIs instead of spawn_blocking
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
ecdc68aa1c
chore: Add changelog for OidcRegistrations changes
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
4a0bf80ab0
test(oauth): Add checks that client ID is written to OAuthRegistrationStore
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
095425f664
refactor(oauth): Do not take static registrations in default OAuthRegistrationStore constructor
...
It complicates the constructor and most clients will probably not need to use it.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
ca4e212e98
refactor(oauth): Make OAuthRegistrationStore methods async
...
Since they perform blocking I/O we probably don't want to block a thread on that.
We use spawn_blocking, the alternative would be to use tokio::fs functions, which do the same thing and would require to load the whole file content in memory before (de)serialization.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
0b0f84b784
refactor(oauth): Don't ignore errors when reading the file of the OAuthRegistrationStore
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
fbd4a7dc38
refactor(oauth): Get rid of OAuthError::UnknownError
...
Instead add a variant for OAuthRegistrationStoreError to
OAuthClientRegistrationError.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
cb90d7fee6
refactor(oauth): Avoid impossible error
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
1a79ea94ed
refactor(oauth): Improve OAuthRegistrationError variants
...
Make them more precise instead of wrapping several error types into a single variant.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
c3328a03f6
refactor(oauth): Avoid unnecessary allocations when accessing OAuthRegistrationStore data
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
6803538c2e
refactor(oauth): Rename OidcRegistrations to OAuthRegistrationStore
...
Use the same prefix as the other types in the OAuth 2.0 API, and use the
same suffix as other data-persisting APIs for consistency.
It also avoids to have two modules with very similar names, the only
difference being a trailing `s`.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Kévin Commaille
9d27e9b379
refactor(oauth): Make registrations module private
...
Since it only contains 2 types, it doesn't seem worth it to expose it,
we can just expose the types elsewhere.
2025-03-21 10:49:46 +01:00
Kévin Commaille
8683ca4d13
refactor(oauth): Re-export ClientID from the oauth module
...
Since it is now used everywhere, there is no reason to reexport it from
the registrations module.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-21 10:49:46 +01:00
Benjamin Bouvier
d4f5ac152a
feat(ffi): log the log targets and levels
2025-03-21 09:37:25 +01:00
Benjamin Bouvier
31a1724390
feat(ffi): add support for log bundles
2025-03-21 09:37:25 +01:00
Kévin Commaille
c034818c92
chore: Add changelog for OAuth::login changes
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-20 16:02:18 +00:00
Kévin Commaille
e1fe479008
refactor(oauth): Get rid of OAuthError::MissingDeviceId
...
Since we are the ones generating the device ID, we have a way to avoid this error. Even if in practice, it's probably always included in the server's response.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-20 16:02:18 +00:00
Kévin Commaille
530659b59d
feat(oauth): Allow user to log into the same session again
...
Can be useful with soft logouts, without requiring the user to recreate a new Client to log in again.
Returns an error if the new session is different from the current one.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-20 16:02:18 +00:00
Kévin Commaille
45dd96e30a
refactor(oauth): Merge finish_authorization and finish_login
...
That way users only need to call finish_login, since there is no other
reason to call finish_authorization currently.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-20 16:02:18 +00:00
Hugh Nimmo-Smith
3f4c1fd1bb
feat(widgets, element-call): Update the widget url generation
...
Fixes : #4793
There was a previous PR https://github.com/matrix-org/matrix-rust-sdk/pull/4802 which attempted to implement this, but missed some backwards compatibility needs.
This updated PR has the original commit and then additional commits to add the compatibility (along with tests for the new intent param generally).
2025-03-20 14:28:45 +00:00
Benjamin Bouvier
5acaaf5865
fix(ffi): call the back-pagination status callback immediately
matrix-sdk-ffi/20250320
2025-03-20 10:26:54 +01:00
Benjamin Bouvier
156501dbbd
chore(event cache): add logs here and there
2025-03-20 10:26:54 +01:00
Hugh Nimmo-Smith
a0eb9340d5
Revert "feat(widgets, element-call) Update the widget url generation ( #4802 )"
...
This reverts commit 3b9ae3e65e .
2025-03-19 17:49:21 +01:00
Jonas Richard Richter
dbdbfd0b38
feat(notification): Add support for custom conditional push rules ( #4587 )
...
---
Signed-off-by: Jonas Richard Richter <jonas-richard.richter@telekom.de >
2025-03-19 12:50:02 +01:00
Ivan Enderlin
1d9d4d3b3a
chore(sdk): Annotate RoomEventCacheState::remove_events with #[instrument].
...
This patch annotates `RoomEventCacheState::remove_events` with the
`#[instrument]` proc-macro so that it is logged when called.
2025-03-19 12:15:59 +01:00
Ivan Enderlin
8d16b3265c
refactor(sdk): RoomEventCacheState checks if events to remove aren't empty.
...
This patch updates `RoomEventCacheState::remove_events` to check whether
the set of events are not empty before removing them. When removing
`in_memory_events`, it avoids taking a write lock on the `RoomEvents`
for nothing for example.
2025-03-19 12:15:59 +01:00
Ivan Enderlin
9c37a0393c
fix(base): Check the lazy_previous of the first chunk matches the new first chunk.
...
This patch adds a new check when inserting a new first chunk. It makes
some tests to fail but because they were not realistic. This patch then
updates these tests.
2025-03-19 11:18:05 +01:00
Ivan Enderlin
82ef6232e7
doc(sdk): Precise in which context a variable can or cannot be used.
2025-03-19 11:02:09 +01:00
Timo
3b9ae3e65e
feat(widgets, element-call) Update the widget url generation ( #4802 )
...
Fixes: https://github.com/matrix-org/matrix-rust-sdk/issues/4793
Co-authored-by: Valere <bill.carson@valrsoft.com >
2025-03-19 11:29:07 +02:00
Kévin Commaille
a539518cd4
chore: Add changelog for Oidc renaming
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00
Kévin Commaille
f61cd60147
refactor(oauth): Change the Oauth prefix in test utils with OAuth
...
For consistency.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00
Kévin Commaille
b9c970dc43
refactor(oauth): Rename OauthGrantType to OAuthGrantType
...
For consistency.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00
Kévin Commaille
ba5e395a59
refactor(oauth): Change Oauth prefix for error types to OAuth
...
For consistency.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00
Kévin Commaille
c46e6623fe
refactor(oauth): Rename OauthClient and OauthHttpClient to OAuthClient and OAuthHttpClient
...
For consistency
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00
Kévin Commaille
7ad1b113dc
doc(oauth): Change mentions of OpenID Connect to OAuth 2.0
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00
Kévin Commaille
c0d3ed1a90
refactor(oauth): Rename provider_metadata to server_metadata
...
"Provider" is an OpenID Connect term. OAuth 2.0 uses the "authorization
server" term.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00
Kévin Commaille
00d7a77ebe
refactor(encryption): Rename OidcCrossSigningResetInfo to OAuthCrossSigningResetInfo
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00
Kévin Commaille
f29d3fd666
refactor(oauth): Rename OidcAuthCodeUrlBuilder to OAuthAuthCodeUrlBuilder
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00
Kévin Commaille
47204830a9
refactor(oauth): Rename OidcError to OAuthError
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2025-03-18 17:18:34 +01:00