Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Inheriting IIS Windows Basic Authentication on webserver to underlying MS SQL Perl database connection

by eelkonio (Initiate)
on Aug 02, 2018 at 08:30 UTC ( [id://1219684]=perlquestion: print w/replies, xml ) Need Help??

eelkonio has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys,

Even though I've been working in Perl for about 20 years, I've stumbled upon a challenge I can't really get my head around yet. Let me outline the problem.

I've written some web-based support tools in Perl that I can run on localhost (also via a HTTP::Server::Simple webserver I wrote). However, each employee has different authorisations on the database servers: some can access databases A and B, others A, B and C, etc.

Now we want the IIS server that will be used for these tools to use Windows Basic Authentication, so people will automatically be recognized and the permissions for the web server will be set accordingly. But each database requests that is generated by the Perl scripts, should inherit this authentication and send off requests to the MS SQL server using the user's authentication.

How can I get the authentication values into my Perl script from IIS and use these to fire off requests to the MS SQL database with those same authentication values? Can I perhaps access the user's data via LDAP somehow?

Btw: the MS SQL database connection also uses Windows Basic Authentication; the connect string I use personally for my scripts is:
     my $dbh = DBI->connect( "DBI:ODBC:driver={SQL Server};Server=$server;Database=$database;");

I expect I will be able to access the username via HTTP environment variables, but not the password. Those two are probably necessary to access the database with the user's credentials. So I'm stuck unless I start gathering passwords from users. Which of course is a security no-no. And asking a user to type in his password in a password field for each click isn't the way to go IMHO.

Is there a way to inherit the windows authentication in Perl to access the database with the user's credentials that he used to access the IIS server?

Hope you can help!

  • Comment on Inheriting IIS Windows Basic Authentication on webserver to underlying MS SQL Perl database connection
  • Download Code

Replies are listed 'Best First'.
Re: Inheriting IIS Windows Basic Authentication on webserver to underlying MS SQL Perl database connection
by anonymized user 468275 (Curate) on Aug 02, 2018 at 09:28 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1219684]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-18 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found