diff --git a/src/Volo.Abp.Identity/Volo.Abp.Identity.xproj b/src/Volo.Abp.Identity/Volo.Abp.Identity.xproj
index 8b01b0a7a5..c205403593 100644
--- a/src/Volo.Abp.Identity/Volo.Abp.Identity.xproj
+++ b/src/Volo.Abp.Identity/Volo.Abp.Identity.xproj
@@ -4,18 +4,17 @@
14.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
17dbb40a-243e-41f7-a672-fa316ecb1e33
- Volo.Abp.Identity
+
+
.\obj
.\bin\
v4.6.1
-
2.0
-
+
\ No newline at end of file
diff --git a/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRole.cs b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRole.cs
new file mode 100644
index 0000000000..f9da7f8f56
--- /dev/null
+++ b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRole.cs
@@ -0,0 +1,65 @@
+// Copyright (c) .NET Foundation. 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;
+using System.Collections.ObjectModel;
+using JetBrains.Annotations;
+using Volo.Abp.Domain.Entities;
+
+namespace Volo.Abp.Identity
+{
+ //TODO: Should set Id to a GUID (where? on repository?)
+ //TODO: Properties should not be public!
+
+ ///
+ /// Represents a role in the identity system
+ ///
+ public class IdentityRole : Entity
+ {
+ ///
+ /// Gets or sets the name for this role.
+ ///
+ public virtual string Name { get; set; }
+
+ ///
+ /// Gets or sets the normalized name for this role.
+ ///
+ public virtual string NormalizedName { get; set; }
+
+ ///
+ /// Navigation property for claims in this role.
+ ///
+ public virtual ICollection Claims { get; } = new Collection();
+
+ ///
+ /// A random value that should change whenever a role is persisted to the store
+ ///
+ public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString();
+
+ ///
+ /// Initializes a new instance of .
+ ///
+ protected IdentityRole() { }
+
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The role name.
+ public IdentityRole([NotNull] string name)
+ {
+ Check.NotNull(name, nameof(name));
+
+ Name = name;
+ }
+
+ ///
+ /// Returns the name of the role.
+ ///
+ /// The name of the role.
+ public override string ToString()
+ {
+ return Name;
+ }
+ }
+}
diff --git a/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRoleClaim.cs b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRoleClaim.cs
new file mode 100644
index 0000000000..d62d303535
--- /dev/null
+++ b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityRoleClaim.cs
@@ -0,0 +1,61 @@
+using System.Security.Claims;
+using JetBrains.Annotations;
+using Volo.Abp.Domain.Entities;
+
+namespace Volo.Abp.Identity
+{
+ ///
+ /// Represents a claim that is granted to all users within a role.
+ ///
+ public class IdentityRoleClaim : Entity
+ {
+ ///
+ /// Gets or sets the of the primary key of the role associated with this claim.
+ ///
+ public virtual string RoleId { get; protected set; }
+
+ ///
+ /// Gets or sets the claim type for this claim.
+ ///
+ public virtual string ClaimType { get; protected set; }
+
+ ///
+ /// Gets or sets the claim value for this claim.
+ ///
+ public virtual string ClaimValue { get; protected set; }
+
+ protected IdentityRoleClaim()
+ {
+
+ }
+
+ public IdentityRoleClaim([NotNull] string roleId, [NotNull] Claim claim)
+ {
+ Check.NotNull(roleId, nameof(roleId));
+ Check.NotNull(claim, nameof(claim));
+
+ RoleId = roleId;
+ ClaimType = claim.Type;
+ ClaimValue = claim.Value;
+ }
+
+ public IdentityRoleClaim([NotNull] string roleId, [NotNull] string claimType, string claimValue)
+ {
+ Check.NotNull(roleId, nameof(roleId));
+ Check.NotNull(claimType, nameof(claimType));
+
+ RoleId = roleId;
+ ClaimType = claimType;
+ ClaimValue = claimValue;
+ }
+
+ ///
+ /// Constructs a new claim with the type and value.
+ ///
+ ///
+ public virtual Claim ToClaim()
+ {
+ return new Claim(ClaimType, ClaimValue);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUser.cs b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUser.cs
new file mode 100644
index 0000000000..b803419ccd
--- /dev/null
+++ b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUser.cs
@@ -0,0 +1,126 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using JetBrains.Annotations;
+using Volo.Abp.Domain.Entities;
+
+namespace Volo.Abp.Identity
+{
+ //TODO: Should set Id to a GUID (where? on repository?)
+ //TODO: Properties should not be public!
+
+ public class IdentityUser : Entity
+ {
+ ///
+ /// Gets or sets the user name for this user.
+ ///
+ public virtual string UserName { get; set; }
+
+ ///
+ /// Gets or sets the normalized user name for this user.
+ ///
+ public virtual string NormalizedUserName { get; set; }
+
+ ///
+ /// Gets or sets the email address for this user.
+ ///
+ public virtual string Email { get; set; }
+
+ ///
+ /// Gets or sets the normalized email address for this user.
+ ///
+ public virtual string NormalizedEmail { get; set; }
+
+ ///
+ /// Gets or sets a flag indicating if a user has confirmed their email address.
+ ///
+ /// True if the email address has been confirmed, otherwise false.
+ public virtual bool EmailConfirmed { get; set; }
+
+ ///
+ /// Gets or sets a salted and hashed representation of the password for this user.
+ ///
+ public virtual string PasswordHash { get; set; }
+
+ ///
+ /// A random value that must change whenever a users credentials change (password changed, login removed)
+ ///
+ public virtual string SecurityStamp { get; set; }
+
+ ///
+ /// A random value that must change whenever a user is persisted to the store
+ ///
+ public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString();
+
+ ///
+ /// Gets or sets a telephone number for the user.
+ ///
+ public virtual string PhoneNumber { get; set; }
+
+ ///
+ /// Gets or sets a flag indicating if a user has confirmed their telephone address.
+ ///
+ /// True if the telephone number has been confirmed, otherwise false.
+ public virtual bool PhoneNumberConfirmed { get; set; }
+
+ ///
+ /// Gets or sets a flag indicating if two factor authentication is enabled for this user.
+ ///
+ /// True if 2fa is enabled, otherwise false.
+ public virtual bool TwoFactorEnabled { get; set; }
+
+ ///
+ /// Gets or sets the date and time, in UTC, when any user lockout ends.
+ ///
+ ///
+ /// A value in the past means the user is not locked out.
+ ///
+ public virtual DateTimeOffset? LockoutEnd { get; set; }
+
+ ///
+ /// Gets or sets a flag indicating if the user could be locked out.
+ ///
+ /// True if the user could be locked out, otherwise false.
+ public virtual bool LockoutEnabled { get; set; }
+
+ ///
+ /// Gets or sets the number of failed login attempts for the current user.
+ ///
+ public virtual int AccessFailedCount { get; set; }
+
+ ///
+ /// Navigation property for the roles this user belongs to.
+ ///
+ public virtual ICollection Roles { get; } = new Collection();
+
+ ///
+ /// Navigation property for the claims this user possesses.
+ ///
+ public virtual ICollection Claims { get; } = new Collection();
+
+ ///
+ /// Navigation property for this users login accounts.
+ ///
+ public virtual ICollection Logins { get; } = new Collection();
+
+ protected IdentityUser()
+ {
+
+ }
+
+ public IdentityUser([NotNull] string userName)
+ {
+ Check.NotNull(userName, nameof(userName));
+
+ UserName = userName;
+ }
+
+ ///
+ /// Returns the username for this user.
+ ///
+ public override string ToString()
+ {
+ return $"{base.ToString()} UserName = {UserName}";
+ }
+ }
+}
diff --git a/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserClaim.cs b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserClaim.cs
new file mode 100644
index 0000000000..b7ff073cf5
--- /dev/null
+++ b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserClaim.cs
@@ -0,0 +1,61 @@
+using System.Security.Claims;
+using JetBrains.Annotations;
+using Volo.Abp.Domain.Entities;
+
+namespace Volo.Abp.Identity
+{
+ ///
+ /// Represents a claim that a user possesses.
+ ///
+ public class IdentityUserClaim : Entity
+ {
+ ///
+ /// Gets or sets the primary key of the user associated with this claim.
+ ///
+ public virtual string UserId { get; protected set; }
+
+ ///
+ /// Gets or sets the claim type for this claim.
+ ///
+ public virtual string ClaimType { get; protected set; }
+
+ ///
+ /// Gets or sets the claim value for this claim.
+ ///
+ public virtual string ClaimValue { get; protected set; }
+
+ protected IdentityUserClaim()
+ {
+
+ }
+
+ public IdentityUserClaim([NotNull] string userId, [NotNull] Claim claim)
+ {
+ Check.NotNull(userId, nameof(userId));
+ Check.NotNull(claim, nameof(claim));
+
+ UserId = userId;
+ ClaimType = claim.Type;
+ ClaimValue = claim.Value;
+ }
+
+ public IdentityUserClaim([NotNull] string userId, [NotNull] string claimType, string claimValue)
+ {
+ Check.NotNull(userId, nameof(userId));
+ Check.NotNull(claimType, nameof(claimType));
+
+ UserId = userId;
+ ClaimType = claimType;
+ ClaimValue = claimValue;
+ }
+
+ ///
+ /// Creates a Claim instance from this entity.
+ ///
+ ///
+ public virtual Claim ToClaim()
+ {
+ return new Claim(ClaimType, ClaimValue);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserLogin.cs b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserLogin.cs
new file mode 100644
index 0000000000..836fa99f9d
--- /dev/null
+++ b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserLogin.cs
@@ -0,0 +1,48 @@
+using JetBrains.Annotations;
+using Volo.Abp.Domain.Entities;
+
+namespace Volo.Abp.Identity
+{
+ ///
+ /// Represents a login and its associated provider for a user.
+ ///
+ public class IdentityUserLogin : Entity
+ {
+ ///
+ /// Gets or sets the of the primary key of the user associated with this login.
+ ///
+ public virtual string UserId { get; protected set; }
+
+ ///
+ /// Gets or sets the login provider for the login (e.g. facebook, google)
+ ///
+ public virtual string LoginProvider { get; protected set; }
+
+ ///
+ /// Gets or sets the unique provider identifier for this login.
+ ///
+ public virtual string ProviderKey { get; protected set; }
+
+ ///
+ /// Gets or sets the friendly name used in a UI for this login.
+ ///
+ public virtual string ProviderDisplayName { get; protected set; }
+
+ protected IdentityUserLogin()
+ {
+
+ }
+
+ public IdentityUserLogin([NotNull] string userId, [NotNull] string loginProvider, [NotNull] string providerKey, string providerDisplayName)
+ {
+ Check.NotNull(userId, nameof(userId));
+ Check.NotNull(loginProvider, nameof(loginProvider));
+ Check.NotNull(providerKey, nameof(providerKey));
+
+ UserId = userId;
+ LoginProvider = loginProvider;
+ ProviderKey = providerKey;
+ ProviderDisplayName = providerDisplayName;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserRole.cs b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserRole.cs
new file mode 100644
index 0000000000..8b332e82a4
--- /dev/null
+++ b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserRole.cs
@@ -0,0 +1,35 @@
+using JetBrains.Annotations;
+using Volo.Abp.Domain.Entities;
+
+namespace Volo.Abp.Identity
+{
+ ///
+ /// Represents the link between a user and a role.
+ ///
+ public class IdentityUserRole : Entity
+ {
+ ///
+ /// Gets or sets the primary key of the user that is linked to a role.
+ ///
+ public virtual string UserId { get; protected set; }
+
+ ///
+ /// Gets or sets the primary key of the role that is linked to the user.
+ ///
+ public virtual string RoleId { get; protected set; }
+
+ protected IdentityUserRole()
+ {
+
+ }
+
+ public IdentityUserRole([NotNull] string userId, [NotNull] string roleId)
+ {
+ Check.NotNull(userId, nameof(userId));
+ Check.NotNull(roleId, nameof(roleId));
+
+ UserId = userId;
+ RoleId = roleId;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserToken.cs b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserToken.cs
new file mode 100644
index 0000000000..4da14a23d6
--- /dev/null
+++ b/src/Volo.Abp.Identity/Volo/Abp/Identity/IdentityUserToken.cs
@@ -0,0 +1,48 @@
+using JetBrains.Annotations;
+using Volo.Abp.Domain.Entities;
+
+namespace Volo.Abp.Identity
+{
+ ///
+ /// Represents an authentication token for a user.
+ ///
+ public class IdentityUserToken : Entity
+ {
+ ///
+ /// Gets or sets the primary key of the user that the token belongs to.
+ ///
+ public virtual string UserId { get; protected set; }
+
+ ///
+ /// Gets or sets the LoginProvider this token is from.
+ ///
+ public virtual string LoginProvider { get; protected set; }
+
+ ///
+ /// Gets or sets the name of the token.
+ ///
+ public virtual string Name { get; protected set; }
+
+ ///
+ /// Gets or sets the token value.
+ ///
+ public virtual string Value { get; set; }
+
+ protected IdentityUserToken()
+ {
+
+ }
+
+ public IdentityUserToken([NotNull] string userId, [NotNull] string loginProvider, [NotNull] string name, string value) //TODO: Can value be null?
+ {
+ Check.NotNull(userId, nameof(userId));
+ Check.NotNull(loginProvider, nameof(loginProvider));
+ Check.NotNull(name, nameof(name));
+
+ UserId = userId;
+ LoginProvider = loginProvider;
+ Name = name;
+ Value = value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Volo.Abp.Identity/project.json b/src/Volo.Abp.Identity/project.json
index 0ae87711b5..3e8b95a12e 100644
--- a/src/Volo.Abp.Identity/project.json
+++ b/src/Volo.Abp.Identity/project.json
@@ -3,7 +3,8 @@
"dependencies": {
"NETStandard.Library": "1.6.1",
- "Microsoft.AspNetCore.Identity": "1.1.0"
+ "Microsoft.AspNetCore.Identity": "1.1.0",
+ "Volo.Abp": "1.0.0-*"
},
"frameworks": {
diff --git a/src/Volo.Abp/Volo/Abp/Domain/Entities/Entity.cs b/src/Volo.Abp/Volo/Abp/Domain/Entities/Entity.cs
index c7c8f29458..15c0971e46 100644
--- a/src/Volo.Abp/Volo/Abp/Domain/Entities/Entity.cs
+++ b/src/Volo.Abp/Volo/Abp/Domain/Entities/Entity.cs
@@ -4,14 +4,13 @@ using System.Reflection;
namespace Volo.Abp.Domain.Entities
{
- //TODO: Think on Entity class without PK
- /////
- ///// A shortcut of for most used primary key type ().
- /////
- //public abstract class Entity : Entity, IEntity<>
- //{
-
- //}
+ ///
+ /// A shortcut of for default primary key type ().
+ ///
+ public abstract class Entity : Entity, IEntity
+ {
+
+ }
///
/// Basic implementation of IEntity interface.
diff --git a/src/Volo.Abp/Volo/Abp/Domain/Entities/IEntity.cs b/src/Volo.Abp/Volo/Abp/Domain/Entities/IEntity.cs
index 309c810d2c..fd5f75287e 100644
--- a/src/Volo.Abp/Volo/Abp/Domain/Entities/IEntity.cs
+++ b/src/Volo.Abp/Volo/Abp/Domain/Entities/IEntity.cs
@@ -1,13 +1,12 @@
namespace Volo.Abp.Domain.Entities
{
- //TODO: Think on Entity class without PK
- /////
- ///// A shortcut of for most used primary key type ().
- /////
- //public interface IEntity : IEntity
- //{
+ ///
+ /// A shortcut of for default primary key type ().
+ ///
+ public interface IEntity : IEntity
+ {
- //}
+ }
///
/// Defines interface for base entity type. All entities in the system must implement this interface.