Sad that this community is so inactive or dont want to answer this question. I still find spring and java communities answering the most basic questions even after several years. So here it is what I did.Any improvements or suggestions are highly welcome.
Wrote a method in my controller that would return user as a implicit method.
implicit def user(implicit request: RequestHeader):Option[Identity] = {
SecureSocial.currentUser
}
Pass this user to my template and make it implicit. Wondering why it can't directly use it from controller. I have to explicitly pass it which is very weird.
@(implicit user:Option[securesocial.core.Identity])
Since the user info has to be in all pages it has to be included in main template or main template call another template that renders user info.In my main template=>
@(title: String, nav: String = "")(content: Html)(implicit user:Option[securesocial.core.Identity]=None)
Then some view related code
@if(user.isDefined){
<li>
<a href="@securesocial.controllers.routes.LoginPage.logout()"/>Logout</li>
}else{
<li>
<a href="@securesocial.core.providers.utils.RoutesHelper.login()">Login</a></li>
}