msupply-foundation / msupply-cold-chain

Android application for viewing and monitoring temperatures of fridges
GNU General Public License v3.0
3 stars 3 forks source link

Allow sync to self-signed servers on local network #265

Closed mark-prins closed 7 months ago

mark-prins commented 7 months ago

Fixes #264

Bit of a long winded fix - unable to find a simple workaround for this one.

Have created a class that implements OkHttpClientFactory so that I can override the checkServerTrusted method. This method will behave as normal for any host address except for private IP addresses, i.e. servers on the local network. These will only check the certificate validity, but will not complain if the signing authority is not valid.

Testing

Run a copy of open mSupply on a tablet, and spin up a copy of this version of the cold chain application, trying to sync to the oms instance.

Without these changes, you get 'network error'

Check then that you can sync to a valid certificate (i.e. demo-open.msupply.org) and that the full certificate validation runs correctly for that server.