1414// See the License for the specific language governing permissions and
1515// limitations under the License.
1616
17+ #[ cfg( feature = "experimental-oidc" ) ]
18+ use std:: ops:: Deref ;
1719#[ cfg( feature = "experimental-sliding-sync" ) ]
1820use std:: sync:: RwLock as StdRwLock ;
1921use std:: {
2022 collections:: { btree_map, BTreeMap } ,
2123 fmt:: { self , Debug } ,
2224 future:: Future ,
23- ops:: Deref ,
2425 pin:: Pin ,
2526 sync:: { Arc , Mutex as StdMutex } ,
2627} ;
2728
2829use dashmap:: DashMap ;
2930use eyeball:: { Observable , SharedObservable , Subscriber } ;
3031use futures_core:: Stream ;
32+ #[ cfg( feature = "experimental-oidc" ) ]
3133use mas_oidc_client:: {
3234 error:: {
3335 Error as OidcClientError , ErrorBody as OidcErrorBody , HttpError as OidcHttpError ,
@@ -42,6 +44,8 @@ use matrix_sdk_base::{
4244 SyncOutsideWasm ,
4345} ;
4446use matrix_sdk_common:: instant:: Instant ;
47+ #[ cfg( feature = "experimental-oidc" ) ]
48+ use ruma:: api:: client:: error:: ErrorKind ;
4549#[ cfg( feature = "appservice" ) ]
4650use ruma:: TransactionId ;
4751use ruma:: {
@@ -56,7 +60,6 @@ use ruma::{
5660 get_capabilities:: { self , Capabilities } ,
5761 get_supported_versions,
5862 } ,
59- error:: ErrorKind ,
6063 filter:: { create_filter:: v3:: Request as FilterUploadRequest , FilterDefinition } ,
6164 membership:: { join_room_by_id, join_room_by_id_or_alias} ,
6265 profile:: get_profile,
@@ -83,7 +86,7 @@ use url::Url;
8386#[ cfg( feature = "e2e-encryption" ) ]
8487use crate :: encryption:: Encryption ;
8588#[ cfg( feature = "experimental-oidc" ) ]
86- use crate :: oidc:: Oidc ;
89+ use crate :: oidc:: { Oidc , OidcError } ;
8790use crate :: {
8891 authentication:: AuthData ,
8992 config:: RequestConfig ,
@@ -94,7 +97,6 @@ use crate::{
9497 http_client:: HttpClient ,
9598 matrix_auth:: MatrixAuth ,
9699 notification_settings:: NotificationSettings ,
97- oidc:: OidcError ,
98100 sync:: { RoomUpdate , SyncResponse } ,
99101 Account , AuthApi , AuthSession , Error , Media , RefreshTokenError , Result , Room ,
100102 TransmissionProgress ,
@@ -434,7 +436,12 @@ impl Client {
434436 if let Some ( discovered_server) = & self . inner . authentication_server_info {
435437 return Some ( discovered_server) ;
436438 } ;
437- self . inner . auth_data . get ( ) . and_then ( |d| d. as_oidc ( ) . map ( |o| & o. issuer_info ) )
439+
440+ match self . inner . auth_data . get ( ) ? {
441+ AuthData :: Matrix ( _) => None ,
442+ #[ cfg( feature = "experimental-oidc" ) ]
443+ AuthData :: Oidc ( o) => Some ( & o. issuer_info ) ,
444+ }
438445 }
439446
440447 /// The sliding sync proxy that is trusted by the homeserver.
@@ -1346,6 +1353,7 @@ impl Client {
13461353 // Refreshing access tokens is not supported by this `Session`, ignore.
13471354 self . broadcast_unknown_token ( soft_logout) ;
13481355 }
1356+ #[ cfg( feature = "experimental-oidc" ) ]
13491357 RefreshTokenError :: Oidc ( oidc_error) => {
13501358 let oidc_error = oidc_error. deref ( ) ;
13511359 match oidc_error {
0 commit comments