32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using ln.identities;
|
|
using System.Linq;
|
|
namespace ln.application.demo
|
|
{
|
|
public class DemoIdentityProvider : BaseIdentityProvider
|
|
{
|
|
Dictionary<Guid, Identity> identities = new Dictionary<Guid, Identity>();
|
|
|
|
public DemoIdentityProvider()
|
|
{
|
|
Identity demoIdentity = new Identity("demo");
|
|
demoIdentity.AddSecureAttribute(new SeededPassword("demopass"));
|
|
|
|
identities.Add(demoIdentity.UniqueID,demoIdentity);
|
|
}
|
|
|
|
public override Identity CreateIdentity(string identityName)
|
|
{
|
|
Identity identity = new Identity(identityName);
|
|
identities.Add(identity.UniqueID, identity);
|
|
return identity;
|
|
}
|
|
|
|
public override IEnumerable<KeyValuePair<Guid, string>> GetIdentities() => identities.Select((arg) => new KeyValuePair<Guid, string>(arg.Key,arg.Value.IdentityName));
|
|
public override Identity GetIdentity(Guid uniqueID) => identities[uniqueID];
|
|
|
|
public override bool Save(Identity identity) => true;
|
|
}
|
|
}
|