Print Page | Close Window

Problem with Login manager after upgrading from 5.x to 6.0.4

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2004
Printed Date: 16-Apr-2024 at 7:20am


Topic: Problem with Login manager after upgrading from 5.x to 6.0.4
Posted By: rasmus
Subject: Problem with Login manager after upgrading from 5.x to 6.0.4
Date Posted: 23-Jul-2010 at 8:26pm

Hi

Can you tell me if I need to update something in my LoginManager to make it work with the new DevForce version? The Implementation of the manager looks like this:

namespace NextStay.TallyIntegrator

{

//[DiscoverableType(DiscoverableTypeMode.KnownType)]

public class LoginManager : IEntityLoginManager

{

public IPrincipal Login(ILoginCredential credential, EntityManager entityManager)

{

// Disallow null credentials and throw a LoginException

if (credential == null)

{

throw new LoginException(LoginExceptionType.NoCredentials, "Loginoplysninger mangler");

}

//return error if loginmanager is null

if (entityManager == null)

throw new LoginException(LoginExceptionType.NoLoginManager, "Loginmanager findes ikke.");

var user = entityManager.GetQuery<User>().FirstOrDefault(u => u.Id == credential.UserName);

//user does not exist

if (user == null)

throw new LoginException(LoginExceptionType.InvalidUserName, "Bruger '" + credential.UserName + "' findes ikke.");

//wrong password

if (user.Password != credential.Password)

throw new LoginException(LoginExceptionType.InvalidPassword, "Forkert password.");

// types implementing IPrincipal.

GenericIdentity identity = new GenericIdentity(credential.UserName);

GenericPrincipal principal = new GenericPrincipal(identity, new string[] { });

return principal;

}

public void Logout(IPrincipal principal, EntityManager entityManager)

{

// No special processing needed.

}

}

}

But when using the code now, I get this error on the client
The formatter threw an exception while
trying to deserialize the message: There was an error while trying to deserialize
parameter http://ideablade.com/EntityModehLoginResult. The InnerException
message was ‘Element ‘http:!fideablade.com/EntityModel:Principal’ contains data
of the
‘http://schemas.datacontract.org/2004/O7/System.Security.Principal:GenericPrinci
pal data contract. The deserializer has no knowledge of any type that maps to this
contract. Add the type corresponding to ‘GenericPrincipal’ to the list of known
types - for example, by using the KnownTypeAttribute attribute or by adding it to
the list of known types passed to DataContractSerializer.’. Please see
InnerException for more details.



Replies:
Posted By: kimj
Date Posted: 24-Jul-2010 at 9:24am
GenericPrincipal and GenericIdentity are not types intrinsically defined in Silverlight.  In DF 2009 we defined those types within the DevForce assemblies, but removed this support in DF 2010.  You can return the DevForce UserBase class from your LoginManager, or sub-type UserBase, or implement your own custom implementations of IPrincipal and IIdentity. 



Print Page | Close Window