Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Security Scala播放安全问题_Security_Scala_Playframework_Playframework 2.0 - Fatal编程技术网

Security Scala播放安全问题

Security Scala播放安全问题,security,scala,playframework,playframework-2.0,Security,Scala,Playframework,Playframework 2.0,我正在尝试开发网站,使用scala play并在“登录页面”中找到1个ussue 我询问登录名和密码,然后我使用以下代码存储密码: 重定向(routes.UserPage.form(useremailverify.username)).with会话(“name”->useremailverify.username,“guid”->md5hash1) 但突然我发现这是一次全球会议!它对所有用户都是全球性的。您只需在导航中查看它,您将在右上角看到您已经登录的页面!有人知道如何为每个用户创建新会话吗

我正在尝试开发网站,使用scala play并在“登录页面”中找到1个ussue

我询问登录名和密码,然后我使用以下代码存储密码:

重定向(routes.UserPage.form(useremailverify.username)).with会话(“name”->useremailverify.username,“guid”->md5hash1)

但突然我发现这是一次全球会议!它对所有用户都是全球性的。您只需在导航中查看它,您将在右上角看到您已经登录的页面!有人知道如何为每个用户创建新会话吗

UDP 1: 在表单i中,检查用户是否以这种方式登录:

request =>
  request.session.get("name").map { userName =>
    username = userName
  }
所以,如果用户名不是空的-用户已登录

UPD 2: 如果我试试看:

重定向(routes.UserPage.form(useremailverify.username)).newSession.withSession(“名称”->useremailverify.username,“guid”->md5hash1)

我发现编译错误:

value newSession不是play.api.mvc.SimpleResult[play.api.mvc.Results.EmptyContent]的成员

UPD 3: 代码: 重定向(routes.UserPage.form(usersignin.email)).withNewSession(“name”->usersignin.email,“guid”->md5hash1)

错误:

play.api.mvc.PlainResult不接受参数

Whithout错误仅为(但此代码不会为多个导航保存数据): 重定向(routes.UserPage.form(usersignin.email))。使用newSession.flash(“name”->usersignin.email,“guid”->md5hash1)

UPD 4:

使用withNewSession的正确方法(但它没有解决主要问题…): 重定向(routes.UserPage.form(useremailverify.username)).withNewSession.withSession(“名称”->useremailverify.username,“guid”->md5hash1)

UPD 5:

Coockie PLAY_会话包含:“043455c05b1481c501a61167f5dd09e7ec73e693 name=starbucks%40picktime.ru&guid=d7d4c9c3f078d150effbef5e0706c557”,因此数据是从cookie收集的=(

UDP 6:


已将Play Framework的版本更改为2.2.1,但问题仍然存在。

使用Session不会为所有用户设置cookie。因此我认为您的检查不正确。 我正在为名为PlayGuard的游戏开发一个新的安全框架! 您可以使用此框架,也可以查看其代码并解决您的问题


代码看起来正确,应该是用户特定的。我还将添加一个
.newSession.withSession(…)
只是为了确保用户开始新的会话。您如何检查哪个用户登录了emailVerifcationForm页面?您是否可以使用该代码片段更新您的答案?在问题内容中添加了更多的描述。我将尝试在Zentaks中添加带有
securied
trait的.newSessionCheck内置示例app.It几乎你已经做过了,但是使用了
play.api.mvc.Security
helper。在描述中添加了UPD 2部分。你应该在newSession中使用
而不是
newSession
你在说什么检查?我可能不希望你使用其他框架和插件。即使它们不安全。所以你不是一个解决方案nJust添加了PLAY Cookie来证明这一点。我说你可以看到它的代码,显示如何使用Cookie(会话)进行身份验证。不要使用这个框架,但它的简单代码可以帮助你