Error using membership in WCF

Error using membership in WCF

Postby y0zh » Fri 14 May 2010 08:47

Hello everybody. Sorry for my English.
I have a trouble using PgSqlMembershipProvider in WCF services for authentication.
My configuration section in web.config for service
Code: Select all


         
            
            
         

      

      
         
            
            
         

      


...
Code: Select all
      

   
      
         
            
               
               
         
           
         

         
            

         

      

      
         
            
         
           
         

            

         

      

      
         
       
         
           
         

       

            
            
         

      

   


When i call my method
Code: Select all
[OperationContract]
[PrincipalPermission(SecurityAction.Demand, Role = "admin")]
public string[] AdminMethod()                                      <- exception here
{
...
}

Code: Select all
I using proxy in my client (silverlight)

var proxy = new MyReference.MyServiceClient();
            proxy.ClientCredentials.UserName.UserName = "username";
            proxy.ClientCredentials.UserName.Password = "password";
            proxy.AdminMethodAsync();

I have an exception
System.Security.SecurityException was unhandled by user code
Message=Сбой при запросе разрешений для владельца учетной записи.(Failure at inquiry of permissions for the owner of the accounting record) (machine translate)
Source=mscorlib
GrantedSet=""
PermissionState=version="1">
Role="admin"/>


RefusedSet=""
Url=""
StackTrace:
in System.Security.Permissions.PrincipalPermission.ThrowSecurityException()
in System.Security.Permissions.PrincipalPermission.Demand()
in System.Security.PermissionSet.DemandNonCAS()
in GISService.Authenticate(String UserName, String PasswordHash) в c:\Users\User\Documents\Visual Studio 2010\Projects\MyProject\site\App_Code\MyService.cs:string 590
in SyncInvokeAuthenticate(Object , Object[] , Object[] )
in System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
InnerException:


Why it occurs?
y0zh
 
Posts: 1
Joined: Fri 14 May 2010 08:03
Location: Russia, Krasnodar

Postby StanislavK » Thu 20 May 2010 16:18

For Visual Studio 2010, the problem may be caused by the fact that the default hash algorithm was changed from SHA1 to HMACSHA256 in .NET Framework v4. We will set the hash algorithm explicitly in our code, the fix will be available in one of the nearest builds.

As a temporary workaround, please set the hash algorithm to SHA1 in ASP.NET providers of your application. For more information on this issue, please see the following topic:
http://www.devart.com/forums/viewtopic.php?t=17508

If the problem persists, please send us a small test project with which the problem can be reproduced.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for PostgreSQL