@@ -35,16 +35,28 @@ pub(super) async fn start_dbus_gateway(
3535 tracing:: error!( "Failed to connect to D-Bus session: {err}" ) ;
3636 } ) ?
3737 . name ( SERVICE_NAME ) ?
38- . serve_at ( SERVICE_PATH , CredentialGateway { svc : svc. clone ( ) } ) ?
38+ . serve_at (
39+ SERVICE_PATH ,
40+ CredentialGateway {
41+ gateway_service : svc. clone ( ) ,
42+ } ,
43+ ) ?
3944 . build ( )
4045 . await
4146}
4247
48+ /// Struct to hold state for the D-Bus interface.
4349struct CredentialGateway {
44- svc : Arc < AsyncMutex < GatewayService > > ,
50+ /// Service responsible for processing credential requests.
51+ gateway_service : Arc < AsyncMutex < GatewayService > > ,
4552}
4653
47- /// These are public methods that can be called by arbitrary clients to begin a credential flow.
54+ /// These are public methods that can be called by arbitrary clients to begin a
55+ /// credential flow.
56+ ///
57+ /// The D-Bus interface is responsible for authorizing the client and collecting
58+ /// the contextual information about the client to pass onto the GatewayService
59+ /// for evaluation.
4860#[ interface( name = "xyz.iinuwa.credentialsd.Credentials1" ) ]
4961impl CredentialGateway {
5062 async fn create_credential (
@@ -83,7 +95,7 @@ impl CredentialGateway {
8395 // Find out where this request is coming from (which application is requesting this)
8496 let requesting_app = query_connection_peer_binary ( header, connection) . await ;
8597 let response = self
86- . svc
98+ . gateway_service
8799 . lock ( )
88100 . await
89101 . handle_create_credential (
@@ -132,7 +144,7 @@ impl CredentialGateway {
132144 // Find out where this request is coming from (which application is requesting this)
133145 let requesting_app = query_connection_peer_binary ( header, connection) . await ;
134146 let response = self
135- . svc
147+ . gateway_service
136148 . lock ( )
137149 . await
138150 . handle_get_credential (
@@ -146,7 +158,11 @@ impl CredentialGateway {
146158 }
147159
148160 async fn get_client_capabilities ( & self ) -> fdo:: Result < GetClientCapabilitiesResponse > {
149- let capabilities = self . svc . lock ( ) . await . handle_get_client_capabilities ( ) ;
161+ let capabilities = self
162+ . gateway_service
163+ . lock ( )
164+ . await
165+ . handle_get_client_capabilities ( ) ;
150166 Ok ( capabilities)
151167 }
152168}
0 commit comments