client: move auth and ca on connection level config#420
Conversation
|
Code coverage summary for 140ec07: ✅ Region coverage 69% passes |
f29a609 to
442ed9d
Compare
762bcdd to
bcd8d45
Compare
9a59a5f to
d3dddf9
Compare
bcd8d45 to
975f7bb
Compare
975f7bb to
c6a6a9f
Compare
d3dddf9 to
d8d07db
Compare
a457946 to
1abe436
Compare
c4ba9b4 to
745c99b
Compare
65a0822 to
5f6e2b4
Compare
| let ca_content = if check_cert_header(&self.ca_cert) { | ||
| Some(self.ca_cert.clone()) | ||
| } else { | ||
| // NOTE: we support a path input on desktop | ||
| if cfg!(desktop) { | ||
| std::fs::read_to_string(&self.ca_cert).ok() | ||
| } else { | ||
| None | ||
| } | ||
| }; |
There was a problem hiding this comment.
This logic is repeated in a different way below. I think we can keep the load_ca(cert_or_path) -> Result<cert> and put the logic in there
There was a problem hiding this comment.
There is a little different between these, so we can not make a load_ca for the Config and also for the ConnectionConfig.
We accept the global config without CA, so the std::fs::read_to_string(&self.ca_cert).ok() and for the connection level the error should raise *ca_cert = std::fs::read_to_string(&mut *ca_cert).map_err(|_| Error::CaFileNotFound)?
There was a problem hiding this comment.
More details note added to point out the difference.
5f6e2b4 to
06eba37
Compare
It is possible to have different Auth and CA with servers, we put these in the ConnectionConfig level, also provid a `take_servers` method to load the ca content and normalize it.
The auth and ca are used in connection config level, so the auth and ca functions in config level are removed.
- doc the methods of Config to know the servers, `.len()`, `.is_empty()` and `.take_servers()` - doc normalize flow and auth/cert in the connection level with server and also normalized by `.take_servers()`
06eba37 to
40b6dca
Compare
|
Thanks for reviews. |
Description
ClientConnectionConfigConfig::take_serversto normalizeConnectionConfigwith auth and cert informationauthandroot_ca_certofClientConfigMotivation and Context
Currently, auth and ca settings are in global config level in desktop clients, but the mobile client used in connection level. The input of ca_cert can be a content or a path of ca cert file in desktop clients.
It is possible to have different auth and ca with multiple servers in desktop, so we move these in
ConnectionConfig, also provide atake_serversmethod and keepserversprivate to load the ca content and normalize it.This PR is split from #391(the pink red arrow part of overall flow chart), and now it is documented under /doc/connection_setting.md.
How Has This Been Tested?
Follow current test case
Types of changes
Checklist:
main