It is sad that this community is so inactive or does not want to answer this question. I still find spring and java communities that answer the most basic questions even after a few years. So here is what I did. All improvements or suggestions are welcome.
Wrote a method in my controller that will return the user as an implicit method.
implicit def user(implicit request: RequestHeader):Option[Identity] = { SecureSocial.currentUser }
Pass this user into my template and make it implicit. I wonder why he cannot use it directly on the controller. I must explicitly convey this, which is very strange.
@(implicit user:Option[securesocial.core.Identity])
Since user information must be on all pages, it must be included in the main template or main template, calling another template that displays user information. In my main template =>
@(title: String, nav: String = "")(content: Html)(implicit user:Option[securesocial.core.Identity]=None)
Then some kind of 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> }
source share