107 lines
3.3 KiB
C#
107 lines
3.3 KiB
C#
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Microsoft.AspNet.Identity.EntityFramework.InMemory.Test
|
|
{
|
|
public class InMemoryUser : InMemoryUser<string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>
|
|
{
|
|
public InMemoryUser()
|
|
{
|
|
Id = Guid.NewGuid().ToString();
|
|
}
|
|
|
|
public InMemoryUser(string userName)
|
|
: this()
|
|
{
|
|
UserName = userName;
|
|
}
|
|
}
|
|
|
|
public class InMemoryUser<TKey, TLogin, TRole, TClaim>
|
|
where TLogin : IdentityUserLogin<TKey>
|
|
where TRole : IdentityUserRole<TKey>
|
|
where TClaim : IdentityUserClaim<TKey>
|
|
where TKey : IEquatable<TKey>
|
|
{
|
|
public InMemoryUser()
|
|
{
|
|
Claims = new List<TClaim>();
|
|
Roles = new List<TRole>();
|
|
Logins = new List<TLogin>();
|
|
}
|
|
|
|
public virtual TKey Id { get; set; }
|
|
public virtual string UserName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Email
|
|
/// </summary>
|
|
public virtual string Email { get; set; }
|
|
|
|
/// <summary>
|
|
/// True if the email is confirmed, default is false
|
|
/// </summary>
|
|
public virtual bool EmailConfirmed { get; set; }
|
|
|
|
/// <summary>
|
|
/// The salted/hashed form of the user password
|
|
/// </summary>
|
|
public virtual string PasswordHash { get; set; }
|
|
|
|
/// <summary>
|
|
/// A random value that should change whenever a users credentials have changed (password changed, login removed)
|
|
/// </summary>
|
|
public virtual string SecurityStamp { get; set; }
|
|
|
|
/// <summary>
|
|
/// PhoneNumber for the user
|
|
/// </summary>
|
|
public virtual string PhoneNumber { get; set; }
|
|
|
|
/// <summary>
|
|
/// True if the phone number is confirmed, default is false
|
|
/// </summary>
|
|
public virtual bool PhoneNumberConfirmed { get; set; }
|
|
|
|
/// <summary>
|
|
/// Is two factor enabled for the user
|
|
/// </summary>
|
|
public virtual bool TwoFactorEnabled { get; set; }
|
|
|
|
/// <summary>
|
|
/// DateTime in UTC when lockout ends, any time in the past is considered not locked out.
|
|
/// </summary>
|
|
public virtual DateTime? LockoutEnd { get; set; }
|
|
|
|
/// <summary>
|
|
/// Is lockout enabled for this user
|
|
/// </summary>
|
|
public virtual bool LockoutEnabled { get; set; }
|
|
|
|
/// <summary>
|
|
/// Used to record failures for the purposes of lockout
|
|
/// </summary>
|
|
public virtual int AccessFailedCount { get; set; }
|
|
|
|
/// <summary>
|
|
/// Navigation property for user roles
|
|
/// </summary>
|
|
public virtual ICollection<TRole> Roles { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Navigation property for user claims
|
|
/// </summary>
|
|
public virtual ICollection<TClaim> Claims { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Navigation property for user logins
|
|
/// </summary>
|
|
public virtual ICollection<TLogin> Logins { get; private set; }
|
|
|
|
}
|
|
}
|
|
|