Windows username of user

Hello,

I am writing a Ruby on Rails application with Flex as the front end.

The RoR is installed on linux and Flash UI interacting with Rails via
HTTPService is running on Windows.

I need to find the windows loginname of the user using my application to
perform some basic authentication, and perhaps display Hello
too. :slight_smile:

Could you please let me know how that could be made possible.

Many Thanks in advance,
Aman

Hi Aman,

I don’t know how to do it from Flash (and thus Flex). I doubt it’s
possible to do in straight ActionScript. That said, if it is possible
to use JavaScript to get it, you can have JavaScript get it and then
tell Flex via the Flex-Ajax Bridge
(http://labs.adobe.com/wiki/index.php/Flex_Framework:FABridge).

Since I’m not a JavaScript / ActiveX guru, I don’t know if this is
possible. One solution I have seen from googling is here:

That said, why don’t you just use a standard login system (e.g.
login_generator, acts_as_authenticated, restful_authentication) on the
Rails side (or roll your own, as is done in AWDwR) rather than trying
to get the Windows login name from Flex?

This would be more reliable than relying on JavaScript (which the user
may have disabled) and IE (since I assume that the ActiveX solution
shown at codingforums is IE-only). Furthermore, why limit yourself to
Windows clients when you can support Mac clients as well with less
effort on your part?

Cheers,
Peter A.

P.S. Shameless plug: I have examples of Flex talking to Rails–both
using login_generator and using restful_authentication–in my PDF-only
book Flexible Rails (http://www.flexiblerails.com). You can download
its MIT-licensed source code for free from
http://www.flexiblerails.com/files/FlexibleRailsBookCode.zip to see
how this works, regardless of whether you buy the book…

Aman Thind wrote:

Thank you so much Peter!

Yes I’ve confirmed that Flash can not provide the windows loginname to
me.

I was bent on acquiring the windows username for authentication as I do
not want to prompt the user for a username or password.

The list of users allowed to operate the application is very small and
can be authenticated against their windows id to mimic a single-signon.

Do you think solutions like Net::LDAP or login_generator could fit the
bill?

when i was trying to find a way to use windows authentication, the only
way i could find was by using a webserver that itself understands
windows-auth (so IIS for me). and then proxy the requests to mongrel(s)
(or whatever server runs your rails app).

see my post with a little howto at Finally solved: Windows Auth via IIS6 proxied to mongrel - Rails - Ruby-Forum

perhaps this helps,

ralf

Thank you so much Peter!

Yes I’ve confirmed that Flash can not provide the windows loginname to
me.

I was bent on acquiring the windows username for authentication as I do
not want to prompt the user for a username or password.

The list of users allowed to operate the application is very small and
can be authenticated against their windows id to mimic a single-signon.

Do you think solutions like Net::LDAP or login_generator could fit the
bill?

Many Thanks,
Aman