如何限制tomcat中的登陆页面?
我有一个在 tomcat 上运行的 java Web 应用程序,并将使用单点登录(针对 Active Directory)进行身份验证。
我想要完成的是,只允许网络应用程序中的某些页面成为网站中的第一个“登陆页面”。
用例是,可以将浏览器指向index.jsp,然后在后台进行身份验证,然后转发到some_content.jsp。
但是,如果我将浏览器直接指向 some_content.jsp,我希望该请求以某种方式被拒绝,并且不在幕后进行身份验证。
换言之,如果我先访问 some_content.jsp,但尚未经过身份验证,我不希望进行身份验证,即使我设置了 SSO。
这是一个相当简单的安全约束问题,还是解决方案是什么?我正在寻找一个可以配置的解决方案,而不是添加代码。
多谢!
I have a java web application running on tomcat, and will use single sign on (against an Active Directory) for authentication.
What I want to accomplish is, that only certain pages in the web app are allowed to be the first "landing page" in the site.
The use case is that one may point the browser to index.jsp, and then be authenticated behind the scenes, and then be forwarded to some_content.jsp.
However, if I point the browser directly to some_content.jsp, I want the request to be denied, somehow, and NOT authenticated behind the scenes.
To rephrase, if I go to some_content.jsp first, without already being authenticated, I do not want authentication to happen, eventhough I have SSO set up.
Is it a matter of some fairly simple security-constraint, or what could a solution be? I am looking for a solution that can be configured, rather than adding code.
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

这不适用于容器管理的安全性。像 Tomcat 中那样具有容器管理器身份验证的具体登录入口点的唯一方法是 FORM 身份验证。我自己使用 SPNEGO auth,Tomcat 将在任何标记为受保护的 URL 上执行它。因此,除非您编写自定义身份验证器,否则路由登录页面是不可能的。
This won't work with container managed security. The only method to have a concrete login-entry-point with container-manager auth like in Tomcat is FORM auth. I use SPNEGO auth myself and Tomcat will perform it on any URL if it is denoted as protected. So a routing login page is not possible unless you write a custom authenticator.