我有一个电梯Web应用程序,我想提供一个csv下载链接。 csv由Lift rest服务提供。从电梯休息会话中使用电梯网络会话
设置这个没问题。然而;为了使其安全且平滑地工作,我需要使用已建立的认证网络会话。
这是我目前与其他休息服务的休息认证。是否存在我可以放在???下面的网络用户的任何角色;或者我完全错过了这一点?
LiftRules.authentication = HttpBasicAuthentication("lift") {
case (`webshopUser`, `webshopPwd`, _) =>
userRoles(webshopRole :: Nil)
true
case (`mailingListUser`, `mailingListPwd`, _) =>
userRoles(mailingListRole :: Nil)
true
}
LiftRules.httpAuthProtectedResource.append {
case Req("rest" :: "mailingLists" :: _, _, _) => Full(mailingListRole)
case Req("rest" :: "mamberships" :: "year" :: _, _, _) => ???
case Req("rest" :: "memberships" :: _, _, _) => Full(webshopRole)
}
呃,实际上都没有。对不起,我不是更清楚。我有一个带有扩展MegaProtoUser的Person类的Web应用程序部分。这是Web认证用户的基础。我想要使用那些已经登录的用户和网络会话。 – thoredge
用户和角色没有完全绑定在一起。用户可以拥有一个或多个角色,角色可以分配给多个用户。用户标识个人,角色定义他们有权执行的操作。在你的情况下,由'webshopUser'标识的用户被分配了一个'webshopRole'角色,并且对'/ rest/memberships'的访问仅限于具有该角色的用户。我得到的是取决于你想限制的方式,你可以为现有用户添加一个新角色 - 或者,如果你只需要该用户有权访问,你可以重新使用一个角色。 – jcern
我的问题是,我现在看到我们将MegaProtoUser与角色关联起来。 – thoredge