File tree Expand file tree Collapse file tree 3 files changed +32
-13
lines changed Expand file tree Collapse file tree 3 files changed +32
-13
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file.
6
6
7
7
## [ Unreleased] - ReleaseDate
8
8
9
+ Additions:
10
+
11
+ - Add ` HomeserverLoginDetails::supports_sso_login ` for legacy SSO support infomation.
12
+ This is primarily for Element X to give a dedicated error message in case
13
+ it connects a homeserver with only this method avaliable.
14
+ ([ #5222 ] ( https://github.com/matrix-org/matrix-rust-sdk/pull/5222 ) )
15
+
9
16
## [ 0.12.0] - 2025-06-10
10
17
11
18
Breaking changes:
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ pub struct HomeserverLoginDetails {
23
23
pub ( crate ) sliding_sync_version : SlidingSyncVersion ,
24
24
pub ( crate ) supports_oidc_login : bool ,
25
25
pub ( crate ) supported_oidc_prompts : Vec < OidcPrompt > ,
26
+ pub ( crate ) supports_sso_login : bool ,
26
27
pub ( crate ) supports_password_login : bool ,
27
28
}
28
29
@@ -43,6 +44,11 @@ impl HomeserverLoginDetails {
43
44
self . supports_oidc_login
44
45
}
45
46
47
+ /// Whether the current homeserver supports login using legacy SSO.
48
+ pub fn supports_sso_login ( & self ) -> bool {
49
+ self . supports_sso_login
50
+ }
51
+
46
52
/// The prompts advertised by the authentication issuer for use in the login
47
53
/// URL.
48
54
pub fn supported_oidc_prompts ( & self ) -> Vec < OidcPrompt > {
Original file line number Diff line number Diff line change @@ -335,14 +335,32 @@ impl Client {
335
335
}
336
336
} ;
337
337
338
- let supports_password_login = self . supports_password_login ( ) . await . ok ( ) . unwrap_or ( false ) ;
338
+ let login_types = self . inner . matrix_auth ( ) . get_login_types ( ) . await . ok ( ) ;
339
+ let supports_password_login = login_types
340
+ . as_ref ( )
341
+ . map ( |login_types| {
342
+ login_types. flows . iter ( ) . any ( |login_type| {
343
+ matches ! ( login_type, get_login_types:: v3:: LoginType :: Password ( _) )
344
+ } )
345
+ } )
346
+ . unwrap_or ( false ) ;
347
+ let supports_sso_login = login_types
348
+ . as_ref ( )
349
+ . map ( |login_types| {
350
+ login_types
351
+ . flows
352
+ . iter ( )
353
+ . any ( |login_type| matches ! ( login_type, get_login_types:: v3:: LoginType :: Sso ( _) ) )
354
+ } )
355
+ . unwrap_or ( false ) ;
339
356
let sliding_sync_version = self . sliding_sync_version ( ) ;
340
357
341
358
Arc :: new ( HomeserverLoginDetails {
342
359
url : self . homeserver ( ) ,
343
360
sliding_sync_version,
344
361
supports_oidc_login,
345
362
supported_oidc_prompts,
363
+ supports_sso_login,
346
364
supports_password_login,
347
365
} )
348
366
}
@@ -733,18 +751,6 @@ impl Client {
733
751
}
734
752
}
735
753
736
- impl Client {
737
- /// Whether or not the client's homeserver supports the password login flow.
738
- pub ( crate ) async fn supports_password_login ( & self ) -> anyhow:: Result < bool > {
739
- let login_types = self . inner . matrix_auth ( ) . get_login_types ( ) . await ?;
740
- let supports_password = login_types
741
- . flows
742
- . iter ( )
743
- . any ( |login_type| matches ! ( login_type, get_login_types:: v3:: LoginType :: Password ( _) ) ) ;
744
- Ok ( supports_password)
745
- }
746
- }
747
-
748
754
#[ matrix_sdk_ffi_macros:: export]
749
755
impl Client {
750
756
/// The sliding sync version.
You can’t perform that action at this time.
0 commit comments