Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
How to user UserSession class properly?
MonkeyKing
Hello there,
I'm trying to follow the Login.component example provided by LiveSite, which is using Login.class and LoginController.class to handle user logging in process.
The problem is, in both Login and LoginController source code, they are using context.getSession() method (which returns a UserSession object) to retrieve the login status, but where is the procedure for comparing user's inputs with DB information of name and password? how to set the values for the UserSession object? and what values (of UserSession object) should be settled after user logged in or failed logged in?
I can't find any tutorial for explaining the correct way of handling user login and how to use UserSession object properly, I tried many ways by logic, such as setting UserSession object's value by context.getSession().setLoggedIn(true); Fortunately it works, but is it the proper way of doing it? and where should I put this statement in? is there any other values should be settled in the same time?
last but not least, is there any tutorial guide regards to my question? I have read through the developer guide, but I can find nothing and I want to learn this precisely.
Regards
John
Find more posts tagged with
Comments
PaulW
Did you ever figure this out? Where did you get that code from?
tec_iwov
if yyou look at UserSession there is a UserProfile object is is the actual user state.
within livesite there is a User Profile service that is use to handle Authentication and prefile retrieval. the default uses the the ootb schema that you can populate using the User Admininstration that is accessed via the Sitepublishe menu in teamsite.
If you have your implementation you can override the default by implementing
com.interwoven.livesite.p13n.UserProfileService
the service is configured via spring so you can overide the beans via the customer pring files.
[HTML]runtime
class="com.interwoven.livesite.p13n.impl.BaseUserProfileService"/>
preview
class="com.interwoven.livesite.p13n.impl.BaseUserProfileService"/>[/HTML]
multi.zip
PaulW
WHat is hte best way of adding more properties to teh user profile? I have tried creating a copy of UserProfile and compiling into my jar, but this doesnt seem toget recognised. The additional methods I added to it arent found when runing on TeamSite or the runtime. Should I be creating a completely new class and pointing the p13n.DefaultUserProfile bean at my new class? What si the recommended way? And how would I get the SP menu item to display these new fields? THanks.
tec_iwov
As i mentioned you need to use spring to override the default beans with you custom user profile and possibley the service.
Also see this
Thread
PaulW
thanks tech_iwov.
I'm now getting the following error in my logs. Why does it say it is set to singleton?
2012-02-09 02:30:40,798 ERROR [com.interwoven.livesite.spring.p13n.impl.SpringUserProfileFactory] p13n.AnonymousProfile is set to singleton should be prototype
PaulW
Its because beans don't inherit their scope. I had to specify the scope="prototype" within eh custom profile bean.