Tomcat MemoryRealm 身份验证位于 jsp:include
我想在包含 jsp 时对用户进行身份验证。 我进入
<Realm className="org.apache.catalina.realm.MemoryRealm" />
了我的 server.xml 和
<role rolename="testuser" />
tomcat-user.xml 中的
现在我的问题包括: 我希望弹出登录表单,位于 jsp /modules/administration/admininstation.jsp 包含有
<jsp:include page="modules/administration/administration.jsp" flush="true"/>
有办法做到这一点吗? 我找不到匹配的 url 模式。或者tomcat不识别包含作为请求? errrrr 我不明白!
谢谢!
I want to authenticate a user, when a jsp is included.
I got
<Realm className="org.apache.catalina.realm.MemoryRealm" />
in my server.xml
and
<role rolename="testuser" />
<user name="test" password="test" roles="testuser" />
in the tomcat-user.xml
Now my problem with the include:
I want that the login form pops up, wenn the jsp /modules/administration/admininstation.jsp
is included by
<jsp:include page="modules/administration/administration.jsp" flush="true"/>
Is there a way to do this?
I couldn´t find a url-pattern that matches. Or does tomcat not recognize the include as an request? errrrr I don´t understand that!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
身份验证发生在每个请求开始时。
jsp:include
执行服务器端包含(= 没有从浏览器到 Tomcat 的任何新请求),因此在jsp:include
之前没有第二次身份验证>。如果客户端可以访问原始页面,她也将看到包含的 jsp。您可能应该向浏览器发送重定向(提示),您可能还需要正确设置
security-constraint
和login-config
标签web.xml
。Authentication happens at the start of every request.
jsp:include
does a server side include (= there isn't any new request from the browser to the Tomcat), so there is not a second authentication before thejsp:include
. If the client has access to the original page she will see the included jsp too.You may should send a redirect to the browser (hint) and you may also need to set properly the
security-constraint
and thelogin-config
tags in theweb.xml
.