Hi team,
Our Smart client plug-in just stops working since 2021 R1 XProtect release when user logs-in using basic authentication. Debugging it I have the following Exception in Init() method: System.ServiceModel.CommunicationException: An error occurred while making the HTTP request to https://10x1m:80/ManagementServer/ConfigurationApiService.svc. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server. —> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. —> System.IO.IOException: The handshake failed due to an unexpected packet format.
The plug-in initializes VideoOS.ConfigurationAPI.ClientService.IConfigurationService instance on start (PlatformSamples → AddUserWithConfigApi sample) and this fails.
Attached full stack trace.
Note: in older XProtect versions the same code always was working fine.
Regards,
Nikolay
I did reproduce this in the Milestone test labs.
Actually I have found the difference between 2021 R1 and older Milestone versions. When login using basic user and perform authentication I realized ServerId.Serverport is 443 (correct for https) against older versions, but with 2021 R1 server port is always 80. Because of this the url composed for authentication is wrong.
I think this corresponds with my findings, I am reporting this as a bug. I will let you know what is found in Development..
Also I have another issue with 2021 R1 release, this time with Management client running on remote machine. In init method in our Management client plugin I perform the same authentication and realized NetworkCredentials are empty which results in failing calls to the configuration API. The workaround we have found is to run the application (executable) under same user account (same username and password) like the account on the Management server. In case such account does not exists on remote machine I have to create new one. To run the application I use runas.exe /user:user /savecred …management_client.exe (modifying shortcut target). In this cases credentials object is not empty and authentication succeeds.
Thanks,
Nikolay.
In the case of the Management Client plugin do you use the same code for initialization of the VideoOS.ConfigurationAPI.ClientService.IConfigurationService as was the case with the Smart Client plugin?
The failure you see is that with the same kind of user? (Works with Windows/AD user but fails with a Basic authentication user?)
Yes, the code I am using in the Management client plugin is the same, placed in my shared Utility.dll. This is reproducible always, with Windows users also. The problem is the network credentials object (get it from environment manager instance) is empty (working in older Milestone versions).
Thanks,
Nikolay.
In the next release of the MIP SDK (2021R2) Milestone has changed the AddUserWithConfigApi sample so that it uses the strongly typed classes (VideoOS.Platform.ConfigurationItems) instead of the very protocol-like way of the existing sample. This should in our view make for a easier cleaner and more plugin-like approach to use of the Configuration API. We would suggest that you evaluate whether it might be an idea in the future to use this approach instead.
For now to get your plugin back and running we have the following guide-lines:
We suggest you look into our Component Sample “ConfigApiClient”. In this sample we have a class called ConfigApiClient.cs which has a method called InitializeClientProxy. The InitializeClientProxy shows how to create a IConfigurationService depending on if you are communicating with a OAuth server (21R1 or later) or a legacy server.
When creating an OAuth connection a couple of helper classes are used (these are found in the subfolder “Oauth” in the sample). We suggest that you copy these classes and make minor adjustment for them to suit your needs. In most cases no adjustments will be needed.