Get username of currently logged windows user.

69 views
Skip to first unread message

ihorse rails

unread,
Sep 30, 2013, 6:14:32 AM9/30/13
to rubyonra...@googlegroups.com
Hi Folks,

Good Evening,

I want to get username of currently logged windows user. is it possible??

If Possible.. please attach the sample code for more reference.

Please advise.

Thanks&Regards,
Ashokkumar

Robert O'Connor

unread,
Oct 1, 2013, 11:24:05 AM10/1/13
to rubyonra...@googlegroups.com

System properties.

--rob
Sent from my cell...excuse typos

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/988a2685-42b7-4301-b9d9-1575648aef91%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Matt Jones

unread,
Oct 2, 2013, 8:43:20 AM10/2/13
to rubyonra...@googlegroups.com


On Monday, 30 September 2013 05:14:32 UTC-5, ihorse rails wrote:
Hi Folks,

Good Evening,

I want to get username of currently logged windows user. is it possible??


Currently logged in where, exactly? It's certainly not going to be available from a web browser session under most circumstances. There's NTLM authentication which can do this, but it only works if the user has marked the site requesting it as "trusted".

Some Googling for "ntlm authentication rails" turned up a couple gems:


Note that both projects are pretty thinly maintained; depending on the Rails version you're targeting, you may need to roll your own solution instead.

Also note that NTLM hands you information that is totally under the end-user's control: you'll need to verify the information with an Active Directory server if you  want to have any confidence in the values. rack-ntlm appears to do this, but ntlm-sso does *not*.

 
If Possible.. please attach the sample code for more reference.

That's not really how this list works: you'll get a much better response if you can say, "here's what I've tried, and this is how it's not working" instead of "GIVE ME CODEZ PLZ".

--Matt Jones
Reply all
Reply to author
Forward
0 new messages