gpt4 book ai didi

java - 在 glassfish 3.1.2 中将图像添加到表单例份验证

转载 作者:行者123 更新时间:2023-12-01 05:04:33 25 4
gpt4 key购买 nike

我正在尝试将图像添加到我的身份验证表单中,但安全凭证使其无法显示,即使该图像不属于受限制的网址。

我是否对阻止所有页面的安全描述符做错了什么?

这是我的 web.xml

<security-constraint>
<display-name>activedir</display-name>
<web-resource-collection>
<web-resource-name>activedir</web-resource-name>
<description/>
<url-pattern>/activedir/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>USER</role-name>
<role-name>ADMIN</role-name>
</auth-constraint>
<user-data-constraint>
<description/>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>security</realm-name>
<form-login-config>
<form-login-page>/login/login.html</form-login-page>
<form-error-page>/login/error.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description/>
<role-name>USER</role-name>
</security-role>
<security-role>
<description/>
<role-name>ADMIN</role-name>
</security-role>

这是我的 glassfish-web.xml

<security-role-mapping>
<role-name>ADMIN</role-name>
<group-name>ADMIN</group-name>
<security-role-mapping>
<role-name>ADMIN</role-name>
<group-name>ADMIN</group-name>
</security-role-mapping>
<security-role-mapping>
<role-name>USER</role-name>
<group-name>USER</group-name>
</security-role-mapping>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>

我的文件夹树如下:

  • Activity 目录

    • index.jsp
    • 结果.jsp
  • 登录

    • 登录.html
    • 错误.html
    • Logo .png
    • 样式.css

现在,当我进行身份验证时,它不会返回到我请求的网页,而是会重定向到图像。

我在这里做错了什么吗?

感谢您的帮助!

最佳答案

尝试允许任何人读取登录目录

<security-constraint>     
<display-name>login</display-name>
<web-resource-collection>
<web-resource-name>login</web-resource-name>
<description/>
<url-pattern>/login/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>*</role-name>
</auth-constraint>
<user-data-constraint>
<description/>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

关于java - 在 glassfish 3.1.2 中将图像添加到表单例份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12906498/

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