gpt4 book ai didi

java - 如何绕过 Java EE 安全角色

转载 作者:行者123 更新时间:2023-12-01 17:37:21 25 4
gpt4 key购买 nike

这是我的 web.xml 中的示例代码

<security-constraint>
<display-name>
change password</display-name>
<web-resource-collection>
<web-resource-name>change password</web-resource-name>
<url-pattern>/ResetPassword.html</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description>Roles which can access landing page</description>
<role-name>Admin</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

只有具有“Admin”角色的用户才能访问“ResetPassword.html”页面。

有一个 Java EE API 可以让我们测试当前用户是否有权访问特定角色。

request.isUserInRole("管理员");

我的默认用户“DefUser”返回 false,因为他没有分配角色,并且我收到 403 错误,因为 DefUser 无法访问“ResetPassword.html”页面。如果我使用 DefUser 登录,我可以使 request.isUserInRole("Admin") 返回 true 吗?还有其他办法吗?

我确实想使用安全约束。这是要求之一,可能有一个像“DefUser”这样的用户,该用户应该拥有对所有未分配角色的页面的权限。

我只是想绕过这些安全限制。 “DefUser”有什么办法可以访问“ResetPassword.html”页面吗?

http://www.imrantariq.com/blog/

最佳答案

Java EE 安全性无法绕过。否则,它就和巧克力茶壶一样有用了。

关于java - 如何绕过 Java EE 安全角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4956627/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com