Professional OPC
Development Tools

logos

OPC XML-DA Basic Authorization doesn't work

More
27 Mar 2019 19:39 #7281 by support
I am glad to hear this. Thanks for letting us know.

Best regards

Please Log in or Create an account to join the conversation.

More
27 Mar 2019 13:42 #7280 by Slavik
Hello,

Thanks a lot, now it works fine!

Best regards

Please Log in or Create an account to join the conversation.

More
27 Mar 2019 11:10 - 27 Mar 2019 11:11 #7278 by support
Hello,

please download the latest build of QuickOPC 2018.3 (should be 5.54.1133.1 or later) from our Web site or from Nuget, re-build your project and retest.
The basic authentication in OPC XML-DA should now work.

The principle is as follows:
  1. If there is a username (an optionally a password) in the URL, basic authentication will be used with this username and password.
  2. Otherwise, if (in the EndpointDescriptor) the NetworkSecurity.CustomNetworkCredential is 'true' (which is the default) and there is non-empty name in NetworkSecurity.NetworkCredential.UserName, basic authentication will be used with the user name and Password from the NetworkSecurity.NetworkCredential.
  3. Otherwise, no authentication will take place.

Thank you for reporting this issue.
Best regards
Last edit: 27 Mar 2019 11:11 by support.

Please Log in or Create an account to join the conversation.

More
25 Mar 2019 07:12 #7270 by Slavik
Hi,

I'm using . NET Framework 4.6.2.

Please Log in or Create an account to join the conversation.

More
25 Mar 2019 06:50 #7269 by support
Hello,

we are working on this.

Question: Are you using .NET Framework, or .NET Core? If you are using .NET Core, is it on Windows or on Linux?

Thank you

Please Log in or Create an account to join the conversation.

More
21 Mar 2019 10:05 #7253 by support
Hello,

I have forwarded the issue(s) to the developer. I will let you know here when we know more.
My first impression is that the second approach (via URL) is meant to work, and we may have some bug there.
And, it is possible that we have currently no way to do the authentication through the request headers. But this is not the final answer, we will know more after investigating a little.

Best regards

Please Log in or Create an account to join the conversation.

More
20 Mar 2019 16:57 #7247 by Slavik
Hello,

We have an OPC XML DA server that requires authorization for writing values. Obviously, when I'm trying to write values without specifying username and password I'm getting error saying.
OPC NET API failure result "E_ACCESS_DENIED".
Looking for a solution I've found that I can pass NetworkSecurity object as a parameter of ServerDescriptor constructor, so I changed
new ServerDescriptor("http://IP:port/DA") to new ServerDescriptor("http://IP:port/DA", new NetworkSecurity(user, password)). But, unfortunately it doesn't helped me.
Then I've compared using Wireshark requests sent from dOPC Explorer client and from my program and found that they are differ by Authorization request header. Requests sent from dOPC Explorer contains this header with specified username and password needed for Basic authorization while requests from my app doesn't contain such header at all.

Then I realized that NetworkSecurity might have nothing about HTTP authorization so I simply tried to specify user and password in URL like this:
http://username:password@IP:port/DA
And now I instead of access denied error I have another one saying
The remote name could not be resolved: 'username'

Here is the code:
ServerDescriptor server = new ServerDescriptor("http://username:password@IP:port/DA");
DAItemDescriptor item = new DAItemDescriptor("item")
try{
    OpcClient.WriteItemValue(server, item, "test");
}
catch (OpcException ex)
{
    Console.WriteLine($"Error: {ex.GetBaseException().Message}");
}

Does basic HTTP authorization supported by the library? If yes - could you please correct me what I'm doing wrong.

Thanks in advance!

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.290 seconds

      

 Recommend this on Google