Network user with sinatra

Hi, I would like to know how can I get the network username that is
accessing a page when using Sinatra, I know that is possible to get the
ip by request.ip

Mario R. wrote in post #1052276:

Hi, I would like to know how can I get the network username that is
accessing a page when using Sinatra, I know that is possible to get the
ip by request.ip

What exactly do you mean by “network username”?

Kind regards

robert

I mean the user name log into the company network.

Robert K. wrote in post #1052287:

What exactly do you mean by “network username”?

Please do not top post.

Mario R. wrote in post #1052317:

Robert K. wrote in post #1052287:

What exactly do you mean by “network username”?
I mean the user name log into the company network.

Are you talking about a Windows domain login? I do not have too much
insight into Windows authentication mechanisms but I doubt you can
access user name from an ordinary HTTP request - at least not with
additional efforts.

Cheers

robert

Robert K. wrote in post #1052335:

Are you talking about a Windows domain login? I do not have too much
insight into Windows authentication mechanisms but I doubt you can
access user name from an ordinary HTTP request - at least not with
additional efforts.

it is like in Ruby using ENV[‘user’] or ENV[‘username’], work for linux
or windows

Mario R. wrote in post #1052356:

Robert K. wrote in post #1052335:

Are you talking about a Windows domain login? I do not have too much
insight into Windows authentication mechanisms but I doubt you can
access user name from an ordinary HTTP request - at least not with
additional efforts.

it is like in Ruby using ENV[‘user’] or ENV[‘username’], work for linux
or windows

Not from a web request it doesn’t.

If the user has to authenticate to your site (e.g. with HTTP Basic
Auth), then you can get the username they authenticated with. This may
or may not be related to their domain login.

But if they just went to http://your.site/ and your site doesn’t require
authentication, then your site will just serve them the page and you
won’t know what Windows username they had.

If they have a domain login, then it might be possible to set up your
webserver to require Kerberos authentication and for the Windows client
to present its domain Kerberos ticket as credentials. I don’t know how
feasible this is. I’ve done it with Unix krb5 clients but not with
Windows clients.

On 3/20/12 9:57 PM, Brian C. wrote:

Mario R. wrote in post #1052356:

Robert K. wrote in post #1052335:

But if they just went to http://your.site/ and your site doesn’t require
authentication, then your site will just serve them the page and you
won’t know what Windows username they had.

If they have a domain login, then it might be possible to set up your
webserver to require Kerberos authentication and for the Windows client
to present its domain Kerberos ticket as credentials. I don’t know how
feasible this is. I’ve done it with Unix krb5 clients but not with
Windows clients.

With domain logins it’s possible to have Apache handle it. I worked on a
project several years ago that did this for an internal application. We
may have used mod_ntlm, but I can’t remember:
http://modntlm.sourceforge.net/

Sorry if that’s extremely vague, I’m just confirming that it is possible
to have a Rails app with Windows domain logins, even if I don’t remember
how we did it.

-greg

On 3/20/12 10:33 PM, Gregory B. wrote:

On 3/20/12 9:57 PM, Brian C. wrote:

Sorry if that’s extremely vague, I’m just confirming that it is possible
to have a Rails app with Windows domain logins, even if I don’t remember
how we did it.

Oh, another option if you need internet based logins (which we also
built) is to use LDAP to access the user database and authenticate
against it. I used Net::LDAP to do this but can’t remember the details
at all: http://net-ldap.rubyforge.org/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs