Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
High all. I am wondering if there is a way, via C#, to check to see if a user has access to a particualr database on a particular SQL server. My situation is this: I have a WCF service running under a process account, protocol is net.tcp. I have been experiencing a double hop issue - getting logon failed for user NT AUTHORITY\ANONYMOUS LOGON. My network and web guys tell me configuring Kerberos with the necessarry settings is not allow and suggested I validate is if the user has db access prior to calling the database. Yes, I know, this stinks....bad! However, I am a contractor and will need to accomodate their demands :-). Can active directory find a SQL db? Anyway, your thoughs and suggestions are greatly appreciated. Thank you all!
Posted

1 solution

The best I can say (and I'm certainly no security expert) is that there should be an Active Directory group that is used to access the database and you should be able to check to see whether or not the user is a member of that group. If this is an internal company system, that may be enough. However, how will you get the actual user's information? How easy will it be for someone to send another user's credentials?

Also, why would a user have access to the Web Service but no access to the database?
 
Share this answer
 
Comments
RonnieDean77 1-Feb-13 23:30pm    
Ah, good question. I am obtaining the user id from the ServiceSecurityContext.Current.WindowsIdentity. So I can authenticate the correct user id against AD.
PIEBALDconsult 2-Feb-13 0:04am    
And how is it sent?

Remember that one of the strengths (or weaknesses) of a Web Service is that anyone can write a client for it. I might be able to write my own client and send your credentials.
fjdiewornncalwe 1-Feb-13 23:56pm    
+5.
RonnieDean77 2-Feb-13 2:10am    
It is not sent. In the WCF service code it can obtain the sercurity context of the calling user.
PIEBALDconsult 2-Feb-13 11:29am    
Then that should work. Unless I build a machine that says I'm you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900