New Posts New Posts RSS Feed: Problem with Login manager after upgrading from 5.x to 6.0.4
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

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

 Post Reply Post Reply
Author
rasmus View Drop Down
Groupie
Groupie


Joined: 05-Aug-2009
Location: Denmark
Posts: 63
Post Options Post Options   Quote rasmus Quote  Post ReplyReply Direct Link To This Post Topic: Problem with Login manager after upgrading from 5.x to 6.0.4
    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.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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. 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down