Browse Source

Merge pull request #191 from aspnetzero/Alper/IdentityServer-DbContext

Alper/identity server db context
pull/192/head
Halil İbrahim Kalkan 9 years ago
committed by GitHub
parent
commit
326c57a6b1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaimConsts.cs
  2. 9
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs
  3. 7
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaimConsts.cs
  4. 9
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs
  5. 2
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecret.cs
  6. 9
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecretConsts.cs
  7. 8
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaimConsts.cs
  8. 25
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientConsts.cs
  9. 7
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientCorsOriginConsts.cs
  10. 7
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientGrantTypeConsts.cs
  11. 7
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs
  12. 7
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs
  13. 8
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs
  14. 7
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs
  15. 7
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs
  16. 9
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientSecretConsts.cs
  17. 10
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs
  18. 7
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityClaimConsts.cs
  19. 9
      src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs
  20. 609
      src/Volo.Abp.IdentityServer.EntityFrameworkCore/Migrations/20180108150119_IdentityServer_Initial.Designer.cs
  21. 543
      src/Volo.Abp.IdentityServer.EntityFrameworkCore/Migrations/20180108150119_IdentityServer_Initial.cs
  22. 608
      src/Volo.Abp.IdentityServer.EntityFrameworkCore/Migrations/IdentityServerDbContextModelSnapshot.cs
  23. 213
      src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs

7
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaimConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.IdentityServer.ApiResources
{
public class ApiResourceClaimConsts
{
public const int TypeMaxLength = 200;
}
}

9
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceConsts.cs

@ -0,0 +1,9 @@
namespace Volo.Abp.IdentityServer.ApiResources
{
public class ApiResourceConsts
{
public const int NameMaxLength = 200;
public const int DisplayNameMaxLength = 200;
public const int DescriptionMaxLength = 1000;
}
}

7
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaimConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.IdentityServer.ApiResources
{
public class ApiScopeClaimConsts
{
public const int TypeMaxLength = 200;
}
}

9
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs

@ -0,0 +1,9 @@
namespace Volo.Abp.IdentityServer.ApiResources
{
public class ApiScopeConsts
{
public const int NameMaxLength = 200;
public const int DisplayNameMaxLength = 200;
public const int DescriptionMaxLength = 1000;
}
}

2
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecret.cs

@ -4,7 +4,7 @@ namespace Volo.Abp.IdentityServer.ApiResources
{
public class ApiSecret : Secret
{
public virtual string ApiResourceId { get; set; }
public virtual Guid ApiResourceId { get; set; }
protected ApiSecret()
{

9
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecretConsts.cs

@ -0,0 +1,9 @@
namespace Volo.Abp.IdentityServer.ApiResources
{
public class ApiSecretConsts
{
public const int DescriptionMaxLength = 1000;
public const int ValueMaxLength = 2000;
public const int TypeMaxLength = 250;
}
}

8
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaimConsts.cs

@ -0,0 +1,8 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientClaimConsts
{
public const int TypeMaxLength = 250;
public const int ValueMaxLength = 250;
}
}

25
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientConsts.cs

@ -0,0 +1,25 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientConsts
{
public const int ClientIdMaxLength = 200;
public const int ProtocolTypeMaxLength = 200;
public const int ClientNameMaxLength = 200;
public const int ClientUriMaxLength = 2000;
public const int LogoUriMaxLength = 2000;
public const int DescriptionMaxLength = 1000;
public const int FrontChannelLogoutUriMaxLength = 2000;
public const int BackChannelLogoutUriMaxLength = 2000;
public const int ClientClaimsPrefixMaxLength = 200;
public const int PairWiseSubjectSaltMaxLength = 200;
}
}

7
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientCorsOriginConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientCorsOriginConsts
{
public const int OriginMaxLength = 150;
}
}

7
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientGrantTypeConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientGrantTypeConsts
{
public const int GrantTypeMaxLength = 250;
}
}

7
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientIdPRestrictionConsts
{
public const int ProviderMaxLength = 200;
}
}

7
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientPostLogoutRedirectUriConsts
{
public const int PostLogoutRedirectUriMaxLength = 2000;
}
}

8
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs

@ -0,0 +1,8 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientPropertyConsts
{
public const int KeyMaxLength = 250;
public const int ValueMaxLength = 2000;
}
}

7
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientRedirectUriConsts
{
public const int RedirectUriMaxLength = 2000;
}
}

7
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientScopeConsts
{
public const int ScopeMaxLength = 200;
}
}

9
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientSecretConsts.cs

@ -0,0 +1,9 @@
namespace Volo.Abp.IdentityServer.Clients
{
public class ClientSecretConsts
{
public const int ValueMaxLength = 2000;
public const int TypeMaxLength = 250;
public const int DescriptionMaxLength = 2000;
}
}

10
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs

@ -0,0 +1,10 @@
namespace Volo.Abp.IdentityServer.Grants
{
public class PersistedGrantConsts
{
public const int KeyMaxLength = 200;
public const int TypeMaxLength = 50;
public const int SubjectIdMaxLength = 200;
public const int ClientIdMaxLength = 200;
}
}

7
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityClaimConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.IdentityServer.IdentityResources
{
public class IdentityClaimConsts
{
public const int TypeMaxLength = 200;
}
}

9
src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs

@ -0,0 +1,9 @@
namespace Volo.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceConsts
{
public const int NameMaxLength = 200;
public const int DisplayNameMaxLength = 200;
public const int DescriptionMaxLength = 1000;
}
}

609
src/Volo.Abp.IdentityServer.EntityFrameworkCore/Migrations/20180108150119_IdentityServer_Initial.Designer.cs

@ -0,0 +1,609 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
namespace Volo.Abp.IdentityServer.EntityFrameworkCore.Migrations
{
[DbContext(typeof(IdentityServerDbContext))]
[Migration("20180108150119_IdentityServer_Initial")]
partial class IdentityServer_Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Enabled");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpIdsApiResources");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("AbpIdsApiClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ApiResourceId");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpIdsApiScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ApiScopeId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiScopeId");
b.ToTable("AbpIdsApiScopeClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ApiResourceId");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration");
b.Property<string>("Type")
.HasMaxLength(250);
b.Property<string>("Value")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("AbpIdsApiSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AbsoluteRefreshTokenLifetime");
b.Property<int>("AccessTokenLifetime");
b.Property<int>("AccessTokenType");
b.Property<bool>("AllowAccessTokensViaBrowser");
b.Property<bool>("AllowOfflineAccess");
b.Property<bool>("AllowPlainTextPkce");
b.Property<bool>("AllowRememberConsent");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken");
b.Property<bool>("AlwaysSendClientClaims");
b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(2000);
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri")
.HasMaxLength(2000);
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<string>("LogoUri")
.HasMaxLength(2000);
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration");
b.Property<int>("RefreshTokenUsage");
b.Property<bool>("RequireClientSecret");
b.Property<bool>("RequireConsent");
b.Property<bool>("RequirePkce");
b.Property<int>("SlidingRefreshTokenLifetime");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("AbpIdsClients");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Origin")
.IsRequired()
.HasMaxLength(150);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientCorsOrigins");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("GrantType")
.IsRequired()
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientGrantTypes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Provider")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientIdPRestrictions");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientPostLogoutRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientProperties");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("RedirectUri")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Scope")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Description")
.HasMaxLength(2000);
b.Property<DateTime?>("Expiration");
b.Property<string>("Type")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
.IsRequired();
b.Property<DateTime?>("Expiration");
b.Property<Guid>("Id");
b.Property<string>("SubjectId")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50);
b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type");
b.ToTable("AbpIdsPersistedGrants");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("IdentityResourceId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("AbpIdsIdentityClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<bool>("Enabled");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpIdsIdentityResources");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiScopeId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

543
src/Volo.Abp.IdentityServer.EntityFrameworkCore/Migrations/20180108150119_IdentityServer_Initial.cs

@ -0,0 +1,543 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace Volo.Abp.IdentityServer.EntityFrameworkCore.Migrations
{
public partial class IdentityServer_Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpIdsApiResources",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Enabled = table.Column<bool>(type: "bit", nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsApiResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpIdsClients",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AbsoluteRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false),
AccessTokenLifetime = table.Column<int>(type: "int", nullable: false),
AccessTokenType = table.Column<int>(type: "int", nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(type: "bit", nullable: false),
AllowOfflineAccess = table.Column<bool>(type: "bit", nullable: false),
AllowPlainTextPkce = table.Column<bool>(type: "bit", nullable: false),
AllowRememberConsent = table.Column<bool>(type: "bit", nullable: false),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(type: "bit", nullable: false),
AlwaysSendClientClaims = table.Column<bool>(type: "bit", nullable: false),
AuthorizationCodeLifetime = table.Column<int>(type: "int", nullable: false),
BackChannelLogoutSessionRequired = table.Column<bool>(type: "bit", nullable: false),
BackChannelLogoutUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
ClientClaimsPrefix = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
ClientName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ClientUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
ConsentLifetime = table.Column<int>(type: "int", nullable: true),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
EnableLocalLogin = table.Column<bool>(type: "bit", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false),
FrontChannelLogoutSessionRequired = table.Column<bool>(type: "bit", nullable: false),
FrontChannelLogoutUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
IdentityTokenLifetime = table.Column<int>(type: "int", nullable: false),
IncludeJwtId = table.Column<bool>(type: "bit", nullable: false),
LogoUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
PairWiseSubjectSalt = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ProtocolType = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
RefreshTokenExpiration = table.Column<int>(type: "int", nullable: false),
RefreshTokenUsage = table.Column<int>(type: "int", nullable: false),
RequireClientSecret = table.Column<bool>(type: "bit", nullable: false),
RequireConsent = table.Column<bool>(type: "bit", nullable: false),
RequirePkce = table.Column<bool>(type: "bit", nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClients", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpIdsIdentityResources",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(type: "bit", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Required = table.Column<bool>(type: "bit", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsIdentityResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpIdsPersistedGrants",
columns: table => new
{
Key = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Data = table.Column<string>(type: "nvarchar(max)", nullable: false),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SubjectId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsPersistedGrants", x => x.Key);
});
migrationBuilder.CreateTable(
name: "AbpIdsApiClaims",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ApiResourceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsApiClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsApiClaims_AbpIdsApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "AbpIdsApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsApiScopes",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ApiResourceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Emphasize = table.Column<bool>(type: "bit", nullable: false),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Required = table.Column<bool>(type: "bit", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsApiScopes", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsApiScopes_AbpIdsApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "AbpIdsApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsApiSecrets",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ApiResourceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsApiSecrets", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsApiSecrets_AbpIdsApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "AbpIdsApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsClientClaims",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClientClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsClientClaims_AbpIdsClients_ClientId",
column: x => x.ClientId,
principalTable: "AbpIdsClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsClientCorsOrigins",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Origin = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClientCorsOrigins", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsClientCorsOrigins_AbpIdsClients_ClientId",
column: x => x.ClientId,
principalTable: "AbpIdsClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsClientGrantTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
GrantType = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClientGrantTypes", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsClientGrantTypes_AbpIdsClients_ClientId",
column: x => x.ClientId,
principalTable: "AbpIdsClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsClientIdPRestrictions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Provider = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClientIdPRestrictions", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsClientIdPRestrictions_AbpIdsClients_ClientId",
column: x => x.ClientId,
principalTable: "AbpIdsClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsClientPostLogoutRedirectUris",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PostLogoutRedirectUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClientPostLogoutRedirectUris", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsClientPostLogoutRedirectUris_AbpIdsClients_ClientId",
column: x => x.ClientId,
principalTable: "AbpIdsClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsClientProperties",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Key = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClientProperties", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsClientProperties_AbpIdsClients_ClientId",
column: x => x.ClientId,
principalTable: "AbpIdsClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsClientRedirectUris",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RedirectUri = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClientRedirectUris", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsClientRedirectUris_AbpIdsClients_ClientId",
column: x => x.ClientId,
principalTable: "AbpIdsClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsClientScopes",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Scope = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClientScopes", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsClientScopes_AbpIdsClients_ClientId",
column: x => x.ClientId,
principalTable: "AbpIdsClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsClientSecrets",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ClientId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Description = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
Type = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsClientSecrets", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsClientSecrets_AbpIdsClients_ClientId",
column: x => x.ClientId,
principalTable: "AbpIdsClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsIdentityClaims",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IdentityResourceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsIdentityClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsIdentityClaims_AbpIdsIdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId,
principalTable: "AbpIdsIdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpIdsApiScopeClaims",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ApiScopeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpIdsApiScopeClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpIdsApiScopeClaims_AbpIdsApiScopes_ApiScopeId",
column: x => x.ApiScopeId,
principalTable: "AbpIdsApiScopes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpIdsApiClaims_ApiResourceId",
table: "AbpIdsApiClaims",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsApiResources_Name",
table: "AbpIdsApiResources",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AbpIdsApiScopeClaims_ApiScopeId",
table: "AbpIdsApiScopeClaims",
column: "ApiScopeId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsApiScopes_ApiResourceId",
table: "AbpIdsApiScopes",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsApiScopes_Name",
table: "AbpIdsApiScopes",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AbpIdsApiSecrets_ApiResourceId",
table: "AbpIdsApiSecrets",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClientClaims_ClientId",
table: "AbpIdsClientClaims",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClientCorsOrigins_ClientId",
table: "AbpIdsClientCorsOrigins",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClientGrantTypes_ClientId",
table: "AbpIdsClientGrantTypes",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClientIdPRestrictions_ClientId",
table: "AbpIdsClientIdPRestrictions",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClientPostLogoutRedirectUris_ClientId",
table: "AbpIdsClientPostLogoutRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClientProperties_ClientId",
table: "AbpIdsClientProperties",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClientRedirectUris_ClientId",
table: "AbpIdsClientRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClients_ClientId",
table: "AbpIdsClients",
column: "ClientId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClientScopes_ClientId",
table: "AbpIdsClientScopes",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsClientSecrets_ClientId",
table: "AbpIdsClientSecrets",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsIdentityClaims_IdentityResourceId",
table: "AbpIdsIdentityClaims",
column: "IdentityResourceId");
migrationBuilder.CreateIndex(
name: "IX_AbpIdsIdentityResources_Name",
table: "AbpIdsIdentityResources",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AbpIdsPersistedGrants_SubjectId_ClientId_Type",
table: "AbpIdsPersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpIdsApiClaims");
migrationBuilder.DropTable(
name: "AbpIdsApiScopeClaims");
migrationBuilder.DropTable(
name: "AbpIdsApiSecrets");
migrationBuilder.DropTable(
name: "AbpIdsClientClaims");
migrationBuilder.DropTable(
name: "AbpIdsClientCorsOrigins");
migrationBuilder.DropTable(
name: "AbpIdsClientGrantTypes");
migrationBuilder.DropTable(
name: "AbpIdsClientIdPRestrictions");
migrationBuilder.DropTable(
name: "AbpIdsClientPostLogoutRedirectUris");
migrationBuilder.DropTable(
name: "AbpIdsClientProperties");
migrationBuilder.DropTable(
name: "AbpIdsClientRedirectUris");
migrationBuilder.DropTable(
name: "AbpIdsClientScopes");
migrationBuilder.DropTable(
name: "AbpIdsClientSecrets");
migrationBuilder.DropTable(
name: "AbpIdsIdentityClaims");
migrationBuilder.DropTable(
name: "AbpIdsPersistedGrants");
migrationBuilder.DropTable(
name: "AbpIdsApiScopes");
migrationBuilder.DropTable(
name: "AbpIdsClients");
migrationBuilder.DropTable(
name: "AbpIdsIdentityResources");
migrationBuilder.DropTable(
name: "AbpIdsApiResources");
}
}
}

608
src/Volo.Abp.IdentityServer.EntityFrameworkCore/Migrations/IdentityServerDbContextModelSnapshot.cs

@ -0,0 +1,608 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
namespace Volo.Abp.IdentityServer.EntityFrameworkCore.Migrations
{
[DbContext(typeof(IdentityServerDbContext))]
partial class IdentityServerDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Enabled");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpIdsApiResources");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ApiResourceId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("AbpIdsApiClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ApiResourceId");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpIdsApiScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ApiScopeId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiScopeId");
b.ToTable("AbpIdsApiScopeClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ApiResourceId");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration");
b.Property<string>("Type")
.HasMaxLength(250);
b.Property<string>("Value")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("AbpIdsApiSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AbsoluteRefreshTokenLifetime");
b.Property<int>("AccessTokenLifetime");
b.Property<int>("AccessTokenType");
b.Property<bool>("AllowAccessTokensViaBrowser");
b.Property<bool>("AllowOfflineAccess");
b.Property<bool>("AllowPlainTextPkce");
b.Property<bool>("AllowRememberConsent");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken");
b.Property<bool>("AlwaysSendClientClaims");
b.Property<int>("AuthorizationCodeLifetime");
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(2000);
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime");
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<bool>("EnableLocalLogin");
b.Property<bool>("Enabled");
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri")
.HasMaxLength(2000);
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<string>("LogoUri")
.HasMaxLength(2000);
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration");
b.Property<int>("RefreshTokenUsage");
b.Property<bool>("RequireClientSecret");
b.Property<bool>("RequireConsent");
b.Property<bool>("RequirePkce");
b.Property<int>("SlidingRefreshTokenLifetime");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("AbpIdsClients");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Origin")
.IsRequired()
.HasMaxLength(150);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientCorsOrigins");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("GrantType")
.IsRequired()
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientGrantTypes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Provider")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientIdPRestrictions");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientPostLogoutRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientProperties");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("RedirectUri")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientRedirectUris");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Scope")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientScopes");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("ClientId");
b.Property<string>("Description")
.HasMaxLength(2000);
b.Property<DateTime?>("Expiration");
b.Property<string>("Type")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("AbpIdsClientSecrets");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200);
b.Property<DateTime>("CreationTime");
b.Property<string>("Data")
.IsRequired();
b.Property<DateTime?>("Expiration");
b.Property<Guid>("Id");
b.Property<string>("SubjectId")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50);
b.HasKey("Key");
b.HasIndex("SubjectId", "ClientId", "Type");
b.ToTable("AbpIdsPersistedGrants");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("IdentityResourceId");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("AbpIdsIdentityClaims");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasMaxLength(200);
b.Property<bool>("Emphasize");
b.Property<bool>("Enabled");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<bool>("Required");
b.Property<bool>("ShowInDiscoveryDocument");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpIdsIdentityResources");
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiScopeId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b =>
{
b.HasOne("Volo.Abp.IdentityServer.Clients.Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b =>
{
b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

213
src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs

@ -9,6 +9,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
{
public class IdentityServerDbContext : AbpDbContext<IdentityServerDbContext>
{
public const string TablePrefix = "AbpIds";
public DbSet<Client> Clients { get; set; }
public DbSet<PersistedGrant> PersistedGrants { get; set; }
@ -17,12 +19,219 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
public DbSet<IdentityResource> IdentityResources { get; set; }
//TODO: Add child entity types too...
public DbSet<ClientGrantType> ClientGrantTypes { get; set; }
public DbSet<ClientRedirectUri> ClientRedirectUris { get; set; }
public DbSet<ClientPostLogoutRedirectUri> ClientPostLogoutRedirectUris { get; set; }
public DbSet<ClientScope> ClientScopes { get; set; }
public DbSet<ClientSecret> ClientSecrets { get; set; }
public DbSet<ClientClaim> ClientClaims { get; set; }
public DbSet<ClientIdPRestriction> ClientIdPRestrictions { get; set; }
public IdentityServerDbContext(DbContextOptions<IdentityServerDbContext> options)
public DbSet<ClientCorsOrigin> ClientCorsOrigins { get; set; }
public DbSet<ClientProperty> ClientProperties { get; set; }
public DbSet<IdentityClaim> IdentityClaims { get; set; }
public DbSet<ApiSecret> ApiSecrets { get; set; }
public DbSet<ApiResourceClaim> ApiResourceClaims { get; set; }
public DbSet<ApiScope> ApiScopes { get; set; }
public DbSet<ApiScopeClaim> ApiScopeClaims { get; set; }
public IdentityServerDbContext(DbContextOptions<IdentityServerDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<Client>(client =>
{
client.ToTable(TablePrefix + "Clients");
client.Property(x => x.ClientId).HasMaxLength(ClientConsts.ClientIdMaxLength).IsRequired();
client.Property(x => x.ProtocolType).HasMaxLength(ClientConsts.ProtocolTypeMaxLength).IsRequired();
client.Property(x => x.ClientName).HasMaxLength(ClientConsts.ClientNameMaxLength);
client.Property(x => x.ClientUri).HasMaxLength(ClientConsts.ClientUriMaxLength);
client.Property(x => x.LogoUri).HasMaxLength(ClientConsts.LogoUriMaxLength);
client.Property(x => x.Description).HasMaxLength(ClientConsts.DescriptionMaxLength);
client.Property(x => x.FrontChannelLogoutUri).HasMaxLength(ClientConsts.FrontChannelLogoutUriMaxLength);
client.Property(x => x.BackChannelLogoutUri).HasMaxLength(ClientConsts.BackChannelLogoutUriMaxLength);
client.Property(x => x.ClientClaimsPrefix).HasMaxLength(ClientConsts.ClientClaimsPrefixMaxLength);
client.Property(x => x.PairWiseSubjectSalt).HasMaxLength(ClientConsts.PairWiseSubjectSaltMaxLength);
client.HasMany(x => x.AllowedGrantTypes).WithOne().HasForeignKey(x => x.ClientId).IsRequired();
client.HasMany(x => x.RedirectUris).WithOne().HasForeignKey(x => x.ClientId).IsRequired();
client.HasMany(x => x.PostLogoutRedirectUris).WithOne().HasForeignKey(x => x.ClientId).IsRequired();
client.HasMany(x => x.AllowedScopes).WithOne().HasForeignKey(x => x.ClientId).IsRequired();
client.HasMany(x => x.ClientSecrets).WithOne().HasForeignKey(x => x.ClientId).IsRequired();
client.HasMany(x => x.Claims).WithOne().HasForeignKey(x => x.ClientId).IsRequired();
client.HasMany(x => x.IdentityProviderRestrictions).WithOne().HasForeignKey(x => x.ClientId).IsRequired();
client.HasMany(x => x.AllowedCorsOrigins).WithOne().HasForeignKey(x => x.ClientId).IsRequired();
client.HasMany(x => x.Properties).WithOne().HasForeignKey(x => x.ClientId).IsRequired();
client.HasIndex(x => x.ClientId).IsUnique();
});
builder.Entity<ClientGrantType>(grantType =>
{
grantType.ToTable(TablePrefix + "ClientGrantTypes");
grantType.Property(x => x.GrantType).HasMaxLength(ClientGrantTypeConsts.GrantTypeMaxLength).IsRequired();
grantType.Property(x => x.ClientId).IsRequired();
});
builder.Entity<ClientRedirectUri>(redirectUri =>
{
redirectUri.ToTable(TablePrefix + "ClientRedirectUris");
redirectUri.Property(x => x.RedirectUri).HasMaxLength(ClientRedirectUriConsts.RedirectUriMaxLength).IsRequired();
});
builder.Entity<ClientPostLogoutRedirectUri>(postLogoutRedirectUri =>
{
postLogoutRedirectUri.ToTable(TablePrefix + "ClientPostLogoutRedirectUris");
postLogoutRedirectUri.Property(x => x.PostLogoutRedirectUri).HasMaxLength(ClientPostLogoutRedirectUriConsts.PostLogoutRedirectUriMaxLength).IsRequired();
});
builder.Entity<ClientScope>(scope =>
{
scope.ToTable(TablePrefix + "ClientScopes");
scope.Property(x => x.Scope).HasMaxLength(ClientScopeConsts.ScopeMaxLength).IsRequired();
});
builder.Entity<ClientSecret>(secret =>
{
secret.ToTable(TablePrefix + "ClientSecrets");
secret.Property(x => x.Value).HasMaxLength(ClientSecretConsts.ValueMaxLength).IsRequired();
secret.Property(x => x.Type).HasMaxLength(ClientSecretConsts.TypeMaxLength);
secret.Property(x => x.Description).HasMaxLength(ClientSecretConsts.DescriptionMaxLength);
});
builder.Entity<ClientClaim>(claim =>
{
claim.ToTable(TablePrefix + "ClientClaims");
claim.Property(x => x.Type).HasMaxLength(ClientClaimConsts.TypeMaxLength).IsRequired();
claim.Property(x => x.Value).HasMaxLength(ClientClaimConsts.ValueMaxLength).IsRequired();
});
builder.Entity<ClientIdPRestriction>(idPRestriction =>
{
idPRestriction.ToTable(TablePrefix + "ClientIdPRestrictions");
idPRestriction.Property(x => x.Provider).HasMaxLength(ClientIdPRestrictionConsts.ProviderMaxLength).IsRequired();
});
builder.Entity<ClientCorsOrigin>(corsOrigin =>
{
corsOrigin.ToTable(TablePrefix + "ClientCorsOrigins");
corsOrigin.Property(x => x.Origin).HasMaxLength(ClientCorsOriginConsts.OriginMaxLength).IsRequired();
});
builder.Entity<ClientProperty>(property =>
{
property.ToTable(TablePrefix + "ClientProperties");
property.Property(x => x.Key).HasMaxLength(ClientPropertyConsts.KeyMaxLength).IsRequired();
property.Property(x => x.Value).HasMaxLength(ClientPropertyConsts.ValueMaxLength).IsRequired();
});
builder.Entity<PersistedGrant>(grant =>
{
grant.ToTable(TablePrefix + "PersistedGrants");
grant.Property(x => x.Key).HasMaxLength(PersistedGrantConsts.KeyMaxLength).ValueGeneratedNever();
grant.Property(x => x.Type).HasMaxLength(PersistedGrantConsts.TypeMaxLength).IsRequired();
grant.Property(x => x.SubjectId).HasMaxLength(PersistedGrantConsts.SubjectIdMaxLength);
grant.Property(x => x.ClientId).HasMaxLength(PersistedGrantConsts.ClientIdMaxLength).IsRequired();
grant.Property(x => x.CreationTime).IsRequired();
grant.Property(x => x.Data).IsRequired();
grant.HasKey(x => x.Key);
grant.HasIndex(x => new { x.SubjectId, x.ClientId, x.Type });
});
builder.Entity<IdentityResource>(identityResource =>
{
identityResource.ToTable(TablePrefix + "IdentityResources");
identityResource.Property(x => x.Name).HasMaxLength(IdentityResourceConsts.NameMaxLength).IsRequired();
identityResource.Property(x => x.DisplayName).HasMaxLength(IdentityResourceConsts.DisplayNameMaxLength);
identityResource.Property(x => x.Description).HasMaxLength(IdentityResourceConsts.DescriptionMaxLength);
identityResource.HasIndex(x => x.Name).IsUnique();
identityResource.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.IdentityResourceId).IsRequired();
});
builder.Entity<IdentityClaim>(claim =>
{
claim.ToTable(TablePrefix + "IdentityClaims");
claim.Property(x => x.Type).HasMaxLength(IdentityClaimConsts.TypeMaxLength).IsRequired();
});
builder.Entity<ApiResource>(apiResource =>
{
apiResource.ToTable(TablePrefix + "ApiResources");
apiResource.Property(x => x.Name).HasMaxLength(ApiResourceConsts.NameMaxLength).IsRequired();
apiResource.Property(x => x.DisplayName).HasMaxLength(ApiResourceConsts.DisplayNameMaxLength);
apiResource.Property(x => x.Description).HasMaxLength(ApiResourceConsts.DescriptionMaxLength);
apiResource.HasIndex(x => x.Name).IsUnique();
apiResource.HasMany(x => x.Secrets).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired();
apiResource.HasMany(x => x.Scopes).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired();
apiResource.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired();
});
builder.Entity<ApiSecret>(apiSecret =>
{
apiSecret.ToTable(TablePrefix + "ApiSecrets");
apiSecret.Property(x => x.Description).HasMaxLength(ApiSecretConsts.DescriptionMaxLength);
apiSecret.Property(x => x.Value).HasMaxLength(ApiSecretConsts.ValueMaxLength);
apiSecret.Property(x => x.Type).HasMaxLength(ApiSecretConsts.TypeMaxLength);
});
builder.Entity<ApiResourceClaim>(apiClaim =>
{
apiClaim.ToTable(TablePrefix + "ApiClaims");
apiClaim.Property(x => x.Type).HasMaxLength(ApiResourceClaimConsts.TypeMaxLength).IsRequired();
});
builder.Entity<ApiScope>(apiScope =>
{
apiScope.ToTable(TablePrefix + "ApiScopes");
apiScope.Property(x => x.Name).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired();
apiScope.Property(x => x.DisplayName).HasMaxLength(ApiScopeConsts.DisplayNameMaxLength);
apiScope.Property(x => x.Description).HasMaxLength(ApiScopeConsts.DescriptionMaxLength);
apiScope.HasIndex(x => x.Name).IsUnique();
apiScope.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.ApiScopeId).IsRequired();
});
builder.Entity<ApiScopeClaim>(apiScopeClaim =>
{
apiScopeClaim.ToTable(TablePrefix + "ApiScopeClaims");
apiScopeClaim.Property(x => x.Type).HasMaxLength(ApiScopeClaimConsts.TypeMaxLength).IsRequired();
});
}
}
}

Loading…
Cancel
Save