@@ -602,12 +602,9 @@ pub async fn oauth_token(
602602 let client_id_for_tracking = pending. client_id . clone ( ) ;
603603 drop ( gateway_state) ;
604604
605- // Track that this client has active tokens and emit event
605+ // Update last_seen and emit event
606606 {
607- let mut gateway_state = state. write ( ) . await ;
608- gateway_state
609- . clients_with_tokens
610- . insert ( client_id_for_tracking. clone ( ) ) ;
607+ let gateway_state = state. read ( ) . await ;
611608
612609 // Update last_seen in database
613610 if let Some ( repo) = gateway_state. inbound_client_repository ( ) {
@@ -949,7 +946,6 @@ pub struct OAuthClientInfoResponse {
949946 pub locked_space_id : Option < String > ,
950947 pub last_seen : Option < String > ,
951948 pub created_at : String ,
952- pub has_active_tokens : bool ,
953949}
954950
955951/// List all registered OAuth clients
@@ -969,28 +965,24 @@ pub async fn oauth_list_clients(
969965 Ok ( db_clients) => {
970966 let clients: Vec < OAuthClientInfoResponse > = db_clients
971967 . into_iter ( )
972- . map ( |c| {
973- let has_active = gateway_state. clients_with_tokens . contains ( & c. client_id ) ;
974- OAuthClientInfoResponse {
975- client_id : c. client_id ,
976- registration_type : c. registration_type . as_str ( ) . to_string ( ) ,
977- client_name : c. client_name ,
978- client_alias : c. client_alias ,
979- redirect_uris : c. redirect_uris ,
980- scope : c. scope ,
981- logo_uri : c. logo_uri ,
982- client_uri : c. client_uri ,
983- software_id : c. software_id ,
984- software_version : c. software_version ,
985- metadata_url : c. metadata_url ,
986- metadata_cached_at : c. metadata_cached_at ,
987- metadata_cache_ttl : c. metadata_cache_ttl ,
988- connection_mode : c. connection_mode ,
989- locked_space_id : c. locked_space_id ,
990- last_seen : c. last_seen ,
991- created_at : c. created_at ,
992- has_active_tokens : has_active,
993- }
968+ . map ( |c| OAuthClientInfoResponse {
969+ client_id : c. client_id ,
970+ registration_type : c. registration_type . as_str ( ) . to_string ( ) ,
971+ client_name : c. client_name ,
972+ client_alias : c. client_alias ,
973+ redirect_uris : c. redirect_uris ,
974+ scope : c. scope ,
975+ logo_uri : c. logo_uri ,
976+ client_uri : c. client_uri ,
977+ software_id : c. software_id ,
978+ software_version : c. software_version ,
979+ metadata_url : c. metadata_url ,
980+ metadata_cached_at : c. metadata_cached_at ,
981+ metadata_cache_ttl : c. metadata_cache_ttl ,
982+ connection_mode : c. connection_mode ,
983+ locked_space_id : c. locked_space_id ,
984+ last_seen : c. last_seen ,
985+ created_at : c. created_at ,
994986 } )
995987 . collect ( ) ;
996988 info ! ( "[OAuth] Listed {} clients from database" , clients. len( ) ) ;
@@ -1213,9 +1205,6 @@ pub async fn oauth_update_client(
12131205 . await
12141206 {
12151207 Ok ( Some ( client) ) => {
1216- let has_active = gateway_state
1217- . clients_with_tokens
1218- . contains ( & client. client_id ) ;
12191208 let response = OAuthClientInfoResponse {
12201209 client_id : client. client_id ,
12211210 registration_type : client. registration_type . as_str ( ) . to_string ( ) ,
@@ -1234,7 +1223,6 @@ pub async fn oauth_update_client(
12341223 locked_space_id : client. locked_space_id ,
12351224 last_seen : client. last_seen ,
12361225 created_at : client. created_at ,
1237- has_active_tokens : has_active,
12381226 } ;
12391227 info ! ( "[OAuth] Client updated: {}" , response. client_id) ;
12401228 Json ( response) . into_response ( )
@@ -1264,7 +1252,7 @@ pub async fn oauth_delete_client(
12641252) -> Response {
12651253 info ! ( "[OAuth] Deleting client: {}" , client_id) ;
12661254
1267- let mut gateway_state = state. write ( ) . await ;
1255+ let gateway_state = state. read ( ) . await ;
12681256
12691257 let Some ( repo) = gateway_state. inbound_client_repository ( ) else {
12701258 warn ! ( "[OAuth] Database not available for client deletion" ) ;
@@ -1273,8 +1261,6 @@ pub async fn oauth_delete_client(
12731261
12741262 match repo. delete_client ( & client_id) . await {
12751263 Ok ( true ) => {
1276- // Remove from active tokens set
1277- gateway_state. clients_with_tokens . remove ( & client_id) ;
12781264 info ! ( "[OAuth] Client deleted: {}" , client_id) ;
12791265 StatusCode :: NO_CONTENT . into_response ( )
12801266 }
0 commit comments