I browse the web to find some kind of tutorial, but it's hard for me to find it. I guess I could just use the twitter example provided with securesocial
Example:
def onlyAdmin = SecuredAction(WithAuth("admin")) { implicit request => Ok("You could see this since you are admin") } case class WithAuth(role: String) extends Authorization { def isAuthorized(user: Identity) = { val existingDbUser = User.findUserByProviderUserId(user) existingDbUser.hasRole(role) }
User.findUserByProviderUserId(user) calls db to find the saved user and its roles. I would prefer not to call db every time and use Identity .
How would you solve this?
jakob source share