cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How can I obtain the session information of a logged-in user?

hno
13-Aquamarine
13-Aquamarine

How can I obtain the session information of a logged-in user?

I need to capture the user's information, such as the client IP and TWX Organization, by intercepting the Login event.

 

Unfortunately, the LoginSucceeded event of the SecurityMonitor Thing does not provide the session information of the logged-in user, and the CurrentSessionInfo Snippets are also unable to access the user's session information as they are not executed by the logged-in user.

 

Is there a solution available? Or should I customize the Authenticator?

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
TravisPickett
12-Amethyst
(To:hno)

You could add a session variable or a hidden counter on the landing page.  If this value is 0 log the information, if greater than 0 don't log.  You would have to test how session timeout is handled and tweak as necessary.

View solution in original post

6 REPLIES 6
PaiChung
22-Sapphire I
(To:hno)

What is the actual use case for this need?

hno
13-Aquamarine
13-Aquamarine
(To:PaiChung)

i need to store and manage user login records in database, and the built-in login history provided by Thingworx lacks sufficient user information.

PaiChung
22-Sapphire I
(To:hno)

If you have a 'landing page' set, you can just run a service onload for this and add all necessary information since you'll have appropriate currentuser context.

hno
13-Aquamarine
13-Aquamarine
(To:PaiChung)

Thank you for your kind.

 

There is an issue with duplicate records when processing on the landing page, especially when the page is refreshed. I would like to save it only when authentication passes on the login page.

TravisPickett
12-Amethyst
(To:hno)

You could add a session variable or a hidden counter on the landing page.  If this value is 0 log the information, if greater than 0 don't log.  You would have to test how session timeout is handled and tweak as necessary.

hno
13-Aquamarine
13-Aquamarine
(To:TravisPickett)

Thank you for the good idea. I will try it

Announcements


Top Tags