通过AJP将REMOTE_USER转发给tomcat(例如shibboleth)

今天我只是遇到以下问题:1.我configuration了基本authentication(需要有效的用户)的Apache; 哪些工作。 2.我进一步configurationApache转发一些path的请求(在我的情况下/ idp)到tomcat servlet(shibboleth IDP)。

结果是,shibboleth IdP(ECPconfiguration文件)告诉我没有设置“REMOTE_USER”(它使用httpRequest.getRemoteUser()方法来检查这个;它返回null)。

我尝试了很多像SetEnv和RewriteRule的东西,但没有成功。

解决方法很简单,但很难find…所以我决定在这里发布,以帮助其他人解决这类问题。

问候Stefan

好的,这是我的解决方案。 我发现,需要将tomcat配置为信任/接受由apache2完成的身份验证…

为此,您必须编辑tomcat的server.xml(应位于/etc/tomcat6/server.xml或类似位置),并将tomcatAuthentication="false"添加到您的用于AJP连接的<Connector> tomcatAuthentication="false" 。 我的连接器标签看起来像这样:

 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" tomcatAuthentication="false" /> 

现在你只需要重新启动tomcat …完成。

希望这可以帮助! 😉

斯特凡

说明:

“tomcatAuthentication” – “如果设置为true,则认证将在Tomcat中完成,否则认证的主体将从本地web服务器传播并用于Tomcat中的授权,默认值为true。

引用自: http : //tomcat.apache.org/tomcat-5.5-doc/config/ajp.html