简体   繁体   English

使用AJP在Tomcat中模拟和/或启用单一登录

[英]Emulate and/or Enable Single Sign On in Tomcat using AJP

I have apache forwarding requests to tomcat using ajp. 我有apache使用ajp将请求转发到tomcat。 My app in tomcat uses basic authentication via tomcat-users user database. 我在tomcat中的应用通过tomcat-users用户数据库使用基本身份验证。 Users are listed there, given roles, and everything works great. 列出了用户,指定了角色,一切正常。

However, my users have id cards they plug into their workstations which identify them by a unique number. 但是,我的用户有身份证,他们将其插入自己的工作站,并通过唯一编号进行识别。 I don't know the details of this, but apache and the browser has some module(s) which automatically identifies the user and essentially authenticates her and REMOTE_USER is available when in the apache environment. 我不知道其详细信息,但是apache和浏览器具有一些模块,这些模块可以自动识别用户并从本质上对用户进行身份验证,并且在apache环境中可以使用REMOTE_USER。

Unfortunately, REMOTE_USER isn't available in tomcat (via the request.getRemoteUser()), so the user is prompted to log in when going to my tomcat app. 不幸的是,tomcat中无法使用REMOTE_USER(通过request.getRemoteUser()),因此在进入我的tomcat应用程序时会提示用户登录。 I found this thread: 我发现了这个线程:

Forward REMOTE_USER to tomcat via AJP (eg for shibboleth) 通过AJP将REMOTE_USER转发到tomcat(例如shibboleth)

Which describes that you can disable tomcat authentication, which makes the REMOTE_USER available in tomcat, but since we've disabled the tomcat authentication, there are no longer any roles assigned to the user. 它描述了您可以禁用tomcat身份验证,从而使REMOTE_USER在tomcat中可用,但是由于我们已禁用了tomcat身份验证,因此不再分配任何角色给用户。

To be clear, I've added this id number to the tomcat-users but it doesn't help: 为了清楚起见,我已经将此ID号添加到了tomcat-users中,但无济于事:

<user username="billg" password="pass" roles="ceo"/>
<!-- billg's id number -->
<user username="12345@ms" roles="ceo"/>

I know this is a somewhat unique environment and request, but does anyone have experience with making something like this work? 我知道这是一个有点独特的环境和要求,但是有人有做这样的作品的经验吗?

FWIW: This is apache 2.2+ and tomcat 6 (but if there's a solution for tomcat 7+ I'm interested in that as well). FWIW:这是Apache 2.2+和tomcat 6(但是如果有适用于tomcat 7+的解决方案,我也对此感兴趣)。

Thanks! 谢谢!

You want to set tomcatAuthentication="false" in your server.xml 's AJP <Connector> configuration. 您想要在server.xml的AJP <Connector>配置中设置tomcatAuthentication="false"

See Tomcat's AJP Connector Configuration Guide for reference. 有关参考,请参见《 Tomcat的AJP连接器配置指南 》。

While the reference I gave was for Tomcat 8, the same technique also applies to Tomcat 7 and Tomcat 6 as well. 虽然我给出的参考是针对Tomcat 8的,但同样的技术也适用于Tomcat 7和Tomcat 6。 But you may as well upgrade to Tomcat 8 since it's stable and Tomcat 6 is in maintenance mode these days and doesn't get much in the way of improvements. 但是您也可以升级到Tomcat 8,因为它稳定并且Tomcat 6目前处于维护模式,并且改进的方式不多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM