Rails app, REMOTE_USER attribute in IIS 8.5 with windows authentication

99封情书 提交于 2020-01-04 05:26:29

问题


I have setup a IIS 8.5 server that runs a rails app using HttpPlatformHandler and Windows authentication. We have also tried using ARR as reverse proxy with same results.

This all works completely fine, users are authenticated using kerberos, and anonymous authentication is disabled, no problem there. We can deny specific users and see that it has effect.

The problem is that there is no REMOTE_USER or AUTH_USER attribute anywhere in the http response headers. However the HTTP_AUTHORIZATION header is set and is eg "Negotiate YIIHJAYGKw....".

We haven't found a reasonable way to decode the HTTP_AUTORIZATION header either.

Any form of help would be much appreciated.


回答1:


To fix this, you need to install helicontech's ISAPI_Rewrite 3 on the server running IIS. download url is here: ISAPI_Rewrite 3.

After that navigate to the install folder, the default is C:\Program Files\Helicon\ISAPI_Rewrite3

In there you will find a file called httpd.conf, open it up and add:

RewriteBase /
RewriteCond %{REQUEST_URI} ^/.*
RewriteHeader X-Remote-User: .* %{REMOTE_USER}

Now you will be able to get the remote username in your ruby code with:

request.env['HTTP_X_REMOTE_USER']


来源:https://stackoverflow.com/questions/33347412/rails-app-remote-user-attribute-in-iis-8-5-with-windows-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!