mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-23 10:15:55 +08:00
Got GDS client compiling.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<section name="Opc.Ua.ClientConfiguration" type="Opc.Ua.ApplicationConfigurationSection,Opc.Ua.Core"/>
|
||||
<section name="Opc.Ua.ClientConfiguration" type="Opc.Ua.ApplicationConfigurationSection,Opc.Ua.Core" />
|
||||
</configSections>
|
||||
|
||||
<system.serviceModel>
|
||||
@@ -47,4 +47,13 @@
|
||||
</ConfigurationLocation>
|
||||
</Opc.Ua.ClientConfiguration>
|
||||
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace Opc.Ua.GdsClient
|
||||
[DefaultValue(false)]
|
||||
public bool RequestNewPrivateKey { get; set; }
|
||||
|
||||
public void Initialize(
|
||||
public async void Initialize(
|
||||
GlobalDiscoveryClientConfiguration configuration,
|
||||
GlobalDiscoveryServer gds,
|
||||
GlobalDiscoveryServer gds,
|
||||
PushConfigurationServer server,
|
||||
RegisteredApplication application,
|
||||
bool isHttps)
|
||||
@@ -78,7 +78,7 @@ namespace Opc.Ua.GdsClient
|
||||
id.StoreType = CertificateStoreIdentifier.DetermineStoreType(id.StoreType);
|
||||
id.SubjectName = application.CertificateSubjectName.Replace("localhost", System.Net.Dns.GetHostName());
|
||||
|
||||
certificate = id.Find(true);
|
||||
certificate = await id.Find(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,12 +105,12 @@ namespace Opc.Ua.GdsClient
|
||||
|
||||
CertificateIdentifier id = new CertificateIdentifier()
|
||||
{
|
||||
StoreType = CertificateStoreType.Windows,
|
||||
StorePath = "LocalMachine\\My",
|
||||
SubjectName = "CN=" + url.DnsSafeHost
|
||||
StoreType = CertificateStoreType.Windows,
|
||||
StorePath = "LocalMachine\\My",
|
||||
SubjectName = "CN=" + url.DnsSafeHost
|
||||
};
|
||||
|
||||
certificate = id.Find();
|
||||
certificate = await id.Find();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,7 +331,7 @@ namespace Opc.Ua.GdsClient
|
||||
{
|
||||
byte[] nonce = new byte[32];
|
||||
System.Security.Cryptography.RandomNumberGenerator.Create().GetBytes(nonce);
|
||||
certificateRequest = m_server.CreateCSR(null, null, false, nonce);
|
||||
certificateRequest = m_server.CreateCertificateRequest(null, null, null, false, nonce);
|
||||
newPrivateKeyRequired = false;
|
||||
|
||||
if (m_server.Endpoint != null && m_server.Endpoint.Description.ServerCertificate != null)
|
||||
@@ -342,7 +342,7 @@ namespace Opc.Ua.GdsClient
|
||||
|
||||
if (newPrivateKeyRequired || RequestNewPrivateKey || m_certificate == null)
|
||||
{
|
||||
m_certificatePassword = Guid.NewGuid().ToString();
|
||||
m_certificatePassword = null; // Guid.NewGuid().ToString();
|
||||
|
||||
string privateKeyFormat = GetPrivateKeyFormat();
|
||||
string[] domainNames = GetDomainNames();
|
||||
@@ -379,7 +379,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
}
|
||||
|
||||
certificateRequest = CertificateFactory.CreateRequest(
|
||||
certificateRequest = CertificateAuthority.CreateRequest(
|
||||
certificate,
|
||||
privateKey,
|
||||
isPemKey,
|
||||
@@ -400,11 +400,11 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void CertificateRequestTimer_Tick(object sender, EventArgs e)
|
||||
private async void CertificateRequestTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -441,7 +441,7 @@ namespace Opc.Ua.GdsClient
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_application.CertificatePrivateKeyPath))
|
||||
{
|
||||
string path = Utils.GetAbsoluteFilePath(m_application.CertificatePrivateKeyPath, true, true, false);
|
||||
string path = Utils.GetAbsoluteFilePath(m_application.CertificatePrivateKeyPath, true, true, true);
|
||||
|
||||
if (path != null)
|
||||
{
|
||||
@@ -449,7 +449,7 @@ namespace Opc.Ua.GdsClient
|
||||
{
|
||||
var x509 = new X509Certificate2(certificate);
|
||||
var oldPfx = new X509Certificate2(path, (string)null, X509KeyStorageFlags.Exportable);
|
||||
var newPfx = CertificateFactory.Replace(x509, oldPfx);
|
||||
var newPfx = CertificateAuthority.Replace(x509, oldPfx);
|
||||
var bytes = newPfx.Export(X509ContentType.Pfx);
|
||||
File.WriteAllBytes(path, bytes);
|
||||
}
|
||||
@@ -467,28 +467,28 @@ namespace Opc.Ua.GdsClient
|
||||
SubjectName = m_application.CertificateSubjectName.Replace("localhost", System.Net.Dns.GetHostName())
|
||||
};
|
||||
|
||||
var oldPfx = cid.Find(true);
|
||||
var oldPfx = await cid.Find(true);
|
||||
|
||||
if (oldPfx != null)
|
||||
{
|
||||
var newPfx = CertificateFactory.Replace(x509, oldPfx);
|
||||
var newPfx = CertificateAuthority.Replace(x509, oldPfx);
|
||||
|
||||
using (var store = CertificateStoreIdentifier.OpenStore(m_application.CertificateStorePath))
|
||||
{
|
||||
store.Delete(oldPfx.Thumbprint);
|
||||
store.Add(newPfx);
|
||||
await store.Delete(oldPfx.Thumbprint);
|
||||
await store.Add(newPfx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// save private key.
|
||||
else
|
||||
{
|
||||
if (!String.IsNullOrEmpty(m_application.CertificatePrivateKeyPath))
|
||||
{
|
||||
string path = Utils.GetAbsoluteFilePath(m_application.CertificatePrivateKeyPath, true, true, false);
|
||||
string path = Utils.GetAbsoluteFilePath(m_application.CertificatePrivateKeyPath, true, true, true);
|
||||
|
||||
if (path != null)
|
||||
{
|
||||
@@ -505,18 +505,18 @@ namespace Opc.Ua.GdsClient
|
||||
SubjectName = m_application.CertificateSubjectName
|
||||
};
|
||||
|
||||
var oldCertificate = cid.Find();
|
||||
var oldCertificate = await cid.Find();
|
||||
|
||||
using (var store = CertificateStoreIdentifier.OpenStore(m_application.CertificateStorePath))
|
||||
{
|
||||
if (oldCertificate != null)
|
||||
{
|
||||
store.Delete(oldCertificate.Thumbprint);
|
||||
await store.Delete(oldCertificate.Thumbprint);
|
||||
}
|
||||
|
||||
var x509 = new X509Certificate2(privateKey, new System.Security.SecureString(), X509KeyStorageFlags.Exportable);
|
||||
x509 = CertificateFactory.Load(x509, true);
|
||||
store.Add(x509);
|
||||
await store.Add(x509);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -533,7 +533,7 @@ namespace Opc.Ua.GdsClient
|
||||
|
||||
if (store.FindByThumbprint(x509.Thumbprint) == null)
|
||||
{
|
||||
store.Add(new X509Certificate2(issuerCertificate));
|
||||
await store.Add(new X509Certificate2(issuerCertificate));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -547,8 +547,8 @@ namespace Opc.Ua.GdsClient
|
||||
privateKey = x509.Export(X509ContentType.Pfx);
|
||||
}
|
||||
|
||||
bool applyChanges = m_server.UpdateCertificate(null, certificate, GetPrivateKeyFormat(), privateKey, issuerCertificates);
|
||||
|
||||
bool applyChanges = m_server.UpdateCertificate(null, null, certificate, GetPrivateKeyFormat(), privateKey, issuerCertificates);
|
||||
|
||||
if (applyChanges)
|
||||
{
|
||||
MessageBox.Show(
|
||||
@@ -574,7 +574,7 @@ namespace Opc.Ua.GdsClient
|
||||
return;
|
||||
}
|
||||
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
CertificateRequestTimer.Enabled = false;
|
||||
}
|
||||
}
|
||||
@@ -591,7 +591,7 @@ namespace Opc.Ua.GdsClient
|
||||
|
||||
if (se == null || se.StatusCode != StatusCodes.BadServerHalted)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Opc.Ua.GdsClient
|
||||
PullFromGds(true);
|
||||
}
|
||||
|
||||
private void DeleteExistingFromStore(string storePath)
|
||||
private async void DeleteExistingFromStore(string storePath)
|
||||
{
|
||||
if (String.IsNullOrEmpty(storePath))
|
||||
{
|
||||
@@ -91,7 +91,8 @@ namespace Opc.Ua.GdsClient
|
||||
|
||||
using (ICertificateStore store = CertificateStoreIdentifier.OpenStore(storePath))
|
||||
{
|
||||
foreach (var certificate in store.Enumerate())
|
||||
X509Certificate2Collection certificates = await store.Enumerate();
|
||||
foreach (var certificate in certificates)
|
||||
{
|
||||
if (store.GetPrivateKeyFilePath(certificate.Thumbprint) != null)
|
||||
{
|
||||
@@ -130,7 +131,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
}
|
||||
|
||||
store.Delete(certificate.Thumbprint);
|
||||
await store.Delete(certificate.Thumbprint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,7 +140,7 @@ namespace Opc.Ua.GdsClient
|
||||
{
|
||||
try
|
||||
{
|
||||
NodeId trustListId = m_gds.GetTrustList(m_application.ApplicationId, 0);
|
||||
NodeId trustListId = m_gds.GetTrustList(m_application.ApplicationId, null);
|
||||
|
||||
if (trustListId == null)
|
||||
{
|
||||
@@ -237,7 +238,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +270,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +296,7 @@ namespace Opc.Ua.GdsClient
|
||||
|
||||
if (se == null || se.StatusCode != StatusCodes.BadServerHalted)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using Opc.Ua.Client;
|
||||
using Opc.Ua.Gds;
|
||||
|
||||
namespace Opc.Ua.GdsClient
|
||||
@@ -550,7 +545,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,7 +562,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,7 +592,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,7 +637,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,7 +663,7 @@ namespace Opc.Ua.GdsClient
|
||||
|
||||
if (String.IsNullOrWhiteSpace(ApplicationUriTextBox.Text))
|
||||
{
|
||||
ApplicationUriTextBox.Text = Utils.GetApplicationUriFromCertficate(certificate);
|
||||
ApplicationUriTextBox.Text = Utils.GetApplicationUriFromCertificate(certificate);
|
||||
}
|
||||
|
||||
if (String.IsNullOrWhiteSpace(DiscoveryUrlsTextBox.Text) && RegistrationTypeComboBox.SelectedIndex != ClientPullManagement)
|
||||
@@ -763,7 +758,7 @@ namespace Opc.Ua.GdsClient
|
||||
|
||||
if (String.IsNullOrWhiteSpace(ApplicationUriTextBox.Text))
|
||||
{
|
||||
ApplicationUriTextBox.Text = Utils.GetApplicationUriFromCertficate(certificate);
|
||||
ApplicationUriTextBox.Text = Utils.GetApplicationUriFromCertificate(certificate);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -778,7 +773,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -825,7 +820,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,7 +889,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -941,7 +936,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -992,7 +987,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1037,7 +1032,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1082,7 +1077,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1127,7 +1122,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1277,7 +1272,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1386,7 +1381,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1413,7 +1408,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1477,7 +1472,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1574,7 +1569,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1648,7 +1643,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1661,7 +1656,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1714,7 +1709,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(Parent.Text, exception);
|
||||
MessageBox.Show(Parent.Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Opc.Ua.Configuration.ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -44,7 +44,15 @@
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cannoli.Services, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Cannoli.Services.1.0.0.1\lib\net45\Cannoli.Services.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Client, Version=1.2.334.6, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\SDK\Opc.Ua.Client\bin\Debug\net46\Opc.Ua.Client.dll</HintPath>
|
||||
@@ -138,6 +146,7 @@
|
||||
<None Include="app.manifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Opc.Ua;
|
||||
using Opc.Ua.Client;
|
||||
using Opc.Ua.Configuration;
|
||||
using Opc.Ua.Gds;
|
||||
using Opc.Ua.Client.Controls;
|
||||
|
||||
namespace Opc.Ua.GdsClient
|
||||
{
|
||||
@@ -18,7 +13,7 @@ namespace Opc.Ua.GdsClient
|
||||
public MainForm(ApplicationInstance application)
|
||||
{
|
||||
InitializeComponent();
|
||||
Icon = ConfigUtils.GetAppIcon();
|
||||
Icon = ClientUtils.GetAppIcon();
|
||||
|
||||
m_application = application;
|
||||
|
||||
@@ -110,21 +105,16 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
}
|
||||
|
||||
private void Server_AdminCredentialsRequired(object sender, AdminCredentialsRequiredEventArgs e)
|
||||
private async void Server_AdminCredentialsRequired(object sender, AdminCredentialsRequiredEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var identity = new UserIdentityDialog().ShowDialog(this, "Please specify the administrator credentials for the Server.", m_identity);
|
||||
|
||||
if (identity != null)
|
||||
{
|
||||
e.Credentials = m_identity = identity;
|
||||
e.CacheCredentials = true;
|
||||
}
|
||||
e.Credentials = await OAuth2Client.GetIdentityToken(m_gds.Application.ApplicationConfiguration, m_gds.EndpointUrl);
|
||||
e.CacheCredentials = true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +217,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,7 +246,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +265,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +289,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +321,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +355,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +376,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +388,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +401,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,7 +414,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +427,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,7 +440,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +453,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +465,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,7 +505,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ExceptionDlg.Show(this.Text, exception);
|
||||
MessageBox.Show(Text + ": " + exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,24 @@
|
||||
<TemporaryStorePath>%CommonApplicationData%\OPC Foundation\GDS\PKI\temporary</TemporaryStorePath>
|
||||
</GlobalDiscoveryClientConfiguration>
|
||||
</ua:XmlElement>
|
||||
<ua:XmlElement>
|
||||
<ListOfOAuth2Credential xmlns="http://opcfoundation.org/UA/SDK/Configuration.xsd">
|
||||
<OAuth2Credential>
|
||||
<AuthorityUrl>https://login.microsoftonline.com/opcfoundationprototyping.onmicrosoft.com</AuthorityUrl>
|
||||
<GrantType>authorization_code</GrantType>
|
||||
<ClientId>f8b31779-d9a3-43ff-b854-28f27a52e2f2</ClientId>
|
||||
<RedirectUrl>https://localhost:62540/prototypeclient</RedirectUrl>
|
||||
<TokenEndpoint>/oauth2/token</TokenEndpoint>
|
||||
<AuthorizationEndpoint>/oauth2/authorize</AuthorizationEndpoint>
|
||||
<Servers>
|
||||
<OAuth2ServerSettings>
|
||||
<ApplicationUri>urn:localhost:somecompany.com:GlobalDiscoveryServer</ApplicationUri>
|
||||
<ResourceId>https://localhost:62540/prototypeserver</ResourceId>
|
||||
</OAuth2ServerSettings>
|
||||
</Servers>
|
||||
</OAuth2Credential>
|
||||
</ListOfOAuth2Credential>
|
||||
</ua:XmlElement>
|
||||
</Extensions>
|
||||
|
||||
<TraceConfiguration>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Opc.Ua;
|
||||
using Opc.Ua.Configuration;
|
||||
using Cannoli.Services;
|
||||
|
||||
namespace Opc.Ua.GdsClient
|
||||
{
|
||||
@@ -16,10 +12,13 @@ namespace Opc.Ua.GdsClient
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// Initialize the user interface.
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
ApplicationInstance application = new ApplicationInstance(ApplicationType.Client);
|
||||
ApplicationInstance application = new ApplicationInstance();
|
||||
application.ApplicationType = ApplicationType.Client;
|
||||
application.ConfigSectionName = "Opc.Ua.GdsClient";
|
||||
|
||||
try
|
||||
{
|
||||
@@ -34,8 +33,7 @@ namespace Opc.Ua.GdsClient
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ExceptionDlg.Show(application.ApplicationName, e);
|
||||
return;
|
||||
MessageBox.Show(application.ApplicationName + ": " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Cannoli.Services" version="1.0.0.1" targetFramework="net46" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user