dbTalk Databases Forums  

Windows Auth issue

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Windows Auth issue in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Matthew Wells
 
Posts: n/a

Default Windows Auth issue - 03-11-2010 , 10:20 AM






I have one machine with an application running that many users need to log
in and out of quickly. Logging off the machine, logging in and restarting
the app takes too long. Users already log into the application using their
windows login and password which I check against the AD, then I build
connections strings so SQL Server knows who is logged in - which I need for
auditing. Using SQL authentication is not an option.

Is it possible to make a connection string to SQL Server using Windows
Authentication using a different windows user than the one logged into the
machine?

Thanks.

--
Matthew Wells
matthew.wells (AT) firstbyte (DOT) net

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Windows Auth issue - 03-11-2010 , 05:13 PM






Matthew Wells (matthew.wells (AT) firstbyte (DOT) net) writes:
Quote:
I have one machine with an application running that many users need to
log in and out of quickly. Logging off the machine, logging in and
restarting the app takes too long. Users already log into the
application using their windows login and password which I check against
the AD, then I build connections strings so SQL Server knows who is
logged in - which I need for auditing. Using SQL authentication is not
an option.

Is it possible to make a connection string to SQL Server using Windows
Authentication using a different windows user than the one logged into the
machine?
No. You could use the RunAs functionality in Windows to impersonate the
user.

The other alternative is to have the Windows session being logged in by a
service user. This server would then do an EXECUTE AS LOGIN when connected
to SQL Server. Or use SET CONTEXT_INFO and then the context_info()
function, but that may require you to do changes to the SQL code.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #3  
Old   
Matthew Wells
 
Posts: n/a

Default Re: Windows Auth issue - 03-11-2010 , 06:31 PM



I appreciate the response, but I don't think this helps. A regular user is
definitely logged in so a service user is out. I did a trick a few years
back where I added "WSID= " + CurrentUser to the connection string and then
used @@Host_ID to get the user. Seems really lame. I was really hoping
there was a more logical way.

Thsnks.


--
Matthew Wells
matthew.wells (AT) firstbyte (DOT) net

"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote

Quote:
Matthew Wells (matthew.wells (AT) firstbyte (DOT) net) writes:
I have one machine with an application running that many users need to
log in and out of quickly. Logging off the machine, logging in and
restarting the app takes too long. Users already log into the
application using their windows login and password which I check against
the AD, then I build connections strings so SQL Server knows who is
logged in - which I need for auditing. Using SQL authentication is not
an option.

Is it possible to make a connection string to SQL Server using Windows
Authentication using a different windows user than the one logged into
the
machine?

No. You could use the RunAs functionality in Windows to impersonate the
user.

The other alternative is to have the Windows session being logged in by a
service user. This server would then do an EXECUTE AS LOGIN when connected
to SQL Server. Or use SET CONTEXT_INFO and then the context_info()
function, but that may require you to do changes to the SQL code.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #4  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Windows Auth issue - 03-12-2010 , 03:02 AM



Matthew Wells (matthew.wells (AT) firstbyte (DOT) net) writes:
Quote:
I appreciate the response, but I don't think this helps. A regular user
is definitely logged in so a service user is out. I did a trick a few
years back where I added "WSID= " + CurrentUser to the connection string
and then used @@Host_ID to get the user. Seems really lame. I was
really hoping there was a more logical way.
I'm sorry if my response was not helpful enough, but since I only get a
glimpse of your environment, it's difficult to say which ideas that would
be workable. The one thing I can say with certainty is that if you are
logged into Windows as user X, you cannot log into SQL Server with
Windows authentication as user Y. This is a fundamental thing. Windows
authentication works from the principle that Windows have already
authenticated you, and that's why SQL Server lets you in.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #5  
Old   
Matthew Wells
 
Posts: n/a

Default Re: Windows Auth issue - 03-12-2010 , 08:25 AM



I didn't mean to sound unappreciative. I'm very grateful for suggestions
whether they work or not. I'm just glad you're not one of those people that
reply with "Have you looked at the help?".

--
Matthew Wells
matthew.wells (AT) firstbyte (DOT) net

"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote

Quote:
Matthew Wells (matthew.wells (AT) firstbyte (DOT) net) writes:
I appreciate the response, but I don't think this helps. A regular user
is definitely logged in so a service user is out. I did a trick a few
years back where I added "WSID= " + CurrentUser to the connection string
and then used @@Host_ID to get the user. Seems really lame. I was
really hoping there was a more logical way.

I'm sorry if my response was not helpful enough, but since I only get a
glimpse of your environment, it's difficult to say which ideas that would
be workable. The one thing I can say with certainty is that if you are
logged into Windows as user X, you cannot log into SQL Server with
Windows authentication as user Y. This is a fundamental thing. Windows
authentication works from the principle that Windows have already
authenticated you, and that's why SQL Server lets you in.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.