...
The recommended approach is to create a unique self-signed certificate for each distinct API client. See https://docs.microsoft.com/en-us/powershell/module/pkiclient/new-selfsignedcertificate for information on creating self-signed certificates in Windows. We recommend setting the subject name of the certificate to a value which can identify the consumer (user name, machine name, etc.).
...
Info |
---|
Some users have had issues using the above method (specifically the inability to export the certificate). The image below shows an alternate method for generating and exporting both certificates (one with a PK (pfx) and one without (cer)). |
Once you have run the Powershell command, you will find the new certificate in your Personal folder of the Local machine store.
...
Export this certificate to a file using the default export settings (do not include the private key). Copy this twice - once without the private key, and once with the private key. When exporting with the private key, you will need to supply a password. Copy the no-private-key file over to the Connexion host and install it into the “Trusted People” store of the Local Computer. This can be achieved by right clicking the certificate file (on the Connexion host) and choosing the “install certificate” option.
...
You have now completed the requirements for the client API to create a tunnel with the API service. Verify that the certificate installed correctly on the Gateway Connexion host by looking in the ‘Trusted People’ store.
...
Deleting an API client certificate from this store will revoke access to the Connexion API.
Next, reference the C# client Connexion.Api library (Connexion.Gateway.Api.dll, both framework and core assemblies are available) and create a proxy to the gateway. You will need the System.ServiceModel.Primitives and System.ServiceModel.Http packages if you’re targeting .NET core.Connexion.
Code Block | ||
---|---|---|
| ||
using System; using System.Security.Cryptography.X509Certificates; using Connexion.Gateway.Api; namespace GatewayApiClientTestCxnApiClient { class Program { static async voidTask Main(string[] args) { // load the certificate to pass to the gateway api var certificate = new X509Certificate2(@"c:\gatewayClienttest\NickLaptop.cerapicert.pfx", "foobar"); // create a proxy to theConnexion GW using (var proxy = GatewayApiProxyFactoryConnexionApiProxyFactory.CreateProxy("192127.1680.30.191", 80858089, certificate)) { // test the connection Console.WriteLine("Query Groups..."); var response = await proxy.ServiceMethods.Ping();GetGroupsAndTabsAsync(new GetGroupsAndTabsRequest(true)); foreach (var group in response.Groups) { Console.WriteLine(group.Name); foreach (var tab in group.Tabs) { Console.WriteLine($"-->{tab.Name}"); } } } Console.ReadLine(); } } } |
At this point, you can now make API calls to create and modify non-authorized remote agents. In the future, we may enable specific updates to authorized remote agents..
Sample projects:
View file | ||
---|---|---|
|