How to check current server session is forward connection or reverse connection in OPC UA Server C#?|OPC UA Standard|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
How to check current server session is forward connection or reverse connection in OPC UA Server C#?
Avatar
prabhakaran prabs
Member
Members
Forum Posts: 42
Member Since:
01/07/2022
sp_UserOfflineSmall Offline
1
05/06/2024 - 00:05
sp_Permalink sp_Print

I have developed OPC UA SERVER application using CSharp(C#) language. I want to know if the connection is reverse or forward in OPC UA Server.

My requirement is that the OPC UA server shall only accept ReverseHello session opening requests with “Anonymous User Identity Token” policy. I want to differentiate whether the current session forward connection or reverse connection in SessionManager_ImpersonateUser method.

This method is invoked when client tries to change user identity in UAExpert.

For forward connection, the following usertoken policy shall work

anonymous

username

certificate

For reverse connection the following user token policy shall work

anonymous

Avatar
Randy Armstrong
Admin
Forum Posts: 1511
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
05/07/2024 - 14:16
sp_Permalink sp_Print

The SDK you are using should provide an API that tells you which endpoint is used.

In GetEndpoints, you would return a different set of EndpointDescriptions with the UserTokens that you support.

Avatar
prabhakaran prabs
Member
Members
Forum Posts: 42
Member Since:
01/07/2022
sp_UserOfflineSmall Offline
3
05/08/2024 - 03:15
sp_Permalink sp_Print sp_EditHistory

Hi, Thanks for reply. I have tried in my OPC UA server application by following code. 

var endpoints = Server.GetEndpoints().Select(e => e.EndpointUrl).Distinct()

but the end points displays only Baseline address(server related address) only..

the following method is invoked when client(UAExpert) tries to connect OPC UA Server. through session object not able to find current session is reverse or forward.

private void SessionManager_ImpersonateUser(Session session, ImpersonateEventArgs args)

 

Server config file:

Baseline address:

"https://localhost:62540/abc/OPCUAServer"
"opc.tcp://localhost:62541/abc/OPCUAServer"
 
Reverseconnect:
"opc.tcp://localhost:65300"
 
Please help me
Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online: Francesco Viscomi
Guest(s) 91
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1395
Posts: 4715