Browse Source

Create Volo.Abp.Identity.Domain.Shared package.

pull/113/head
Halil İbrahim Kalkan 9 years ago
parent
commit
06e9681642
  1. 7
      Volo.Abp.sln
  2. 1
      src/Volo.Abp.Identity.Application.Contracts/Volo.Abp.Identity.Application.Contracts.csproj
  3. 6
      src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs
  4. 4
      src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateDto.cs
  5. 7
      src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs
  6. 18
      src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj
  7. 9
      src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/AbpIdentityDomainSharedModule.cs
  8. 9
      src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleClaimConsts.cs
  9. 8
      src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs
  10. 9
      src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserClaimConsts.cs
  11. 23
      src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs
  12. 9
      src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserLoginConsts.cs
  13. 7
      src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserTokenConsts.cs
  14. 1
      src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj
  15. 1
      src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs
  16. 3
      src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs
  17. 3
      src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleClaim.cs
  18. 7
      src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs
  19. 3
      src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserClaim.cs
  20. 4
      src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserLogin.cs
  21. 2
      src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserToken.cs
  22. 32
      src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs

7
Volo.Abp.sln

@ -136,6 +136,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Identity.Applicati
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Identity.Domain", "src\Volo.Abp.Identity.Domain\Volo.Abp.Identity.Domain.csproj", "{43D4005C-4F04-4128-937B-52BEAC5A113B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Identity.Domain.Shared", "src\Volo.Abp.Identity.Domain.Shared\Volo.Abp.Identity.Domain.Shared.csproj", "{DF676F73-3FC9-46CE-909A-2D75E19982AD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -342,6 +344,10 @@ Global
{43D4005C-4F04-4128-937B-52BEAC5A113B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43D4005C-4F04-4128-937B-52BEAC5A113B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43D4005C-4F04-4128-937B-52BEAC5A113B}.Release|Any CPU.Build.0 = Release|Any CPU
{DF676F73-3FC9-46CE-909A-2D75E19982AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF676F73-3FC9-46CE-909A-2D75E19982AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF676F73-3FC9-46CE-909A-2D75E19982AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF676F73-3FC9-46CE-909A-2D75E19982AD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -406,6 +412,7 @@ Global
{703BD43C-02B9-413F-854C-9CBA0C963196} = {37087D1B-3693-4E96-983D-A69F210BDE53}
{40E21A35-1C66-4E89-A16E-0475011F7EFD} = {146F561E-C7B8-4166-9383-47E1BC1A2E62}
{43D4005C-4F04-4128-937B-52BEAC5A113B} = {1895A5C9-50D4-4568-9A3A-14657E615A5E}
{DF676F73-3FC9-46CE-909A-2D75E19982AD} = {1895A5C9-50D4-4568-9A3A-14657E615A5E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}

1
src/Volo.Abp.Identity.Application.Contracts/Volo.Abp.Identity.Application.Contracts.csproj

@ -12,6 +12,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Identity.Domain.Shared\Volo.Abp.Identity.Domain.Shared.csproj" />
<ProjectReference Include="..\Volo.Abp\Volo.Abp.csproj" />
</ItemGroup>

6
src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs

@ -1,7 +1,11 @@
namespace Volo.Abp.Identity
using System.ComponentModel.DataAnnotations;
namespace Volo.Abp.Identity
{
public class IdentityRoleCreateOrUpdateDtoBase
{
[Required]
[MaxLength(IdentityRoleConsts.MaxNameLength)]
public string Name { get; set; }
}
}

4
src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateDto.cs

@ -2,10 +2,10 @@
namespace Volo.Abp.Identity
{
public class IdentityUserCreateDto: IdentityUserCreateOrUpdateDtoBase
public class IdentityUserCreateDto : IdentityUserCreateOrUpdateDtoBase
{
[Required]
[MaxLength(16)] //TODO: Create a shared dll of Identity and move consts to there for sharing!
[MaxLength(IdentityUserConsts.MaxPasswordLength)]
public string Password { get; set; }
}
}

7
src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs

@ -1,13 +1,18 @@
using JetBrains.Annotations;
using System.ComponentModel.DataAnnotations;
using JetBrains.Annotations;
namespace Volo.Abp.Identity
{
public abstract class IdentityUserCreateOrUpdateDtoBase
{
[Required]
[MaxLength(IdentityUserConsts.MaxUserNameLength)]
public string UserName { get; set; }
[MaxLength(IdentityUserConsts.MaxEmailLength)]
public string Email { get; set; }
[MaxLength(IdentityUserConsts.MaxPhoneNumberLength)]
public string PhoneNumber { get; set; }
public bool TwoFactorEnabled { get; set; } //TODO: Optional?

18
src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.Abp.Identity.Domain.Shared</AssemblyName>
<PackageId>Volo.Abp.Identity.Domain.Shared</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp\Volo.Abp.csproj" />
</ItemGroup>
</Project>

9
src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/AbpIdentityDomainSharedModule.cs

@ -0,0 +1,9 @@
using Volo.Abp.Modularity;
namespace Volo.Abp.Identity
{
public class AbpIdentityDomainSharedModule : AbpModule
{
}
}

9
src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleClaimConsts.cs

@ -0,0 +1,9 @@
namespace Volo.Abp.Identity
{
public static class IdentityRoleClaimConsts
{
public const int MaxClaimTypeLength = IdentityUserClaimConsts.MaxClaimTypeLength;
public const int MaxClaimValueLength = IdentityUserClaimConsts.MaxClaimValueLength;
}
}

8
src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs

@ -0,0 +1,8 @@
namespace Volo.Abp.Identity
{
public static class IdentityRoleConsts
{
public const int MaxNameLength = 256;
public const int MaxNormalizedNameLength = MaxNameLength;
}
}

9
src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserClaimConsts.cs

@ -0,0 +1,9 @@
namespace Volo.Abp.Identity
{
public static class IdentityUserClaimConsts
{
public const int MaxClaimTypeLength = 256;
public const int MaxClaimValueLength = 1024;
}
}

23
src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs

@ -0,0 +1,23 @@
namespace Volo.Abp.Identity
{
public static class IdentityUserConsts
{
public const int MaxUserNameLength = 256;
public const int MaxNormalizedUserNameLength = MaxUserNameLength;
public const int MaxEmailLength = 256;
public const int MaxNormalizedEmailLength = MaxEmailLength;
public const int MaxPasswordLength = 32;
public const int MaxPasswordHashLength = 256;
public const int MaxSecurityStampLength = 256;
public const int MaxConcurrencyStampLength = 256;
public const int MaxPhoneNumberLength = 16;
}
}

9
src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserLoginConsts.cs

@ -0,0 +1,9 @@
namespace Volo.Abp.Identity
{
public static class IdentityUserLoginConsts
{
public const int MaxLoginProviderLength = 64;
public const int MaxProviderKeyLength = 256;
public const int MaxProviderDisplayNameLength = 128;
}
}

7
src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserTokenConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.Identity
{
public static class IdentityUserTokenConsts
{
public const int MaxLoginProviderLength = 64;
}
}

1
src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj

@ -12,6 +12,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Identity.Domain.Shared\Volo.Abp.Identity.Domain.Shared.csproj" />
<ProjectReference Include="..\Volo.Abp\Volo.Abp.csproj" />
</ItemGroup>

1
src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs

@ -3,6 +3,7 @@ using Volo.Abp.Modularity;
namespace Volo.Abp.Identity
{
[DependsOn(typeof(AbpIdentityDomainSharedModule))]
public class AbpIdentityDomainModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)

3
src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs

@ -13,9 +13,6 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityRole : AggregateRoot, IHasConcurrencyStamp
{
public const int MaxNameLength = 256;
public const int MaxNormalizedNameLength = MaxNameLength;
/// <summary>
/// Gets or sets the name for this role.
/// </summary>

3
src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleClaim.cs

@ -10,9 +10,6 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityRoleClaim : Entity
{
public const int MaxClaimTypeLength = IdentityUserClaim.MaxClaimTypeLength;
public const int MaxClaimValueLength = IdentityUserClaim.MaxClaimValueLength;
/// <summary>
/// Gets or sets the of the primary key of the role associated with this claim.
/// </summary>

7
src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs

@ -14,11 +14,6 @@ namespace Volo.Abp.Identity
public class IdentityUser : AggregateRoot, IHasConcurrencyStamp
{
public const int MaxUserNameLength = 256;
public const int MaxNormalizedUserNameLength = MaxUserNameLength;
public const int MaxEmailLength = 256;
public const int MaxNormalizedEmailLength = MaxEmailLength;
/// <summary>
/// Gets or sets the user name for this user.
/// </summary>
@ -96,7 +91,7 @@ namespace Volo.Abp.Identity
/// </summary>
public virtual int AccessFailedCount { get; protected internal set; }
//TODO: Can we make collections readonly collection, which will provide encapsulation but can work for all ORMs?
//TODO: Can we make collections readonly collection, which will provide encapsulation. But... can work for all ORMs?
/// <summary>
/// Navigation property for the roles this user belongs to.

3
src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserClaim.cs

@ -10,9 +10,6 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityUserClaim : Entity
{
public const int MaxClaimTypeLength = 256;
public const int MaxClaimValueLength = 1024;
/// <summary>
/// Gets or sets the primary key of the user associated with this claim.
/// </summary>

4
src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserLogin.cs

@ -10,10 +10,6 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityUserLogin : Entity
{
public const int MaxLoginProviderLength = 64;
public const int MaxProviderKeyLength = 256;
public const int MaxProviderDisplayNameLength = 128;
/// <summary>
/// Gets or sets the of the primary key of the user associated with this login.
/// </summary>

2
src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserToken.cs

@ -9,8 +9,6 @@ namespace Volo.Abp.Identity
/// </summary>
public class IdentityUserToken : Entity
{
public const int MaxLoginProviderLength = 64;
/// <summary>
/// Gets or sets the primary key of the user that the token belongs to.
/// </summary>

32
src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs

@ -69,10 +69,14 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
{
b.ToTable("IdentityUsers");
b.Property(u => u.UserName).HasMaxLength(IdentityUser.MaxUserNameLength);
b.Property(u => u.NormalizedUserName).HasMaxLength(IdentityUser.MaxNormalizedUserNameLength);
b.Property(u => u.Email).HasMaxLength(IdentityUser.MaxEmailLength);
b.Property(u => u.NormalizedEmail).HasMaxLength(IdentityUser.MaxNormalizedEmailLength);
b.Property(u => u.UserName).IsRequired().HasMaxLength(IdentityUserConsts.MaxUserNameLength);
b.Property(u => u.NormalizedUserName).IsRequired().HasMaxLength(IdentityUserConsts.MaxNormalizedUserNameLength);
b.Property(u => u.Email).HasMaxLength(IdentityUserConsts.MaxEmailLength);
b.Property(u => u.NormalizedEmail).HasMaxLength(IdentityUserConsts.MaxNormalizedEmailLength);
b.Property(u => u.PhoneNumber).HasMaxLength(IdentityUserConsts.MaxPhoneNumberLength);
b.Property(u => u.PasswordHash).HasMaxLength(IdentityUserConsts.MaxPasswordHashLength);
b.Property(u => u.SecurityStamp).IsRequired().HasMaxLength(IdentityUserConsts.MaxSecurityStampLength);
b.Property(u => u.ConcurrencyStamp).IsRequired().HasMaxLength(IdentityUserConsts.MaxConcurrencyStampLength);
b.Property(u => u.EmailConfirmed).HasDefaultValue(false);
b.Property(u => u.PhoneNumberConfirmed).HasDefaultValue(false);
b.Property(u => u.TwoFactorEnabled).HasDefaultValue(false);
@ -92,8 +96,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
{
b.ToTable("IdentityRoles");
b.Property(u => u.Name).HasMaxLength(IdentityRole.MaxNameLength);
b.Property(u => u.NormalizedName).HasMaxLength(IdentityRole.MaxNormalizedNameLength);
b.Property(u => u.Name).IsRequired().HasMaxLength(IdentityRoleConsts.MaxNameLength);
b.Property(u => u.NormalizedName).IsRequired().HasMaxLength(IdentityRoleConsts.MaxNormalizedNameLength);
b.HasMany(r => r.Claims).WithOne().HasForeignKey(rc => rc.RoleId).IsRequired();
@ -104,8 +108,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
{
b.ToTable("IdentityUserClaims");
b.Property(uc => uc.ClaimType).HasMaxLength(IdentityUserClaim.MaxClaimTypeLength).IsRequired();
b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityUserClaim.MaxClaimValueLength);
b.Property(uc => uc.ClaimType).HasMaxLength(IdentityUserClaimConsts.MaxClaimTypeLength).IsRequired();
b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityUserClaimConsts.MaxClaimValueLength);
b.HasIndex(uc => uc.UserId);
});
@ -114,8 +118,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
{
b.ToTable("IdentityRoleClaims");
b.Property(uc => uc.ClaimType).HasMaxLength(IdentityRoleClaim.MaxClaimTypeLength).IsRequired();
b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityRoleClaim.MaxClaimValueLength);
b.Property(uc => uc.ClaimType).HasMaxLength(IdentityRoleClaimConsts.MaxClaimTypeLength).IsRequired();
b.Property(uc => uc.ClaimValue).HasMaxLength(IdentityRoleClaimConsts.MaxClaimValueLength);
b.HasIndex(uc => uc.RoleId);
});
@ -135,9 +139,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
{
b.ToTable("IdentityUserLogins");
b.Property(ul => ul.LoginProvider).HasMaxLength(IdentityUserLogin.MaxLoginProviderLength).IsRequired();
b.Property(ul => ul.ProviderKey).HasMaxLength(IdentityUserLogin.MaxProviderKeyLength).IsRequired();
b.Property(ul => ul.ProviderDisplayName).HasMaxLength(IdentityUserLogin.MaxProviderDisplayNameLength);
b.Property(ul => ul.LoginProvider).HasMaxLength(IdentityUserLoginConsts.MaxLoginProviderLength).IsRequired();
b.Property(ul => ul.ProviderKey).HasMaxLength(IdentityUserLoginConsts.MaxProviderKeyLength).IsRequired();
b.Property(ul => ul.ProviderDisplayName).HasMaxLength(IdentityUserLoginConsts.MaxProviderDisplayNameLength);
b.HasIndex(l => new { l.UserId, l.LoginProvider, l.ProviderKey });
b.HasIndex(l => new { l.LoginProvider, l.ProviderKey });
@ -147,7 +151,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
{
b.ToTable("IdentityUserTokens");
b.Property(ul => ul.LoginProvider).HasMaxLength(IdentityUserToken.MaxLoginProviderLength).IsRequired();
b.Property(ul => ul.LoginProvider).HasMaxLength(IdentityUserTokenConsts.MaxLoginProviderLength).IsRequired();
b.HasIndex(l => new { l.UserId, l.LoginProvider, l.Name });
});

Loading…
Cancel
Save