@@ -225,7 +225,6 @@ impl OAuthCtx {
225225}
226226
227227pub ( crate ) struct OAuthAuthData {
228- pub ( crate ) issuer : Url ,
229228 pub ( crate ) client_id : ClientId ,
230229 /// The data necessary to validate authorization responses.
231230 authorization_data : Mutex < HashMap < CsrfToken , AuthorizationValidationData > > ,
@@ -234,9 +233,7 @@ pub(crate) struct OAuthAuthData {
234233#[ cfg( not( tarpaulin_include) ) ]
235234impl fmt:: Debug for OAuthAuthData {
236235 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
237- f. debug_struct ( "OAuthAuthData" )
238- . field ( "issuer" , & self . issuer . as_str ( ) )
239- . finish_non_exhaustive ( )
236+ f. debug_struct ( "OAuthAuthData" ) . finish_non_exhaustive ( )
240237 }
241238}
242239
@@ -457,7 +454,7 @@ impl OAuth {
457454 . or_else ( || static_registrations. get ( & server_metadata. issuer ) ) ;
458455
459456 if let Some ( client_id) = client_id {
460- self . restore_registered_client ( server_metadata . issuer . clone ( ) , client_id. clone ( ) ) ;
457+ self . restore_registered_client ( client_id. clone ( ) ) ;
461458 return Ok ( ( ) ) ;
462459 }
463460 }
@@ -467,15 +464,6 @@ impl OAuth {
467464 Ok ( ( ) )
468465 }
469466
470- /// The OAuth 2.0 authorization server used for authorization.
471- ///
472- /// Returns `None` if the client was not registered or if the registration
473- /// was not restored with [`OAuth::restore_registered_client()`] or
474- /// [`OAuth::restore_session()`].
475- pub fn issuer ( & self ) -> Option < & Url > {
476- self . data ( ) . map ( |data| & data. issuer )
477- }
478-
479467 /// The account management actions supported by the authorization server's
480468 /// account management URL.
481469 ///
@@ -629,8 +617,7 @@ impl OAuth {
629617 pub fn user_session ( & self ) -> Option < UserSession > {
630618 let meta = self . client . session_meta ( ) ?. to_owned ( ) ;
631619 let tokens = self . client . session_tokens ( ) ?;
632- let issuer = self . data ( ) ?. issuer . clone ( ) ;
633- Some ( UserSession { meta, tokens, issuer } )
620+ Some ( UserSession { meta, tokens } )
634621 }
635622
636623 /// The full OAuth 2.0 session of this client.
@@ -655,11 +642,6 @@ impl OAuth {
655642 ///
656643 /// * `client_metadata` - The serialized client metadata to register.
657644 ///
658- /// The client ID in the response should be persisted for future use and
659- /// reused for the same authorization server, identified by the
660- /// [`OAuth::issuer()`], along with the client metadata sent to the server,
661- /// even for different sessions or user accounts.
662- ///
663645 /// # Panic
664646 ///
665647 /// Panics if the authentication data was already set.
@@ -672,7 +654,7 @@ impl OAuth {
672654 /// # use matrix_sdk::authentication::oauth::registration::ClientMetadata;
673655 /// # use ruma::serde::Raw;
674656 /// # let client_metadata = unimplemented!();
675- /// # fn persist_client_registration (_: & url::Url, _: &Raw<ClientMetadata> , _: &ClientId) {}
657+ /// # fn persist_client_registration (_: url::Url, _: &ClientId) {}
676658 /// # _ = async {
677659 /// let server_name = ServerName::parse("myhomeserver.org")?;
678660 /// let client = Client::builder().server_name(&server_name).build().await?;
@@ -697,9 +679,8 @@ impl OAuth {
697679 ///
698680 /// // The API only supports clients without secrets.
699681 /// let client_id = response.client_id;
700- /// let issuer = oauth.issuer().expect("issuer should be set after registration");
701682 ///
702- /// persist_client_registration(issuer, &client_metadata , &client_id);
683+ /// persist_client_registration(client.homeserver() , &client_id);
703684 /// # anyhow::Ok(()) };
704685 /// ```
705686 pub async fn register_client (
@@ -725,10 +706,7 @@ impl OAuth {
725706
726707 // The format of the credentials changes according to the client metadata that
727708 // was sent. Public clients only get a client ID.
728- self . restore_registered_client (
729- server_metadata. issuer . clone ( ) ,
730- registration_response. client_id . clone ( ) ,
731- ) ;
709+ self . restore_registered_client ( registration_response. client_id . clone ( ) ) ;
732710
733711 Ok ( registration_response)
734712 }
@@ -744,17 +722,14 @@ impl OAuth {
744722 ///
745723 /// # Arguments
746724 ///
747- /// * `issuer` - The authorization server that was used to register the
748- /// client.
749- ///
750725 /// * `client_id` - The unique identifier to authenticate the client with
751726 /// the server, obtained after registration.
752727 ///
753728 /// # Panic
754729 ///
755730 /// Panics if authentication data was already set.
756- pub fn restore_registered_client ( & self , issuer : Url , client_id : ClientId ) {
757- let data = OAuthAuthData { issuer , client_id, authorization_data : Default :: default ( ) } ;
731+ pub fn restore_registered_client ( & self , client_id : ClientId ) {
732+ let data = OAuthAuthData { client_id, authorization_data : Default :: default ( ) } ;
758733
759734 self . client
760735 . auth_ctx ( )
@@ -783,9 +758,9 @@ impl OAuth {
783758 session : OAuthSession ,
784759 room_load_settings : RoomLoadSettings ,
785760 ) -> Result < ( ) > {
786- let OAuthSession { client_id, user : UserSession { meta, tokens, issuer } } = session;
761+ let OAuthSession { client_id, user : UserSession { meta, tokens } } = session;
787762
788- let data = OAuthAuthData { issuer , client_id, authorization_data : Default :: default ( ) } ;
763+ let data = OAuthAuthData { client_id, authorization_data : Default :: default ( ) } ;
789764
790765 self . client . auth_ctx ( ) . set_session_tokens ( tokens. clone ( ) ) ;
791766 self . client
@@ -1434,9 +1409,6 @@ pub struct UserSession {
14341409 /// The tokens used for authentication.
14351410 #[ serde( flatten) ]
14361411 pub tokens : SessionTokens ,
1437-
1438- /// The OAuth 2.0 server used for this session.
1439- pub issuer : Url ,
14401412}
14411413
14421414/// The data necessary to validate a response from the Token endpoint in the
0 commit comments