File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
bindings/matrix-sdk-ffi/src Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ pub struct HomeserverLoginDetails {
26
26
pub ( crate ) url : String ,
27
27
pub ( crate ) sliding_sync_version : SlidingSyncVersion ,
28
28
pub ( crate ) supports_oidc_login : bool ,
29
+ pub ( crate ) supports_oidc_registration : bool ,
29
30
pub ( crate ) supports_password_login : bool ,
30
31
}
31
32
@@ -46,6 +47,11 @@ impl HomeserverLoginDetails {
46
47
self . supports_oidc_login
47
48
}
48
49
50
+ /// Whether the current homeserver supports registration using OIDC.
51
+ pub fn supports_oidc_registration ( & self ) -> bool {
52
+ self . supports_oidc_registration
53
+ }
54
+
49
55
/// Whether the current homeserver supports the password login flow.
50
56
pub fn supports_password_login ( & self ) -> bool {
51
57
self . supports_password_login
Original file line number Diff line number Diff line change @@ -266,14 +266,29 @@ impl Client {
266
266
impl Client {
267
267
/// Information about login options for the client's homeserver.
268
268
pub async fn homeserver_login_details ( & self ) -> Arc < HomeserverLoginDetails > {
269
- let supports_oidc_login = self . inner . oidc ( ) . fetch_authentication_issuer ( ) . await . is_ok ( ) ;
269
+ let oidc = self . inner . oidc ( ) ;
270
+ let ( supports_oidc_login, supports_oidc_registration) =
271
+ if let Ok ( issuer) = oidc. fetch_authentication_issuer ( ) . await {
272
+ if let Ok ( metadata) = & oidc. given_provider_metadata ( & issuer) . await {
273
+ metadata
274
+ . prompt_values_supported
275
+ . as_ref ( )
276
+ . map ( |prompts| ( true , prompts. contains ( & SdkOidcPrompt :: Create ) ) )
277
+ . unwrap_or ( ( true , false ) )
278
+ } else {
279
+ ( true , false )
280
+ }
281
+ } else {
282
+ ( false , false )
283
+ } ;
270
284
let supports_password_login = self . supports_password_login ( ) . await . ok ( ) . unwrap_or ( false ) ;
271
285
let sliding_sync_version = self . sliding_sync_version ( ) ;
272
286
273
287
Arc :: new ( HomeserverLoginDetails {
274
288
url : self . homeserver ( ) ,
275
289
sliding_sync_version,
276
290
supports_oidc_login,
291
+ supports_oidc_registration,
277
292
supports_password_login,
278
293
} )
279
294
}
You can’t perform that action at this time.
0 commit comments