Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/314.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
Java 控制JSF文件中的访问_Java_Eclipse_Jsf_Authentication - Fatal编程技术网

Java 控制JSF文件中的访问

Java 控制JSF文件中的访问,java,eclipse,jsf,authentication,Java,Eclipse,Jsf,Authentication,我正在处理一个JSF项目,它有一个login.xhtml文件,用户可以通过其角色登录并转到不同的页面 实际上,我有四个角色: 管理员 柜台 客户 出纳 与四个主页关联: indexAdministrator.xhtml indexCounter.xhtml indexClient.xhtml indexCashier.xhtml 这是可行的,但问题是当用户未登录时。直接从URL进入page.xhtml,它进入,我只需要授权的用户就可以这样做 如果是什么,我在Httpsession中有两个

我正在处理一个JSF项目,它有一个
login.xhtml
文件,用户可以通过其角色登录并转到不同的页面

实际上,我有四个角色:

  • 管理员
  • 柜台
  • 客户
  • 出纳
与四个主页关联:

  • indexAdministrator.xhtml
  • indexCounter.xhtml
  • indexClient.xhtml
  • indexCashier.xhtml
这是可行的,但问题是当用户未登录时。直接从URL进入
page.xhtml
,它进入,我只需要授权的用户就可以这样做

如果是什么,我在Httpsession中有两个参数:

session.setAttribute("currentUser", currentUser);
session.setAttribute("role", role);

根据您提供的信息,我认为您的.xhtml页面没有检查用户是否有权查看它们。检查并重定向所有未经授权的人员