Simple Security Question<font size=2><span style="font-family:Arial">I have a service that I have designed for message security. The current working production version uses an X509 to accomplish this. Using WCF this was a relatively simple feat.<br><br>At the time when we first deployed this service there was only one user and a set of operations that were built for that user. Now we are expanding the service to multiple users. The new user should not have access to the methods the previous user had access to. Because of this new requirement, using X509 to simply secure the message is not enough security anymore.<br><br>Now I need to implement a UN/PW system so that I can provide role-based access to the different operations available. I have been pounding the pavement on this for several hours and *thought* I had it, but I can't get passed a very generic and vague error message: &quot; System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---&gt;  System.ServiceModel.FaultException: An error occurred when verifying security for the message..&quot;<br><br>My intention is to use the default ASP.Net membership provider to authenticate people. I have the following binding definition now:<br><br></span></font> <div style="text-align:left"><font size=2><span style="font-family:Arial"> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p></p> <div style="margin-left:40px">&lt;bindings&gt;<br></div> <p>&lt;wsHttpBinding&gt;<br>&lt;binding name=&quot;UserNameWS&quot;&gt;<br>&lt;security mode=&quot;Message&quot;&gt;<br>&lt;message clientCredentialType=&quot;UserName&quot; /&gt;<br>&lt;/security&gt;<br>&lt;/binding&gt;<br>&lt;/wsHttpBinding&gt;<br>&lt;/bindings&gt;</p></div></div></span></font><br><font size=2><span style="font-family:Arial"></span></font>I simply changed the line &quot;clientCredentialType=&quot;None&quot;&quot; to clientCredentialType=&quot;UserName&quot;. I also worked to configure the ASP.Net membership provider.<br>My assumption (and that's all it is at this point) is that since I have that membership provider as my default and I have the clientCredentialType set to UserName that WCF will use the membership provider to authenticate the user upon receipt of a new message. I don't know if that assumption is right or if more configuration needs to be done first or if what I want is even possible. I can't find anything online that will tell me I can do it this way exactly.<br>In the interest of being complete, here is how I am providing the client credentials on the client side. <br> <div style="text-align:left"> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p>service.ClientCredentials.UserName.UserName = &quot;user&quot;;<br>service.ClientCredentials.UserName.Password = &quot;password&quot;;<br></p></div></div><font size=2></font></div></div>© 2009 Microsoft Corporation. All rights reserved.Wed, 06 May 2009 11:28:35 Zc2994678-f264-471a-aa9d-b2a9f1082306http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#c2994678-f264-471a-aa9d-b2a9f1082306http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#c2994678-f264-471a-aa9d-b2a9f1082306omatasehttp://social.msdn.microsoft.com/Profile/en-US/?user=omataseSimple Security Question<font size=2><span style="font-family:Arial">I have a service that I have designed for message security. The current working production version uses an X509 to accomplish this. Using WCF this was a relatively simple feat.<br><br>At the time when we first deployed this service there was only one user and a set of operations that were built for that user. Now we are expanding the service to multiple users. The new user should not have access to the methods the previous user had access to. Because of this new requirement, using X509 to simply secure the message is not enough security anymore.<br><br>Now I need to implement a UN/PW system so that I can provide role-based access to the different operations available. I have been pounding the pavement on this for several hours and *thought* I had it, but I can't get passed a very generic and vague error message: &quot; System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---&gt;  System.ServiceModel.FaultException: An error occurred when verifying security for the message..&quot;<br><br>My intention is to use the default ASP.Net membership provider to authenticate people. I have the following binding definition now:<br><br></span></font> <div style="text-align:left"><font size=2><span style="font-family:Arial"> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p></p> <div style="margin-left:40px">&lt;bindings&gt;<br></div> <p>&lt;wsHttpBinding&gt;<br>&lt;binding name=&quot;UserNameWS&quot;&gt;<br>&lt;security mode=&quot;Message&quot;&gt;<br>&lt;message clientCredentialType=&quot;UserName&quot; /&gt;<br>&lt;/security&gt;<br>&lt;/binding&gt;<br>&lt;/wsHttpBinding&gt;<br>&lt;/bindings&gt;</p></div></div></span></font><br><font size=2><span style="font-family:Arial"></span></font>I simply changed the line &quot;clientCredentialType=&quot;None&quot;&quot; to clientCredentialType=&quot;UserName&quot;. I also worked to configure the ASP.Net membership provider.<br>My assumption (and that's all it is at this point) is that since I have that membership provider as my default and I have the clientCredentialType set to UserName that WCF will use the membership provider to authenticate the user upon receipt of a new message. I don't know if that assumption is right or if more configuration needs to be done first or if what I want is even possible. I can't find anything online that will tell me I can do it this way exactly.<br>In the interest of being complete, here is how I am providing the client credentials on the client side. <br> <div style="text-align:left"> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <p>service.ClientCredentials.UserName.UserName = &quot;user&quot;;<br>service.ClientCredentials.UserName.Password = &quot;password&quot;;<br></p></div></div><font size=2></font></div></div>Wed, 13 Aug 2008 19:58:47 Z2008-08-18T22:59:32Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#fa700021-ab7f-4e4d-8760-359f1e7977b8http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#fa700021-ab7f-4e4d-8760-359f1e7977b8omatasehttp://social.msdn.microsoft.com/Profile/en-US/?user=omataseSimple Security Question<font size=2><span style="font-family:Arial">bump</span></font>Thu, 14 Aug 2008 14:25:10 Z2008-08-14T14:25:10Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#04d1b828-eea9-462a-a3be-299f2cf75332http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#04d1b828-eea9-462a-a3be-299f2cf75332Dan Rigsbyhttp://social.msdn.microsoft.com/Profile/en-US/?user=Dan%20RigsbySimple Security Question<p align=left><font face=Arial size=2>Are you using a certificate or SSL?  This errro indicates taht you should be using one of these to protect the data.</font></p>Thu, 14 Aug 2008 15:35:48 Z2008-08-14T15:35:48Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#95f97d2b-4d7a-437c-966a-f0f9cf4ce37ehttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#95f97d2b-4d7a-437c-966a-f0f9cf4ce37eomatasehttp://social.msdn.microsoft.com/Profile/en-US/?user=omataseSimple Security Question<font size=2><span style="font-family:Arial">Thanks for your help, I found the problem and it was a dumb one. I was using integrated security on the connection string for the database so the problem simply was it couldn't connect to the db to authenticate my credentials. I changed this and it is all working now.<br><br>Thanks again!<br></span></font>Mon, 18 Aug 2008 14:43:25 Z2008-08-18T22:59:32Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#560653c3-4e4c-4a2e-ae3b-bbe11cb0c47chttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#560653c3-4e4c-4a2e-ae3b-bbe11cb0c47cDan Rigsbyhttp://social.msdn.microsoft.com/Profile/en-US/?user=Dan%20RigsbySimple Security QuestionGlad it was something simple and that you could find it on your own!  This would have been difficult to diagnose over teh forums.  <p align=left><font face=Arial size=2></font> </p>Mon, 18 Aug 2008 14:52:20 Z2008-08-18T14:52:20Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#f644cb9c-d4c0-44cc-847c-83180dd1489ehttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#f644cb9c-d4c0-44cc-847c-83180dd1489everthohttp://social.msdn.microsoft.com/Profile/en-US/?user=verthoSimple Security QuestionI have the same problem now, but I dont understand what you meen by &quot;i changed this&quot;?<br/>What exactly did you change to get this working?Wed, 06 May 2009 07:53:10 Z2009-05-06T07:53:10Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#811baf71-3a72-473c-bde9-5a281beba851http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#811baf71-3a72-473c-bde9-5a281beba851verthohttp://social.msdn.microsoft.com/Profile/en-US/?user=verthoSimple Security QuestionHi Dan, do you know what he changed to get this working?Wed, 06 May 2009 07:53:56 Z2009-05-06T07:53:56Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#552c8e1b-8f68-4809-9221-2bcd6e7e925ehttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#552c8e1b-8f68-4809-9221-2bcd6e7e925eRichard Blewetthttp://social.msdn.microsoft.com/Profile/en-US/?user=Richard%20BlewettSimple Security Question<p>The OP was using integrated security on his connection string. The account that the service was running as didn;t have access to the database. &quot;I changed this&quot; means he either granted access to the database for the account or he changed to use SQL logins (providing a userid and password in the connection string)</p><hr class="sig">Richard Blewett, <a href="http://www.thinktecture.com">thinktecture</a> - <a href="http://www.dotnetconsult.co.uk/weblog2">http://www.dotnetconsult.co.uk/weblog2</a><br/> Twitter: <a href="http://twitter.com/richardblewett">richardblewett</a>Wed, 06 May 2009 08:36:49 Z2009-05-06T08:36:49Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#d63ef9d2-d03c-4f4e-86cd-e3b17230985bhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c2994678-f264-471a-aa9d-b2a9f1082306#d63ef9d2-d03c-4f4e-86cd-e3b17230985bverthohttp://social.msdn.microsoft.com/Profile/en-US/?user=verthoSimple Security Questionah! Thank you RichardWed, 06 May 2009 10:33:56 Z2009-05-06T10:33:56Z