有没有一种方法可以在Rails上使用ruby读取客户端Windows登录名 [英] is there a way to read a clients windows login name using ruby on rails

查看:71
本文介绍了有没有一种方法可以在Rails上使用ruby读取客户端Windows登录名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Windows上运行的Ruby on Rails上构建了一个内部网应用程序.将要访问此应用程序的每个人都在Windows上运行,并且已经通过Windows登录到网络.

I've built an intranet application on Ruby on Rails running on Windows. Everyone who will be accessing this app is running on Windows and is already logged into the network with Windows.

我需要做的就是获取已登录用户的登录名,并将该登录名保存到会话变量中.我尝试了ENV ['USERNAME'],但是只显示登录到服务器框中的人,就是我.

All I need to do is to grab the login name of the logged in user and save that login name to a session variable. I tried ENV['USERNAME'] but that only shows the person who is logged into the server box, which is me.

有什么方法可以自动从访问网站的用户那里获取并存储该变量?我知道我可以问他们,但是我认为必须有某种方法来抓住它.

Is there any way to automatically grab and store that variable from the users who are access the site? I know that I could ask them for it but I assume that there must be some way to grab it.

谢谢...克里斯

推荐答案

否,您将需要在Rails应用程序中设置身份验证系统.在许多系统(例如浏览器)中,访问客户端环境将是一个巨大的安全漏洞.根据您的要求,有许多不错的Rails插件可以为您处理所有身份验证.我个人喜欢设计.有一些插件可以使用,如果您不希望存储用户名/密码并让用户维护您的Intranet应用程序的另一套登录凭据,则可以通过LDAP服务器进行身份验证.但是,这很常见.

No, you will need to setup an authentication system within your rails application. Accessing the clients environment would be a huge security breach in a number of systems such as the browser. Depending on your requirements there are a number of nice plugins for rails to handle all of this authentication for you. I personally like devise. There are a few plugins for it and one that would authenticate with an LDAP server if you did not wish to store username/passwords and make users maintain a separate set of login credentials for your intranet application. This, however, is very common.

这篇关于有没有一种方法可以在Rails上使用ruby读取客户端Windows登录名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆