We are calling .LoginAsync and we have a simple login manager that simply creates a userbase with the credentials we pass in. It sets the name and isauthenticated=true. After the login is complete I expected that the EntityManager would then have a populated Principal but...well it does, but the name is null and isauthenticated is false.
So, after login:
EntityManager.IsLoggedIn = true
EntityManager.Principal.Identity.Name = null
EntityManager.Principla.Identity.IsAuthenticated = false
using System; using System.Security.Principal; using IdeaBlade.EntityModel;
using System.Runtime.Serialization;
namespace SilverlightApplication2 {
#if !SILVERLIGHT public class SimpleLoginManager : IEntityLoginManager { #region IEntityLoginManager Members
public IPrincipal Login(ILoginCredential credential, EntityManager entityManager) { return new UserBase(new GenericIdentity(credential.UserName), null); }
public void Logout(IPrincipal principal, EntityManager entityManager) { }
#endregion }
#endif
[DataContract] public class GenericIdentity : IIdentity { #region IIdentity Members
public GenericIdentity(string name) { Name = name; IsAuthenticated = true; }
public string AuthenticationType { get; internal set; }
public bool IsAuthenticated { get; internal set; }
public string Name { get; internal set; }
#endregion } }
|
So, what am I doing wrong or how are my expectations wrong?
What I want to end up with is a correctly populated Identity on the EntityManager if possible.
(I know this example doesn't handle null, its just for testing upcoming changes)