Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Can I get Client info In Server MyNodeManagerListener class
July 14, 2020
11:24, EEST
Avatar
pokapoka95
Taiwan
Member
Members
Forum Posts: 10
Member Since:
May 29, 2020
sp_UserOfflineSmall Offline

Hi
I want to get Client info (ex:RemoteAddress)
I can get from class MyUserValidator
ssession.getChannel().getConnection().getRemoteAddress() ==> can get client ip

but I want to get this info in class MyUserValidator

how to get it?

thanks!!

July 14, 2020
12:07, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 545
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Please clarify what do you mean?

I do not exactly understand the question as the Session is given as parameter for onValidate and onValidationError methods of UserValidator?

July 15, 2020
3:16, EEST
Avatar
pokapoka95
Taiwan
Member
Members
Forum Posts: 10
Member Since:
May 29, 2020
sp_UserOfflineSmall Offline

Bjarne Boström said
Hi,

Please clarify what do you mean?

I do not exactly understand the question as the Session is given as parameter for onValidate and onValidationError methods of UserValidator?  

I need to test if the OPC UA Server SDK can be achieved, distinguish Client’s IP
It is known that [public boolean onValidate(Session session, ServerUserIdentity userIdentity)] in MyUserValidator class
Among them, variable session can get the Client’s IP

So I want to get the client’s ip and variable ServerUserIdentity in Class MyNodeManagerListener how can I do ?

thanks!!

July 15, 2020
9:13, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 545
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

You can get the Session from the ServiceContext (via getSession()), which is given as the first parameter in many listener interfaces. This is shown e.g. in the MyNodeManagerListener sample with the checkUserAccess method which is called from the interface implementing methods. And then you can get the ServerUserIdentity from the Session.getUserIdentity().

July 21, 2020
8:36, EEST
Avatar
pokapoka95
Taiwan
Member
Members
Forum Posts: 10
Member Since:
May 29, 2020
sp_UserOfflineSmall Offline

Bjarne Boström said
You can get the Session from the ServiceContext (via getSession()), which is given as the first parameter in many listener interfaces. This is shown e.g. in the MyNodeManagerListener sample with the checkUserAccess method which is called from the interface implementing methods. And then you can get the ServerUserIdentity from the Session.getUserIdentity().  

Hi Bjarne Boström
thanks for your help
I did it.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
11 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 103

pramanj: 86

ibrahim: 70

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 38

Rainer Versteeg: 32

Thomas Reuther: 31

Member Stats:

Guest Posters: 0

Members: 1105

Moderators: 14

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1009

Posts: 4268

Newest Members:

user1290, gregp, mariohetheringto, normagalindo47, aurelia27u, isobel41d356980, michaeldegli, gqbdolores, kez1399, jaclynmcvay358

Moderators: Jouni Aro: 851, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 545, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 20, Markus Johansson: 19, Matti Siponen: 53, Lusetti: 0

Administrators: admin: 0