Hi,
I am developing a Thingworx Mashup which has a login page and once logged in, pages with specific content will displayed based on the logged in user. Login authentication will be done based on database.Please let me know how to maintain login session of logged-in user across all tabs/pages in a mashup? Is there any standard method defined by ThingWorx? If so please share the related tutorial link.
Regards,
Raj
Hi Raj,
In the Mashup Composer, on the right side of page you have the Data, Session and User sections.
If
you switch to the User tab, you have the name of user and you can bind
to any control accepting String binding, or perform specific services that take this input as a parameter.
If, however, you want to make thing simpler, you can
invoke the following function in any service, in order to obtain the
currently logged user:
var userName = Resources["CurrentSessionInfo"].GetCurrentUser(); //STRING
BR,
Vladimir
Raj,
Are you looking to display different
Mashups
based on the current user or just user-specific content? If it's the latter, you can also use the "principal" keyword which is functionally equivalent toGetCurrentUser()
. It's a nice shorthand that will save you some typing ; )If it's the former, you'll need some logic in your
Mashups
to determine whichMashup
should be displayed for the current user. Most likely, you'll use aContained Mashup
and dynamically bind the name of aMashup
depending on the current user.Regards,
Adam