diff --git a/common.props b/common.props
index eb3155d6f4..0c8d443f16 100644
--- a/common.props
+++ b/common.props
@@ -1,7 +1,7 @@
latest
- 0.10.0
+ 0.11.0
$(NoWarn);CS1591
https://abp.io/assets/abp_nupkg.png
https://abp.io
diff --git a/docs/en/Tutorials/AspNetCore-Mvc/Part-I.md b/docs/en/Tutorials/AspNetCore-Mvc/Part-I.md
index 2afe26e7d2..6db6766c0b 100644
--- a/docs/en/Tutorials/AspNetCore-Mvc/Part-I.md
+++ b/docs/en/Tutorials/AspNetCore-Mvc/Part-I.md
@@ -85,21 +85,7 @@ EF Core requires you to relate entities with your DbContext. The easiest way to
public class BookStoreDbContext : AbpDbContext
{
public DbSet Book { get; set; }
-
- public BookStoreDbContext(DbContextOptions options)
- : base(options)
- {
-
- }
-
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- base.OnModelCreating(modelBuilder);
-
- modelBuilder.Entity(
- b => b.ConfigureExtraProperties()
- );
- }
+ ...
}
````
diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln
index 92c46299f4..3b18df4e23 100644
--- a/framework/Volo.Abp.sln
+++ b/framework/Volo.Abp.sln
@@ -214,9 +214,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.EntityFrameworkCor
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Localization.Abstractions", "src\Volo.Abp.Localization.Abstractions\Volo.Abp.Localization.Abstractions.csproj", "{20513A4E-FAC7-4106-8976-5D79A3BDFED1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Security.Tests", "test\Volo.Abp.Security.Tests\Volo.Abp.Security.Tests.csproj", "{7CE07034-7E02-4C78-B981-F1039412CA5E}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Security.Tests", "test\Volo.Abp.Security.Tests\Volo.Abp.Security.Tests.csproj", "{7CE07034-7E02-4C78-B981-F1039412CA5E}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Settings.Tests", "test\Volo.Abp.Settings.Tests\Volo.Abp.Settings.Tests.csproj", "{5F3A2D1E-EA89-40A7-8D2F-FB4EB2092403}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Settings.Tests", "test\Volo.Abp.Settings.Tests\Volo.Abp.Settings.Tests.csproj", "{5F3A2D1E-EA89-40A7-8D2F-FB4EB2092403}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Http.Client.IdentityModel", "src\Volo.Abp.Http.Client.IdentityModel\Volo.Abp.Http.Client.IdentityModel.csproj", "{D211A446-38FA-4F97-9A95-1F004A0FFF69}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.IdentityModel", "src\Volo.Abp.IdentityModel\Volo.Abp.IdentityModel.csproj", "{64D99E19-EE25-465A-82E5-17B25F4C4E18}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -616,6 +620,14 @@ Global
{5F3A2D1E-EA89-40A7-8D2F-FB4EB2092403}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F3A2D1E-EA89-40A7-8D2F-FB4EB2092403}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F3A2D1E-EA89-40A7-8D2F-FB4EB2092403}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D211A446-38FA-4F97-9A95-1F004A0FFF69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D211A446-38FA-4F97-9A95-1F004A0FFF69}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D211A446-38FA-4F97-9A95-1F004A0FFF69}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D211A446-38FA-4F97-9A95-1F004A0FFF69}.Release|Any CPU.Build.0 = Release|Any CPU
+ {64D99E19-EE25-465A-82E5-17B25F4C4E18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {64D99E19-EE25-465A-82E5-17B25F4C4E18}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {64D99E19-EE25-465A-82E5-17B25F4C4E18}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {64D99E19-EE25-465A-82E5-17B25F4C4E18}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -721,6 +733,8 @@ Global
{20513A4E-FAC7-4106-8976-5D79A3BDFED1} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{7CE07034-7E02-4C78-B981-F1039412CA5E} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{5F3A2D1E-EA89-40A7-8D2F-FB4EB2092403} = {447C8A77-E5F0-4538-8687-7383196D04EA}
+ {D211A446-38FA-4F97-9A95-1F004A0FFF69} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
+ {64D99E19-EE25-465A-82E5-17B25F4C4E18} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperLocalizer.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperLocalizer.cs
new file mode 100644
index 0000000000..72d32ce10b
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperLocalizer.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
+using Microsoft.Extensions.Localization;
+using Microsoft.Extensions.Options;
+using Volo.Abp.AspNetCore.Mvc.Localization;
+
+namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers
+{
+ public class AbpTagHelperLocalizer : IAbpTagHelperLocalizer
+ {
+ private readonly IStringLocalizerFactory _stringLocalizerFactory;
+ private readonly AbpMvcDataAnnotationsLocalizationOptions _options;
+
+ public AbpTagHelperLocalizer(IOptions options, IStringLocalizerFactory stringLocalizerFactory)
+ {
+ _stringLocalizerFactory = stringLocalizerFactory;
+ _options = options.Value;
+ }
+
+ public string GetLocalizedText(string text, ModelExplorer explorer)
+ {
+ var localizer = GetStringLocalizer(explorer);
+
+ return localizer == null ? text : localizer[text].Value;
+ }
+
+ public IStringLocalizer GetLocalizer(ModelExplorer explorer)
+ {
+ return GetStringLocalizer(explorer);
+ }
+
+ private IStringLocalizer GetStringLocalizer(ModelExplorer explorer)
+ {
+ IStringLocalizer localizer = null;
+ var resourceType = _options.AssemblyResources.GetOrDefault(explorer.Container.ModelType.Assembly);
+
+ if (resourceType != null)
+ {
+ localizer = _stringLocalizerFactory.Create(resourceType);
+ }
+
+ return localizer;
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs
index e96346a6e5..48cf748f24 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs
@@ -17,15 +17,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
{
private readonly IHtmlGenerator _generator;
private readonly HtmlEncoder _encoder;
- private readonly IStringLocalizerFactory _stringLocalizerFactory;
- private readonly AbpMvcDataAnnotationsLocalizationOptions _options;
+ private readonly IAbpTagHelperLocalizer _tagHelperLocalizer;
- public AbpInputTagHelperService(IHtmlGenerator generator, HtmlEncoder encoder, IOptions options, IStringLocalizerFactory stringLocalizerFactory)
+ public AbpInputTagHelperService(IHtmlGenerator generator, HtmlEncoder encoder, IAbpTagHelperLocalizer tagHelperLocalizer)
{
_generator = generator;
_encoder = encoder;
- _stringLocalizerFactory = stringLocalizerFactory;
- _options = options.Value;
+ _tagHelperLocalizer = tagHelperLocalizer;
}
public override void Process(TagHelperContext context, TagHelperOutput output)
@@ -52,6 +50,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
output.TagName = "div";
LeaveOnlyGroupAttributes(context, output);
output.Attributes.AddClass(isCheckbox ? "form-check" : "form-group");
+ output.Attributes.AddClass(isCheckbox ? "mb-2" : "");
output.Content.SetHtmlContent(output.Content.GetContent() + innerHtml);
}
}
@@ -189,7 +188,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
if (attribute != null)
{
- inputTagHelperOutput.Attributes.Add("placeholder", LocalizeText(attribute.Value));
+ var placeholderLocalized = _tagHelperLocalizer.GetLocalizedText(attribute.Value, TagHelper.AspFor.ModelExplorer);
+
+ inputTagHelperOutput.Attributes.Add("placeholder", placeholderLocalized);
}
}
@@ -207,20 +208,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
return;
}
- inputTagHelperOutput.Attributes.Add("aria-describedby", LocalizeText(idAttr.Value + "InfoText"));
- }
-
- protected virtual string LocalizeText(string text)
- {
- IStringLocalizer localizer = null;
- var resourceType = _options.AssemblyResources.GetOrDefault(TagHelper.AspFor.ModelExplorer.Container.ModelType.Assembly);
-
- if (resourceType != null)
- {
- localizer = _stringLocalizerFactory.Create(resourceType);
- }
+ var infoText = _tagHelperLocalizer.GetLocalizedText(idAttr.Value + "InfoText", TagHelper.AspFor.ModelExplorer);
- return localizer == null? text: localizer[text].Value;
+ inputTagHelperOutput.Attributes.Add("aria-describedby", infoText);
}
protected virtual bool IsInputCheckbox(TagHelperContext context, TagHelperOutput output, TagHelperAttributeList attributes)
@@ -269,7 +259,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
return "";
}
- string text = "";
+ var text = "";
if (!string.IsNullOrEmpty(TagHelper.InfoText))
{
@@ -289,9 +279,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
}
var idAttr = inputTag.Attributes.FirstOrDefault(a => a.Name == "id");
+ var localizedText = _tagHelperLocalizer.GetLocalizedText(text, TagHelper.AspFor.ModelExplorer);
return "" +
- LocalizeText(text) +
+ localizedText +
"";
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpRadioInputTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpRadioInputTagHelperService.cs
index 3644f322eb..f67eafe791 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpRadioInputTagHelperService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpRadioInputTagHelperService.cs
@@ -14,13 +14,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
{
public class AbpRadioInputTagHelperService : AbpTagHelperService
{
- private readonly AbpMvcDataAnnotationsLocalizationOptions _options;
- private readonly IStringLocalizerFactory _stringLocalizerFactory;
+ private readonly IAbpTagHelperLocalizer _tagHelperLocalizer;
- public AbpRadioInputTagHelperService(IOptions options, IStringLocalizerFactory stringLocalizerFactory)
+ public AbpRadioInputTagHelperService(IAbpTagHelperLocalizer tagHelperLocalizer)
{
- _options = options.Value;
- _stringLocalizerFactory = stringLocalizerFactory;
+ _tagHelperLocalizer = tagHelperLocalizer;
}
public override void Process(TagHelperContext context, TagHelperOutput output)
@@ -93,13 +91,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
protected virtual List GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer)
{
- IStringLocalizer localizer = null;
- var resourceType = _options.AssemblyResources.GetOrDefault(explorer.Container.ModelType.Assembly);
-
- if (resourceType != null)
- {
- localizer = _stringLocalizerFactory.Create(resourceType);
- }
+ var localizer = _tagHelperLocalizer.GetLocalizer(explorer);
var selectItems = explorer.Metadata.IsEnum ? explorer.ModelType.GetTypeInfo().GetMembers(BindingFlags.Public | BindingFlags.Static)
.Select((t, i) => new SelectListItem { Value = i.ToString(), Text = GetLocalizedPropertyName(localizer, explorer.ModelType, t.Name) }).ToList() : null;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs
index 1b81374274..6176472406 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs
@@ -20,15 +20,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
{
private readonly IHtmlGenerator _generator;
private readonly HtmlEncoder _encoder;
- private readonly IStringLocalizerFactory _stringLocalizerFactory;
- private readonly AbpMvcDataAnnotationsLocalizationOptions _options;
+ private readonly IAbpTagHelperLocalizer _tagHelperLocalizer;
- public AbpSelectTagHelperService(IHtmlGenerator generator, HtmlEncoder encoder, IOptions options, IStringLocalizerFactory stringLocalizerFactory)
+ public AbpSelectTagHelperService(IHtmlGenerator generator, HtmlEncoder encoder, IAbpTagHelperLocalizer tagHelperLocalizer)
{
_generator = generator;
_encoder = encoder;
- _stringLocalizerFactory = stringLocalizerFactory;
- _options = options.Value;
+ _tagHelperLocalizer = tagHelperLocalizer;
}
public override void Process(TagHelperContext context, TagHelperOutput output)
@@ -154,12 +152,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
return;
}
- inputTagHelperOutput.Attributes.Add("aria-describedby", LocalizeText(idAttr.Value + "InfoText"));
+ var infoText = _tagHelperLocalizer.GetLocalizedText(idAttr.Value + "InfoText", TagHelper.AspFor.ModelExplorer);
+
+ inputTagHelperOutput.Attributes.Add("aria-describedby", infoText);
}
protected virtual string GetInfoAsHtml(TagHelperContext context, TagHelperOutput output, TagHelperOutput inputTag)
{
- string text = "";
+ var text = "";
if (!string.IsNullOrEmpty(TagHelper.InfoText))
{
@@ -179,35 +179,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
}
var idAttr = inputTag.Attributes.FirstOrDefault(a => a.Name == "id");
+ var localizedText = _tagHelperLocalizer.GetLocalizedText(text, TagHelper.AspFor.ModelExplorer);
return "" +
- LocalizeText(text) +
+ localizedText +
"";
}
- protected virtual string LocalizeText(string text)
- {
- var localizer = GetLocalizer();
-
- return localizer == null ? text : localizer[text].Value;
- }
-
- protected virtual IStringLocalizer GetLocalizer()
- {
- IStringLocalizer localizer = null;
- var resourceType = _options.AssemblyResources.GetOrDefault(TagHelper.AspFor.ModelExplorer.Container.ModelType.Assembly);
-
- if (resourceType != null)
- {
- localizer = _stringLocalizerFactory.Create(resourceType);
- }
-
- return localizer;
- }
-
protected virtual List GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer)
{
- var localizer = GetLocalizer();
+ var localizer = _tagHelperLocalizer.GetLocalizer(explorer);
var selectItems = explorer.Metadata.IsEnum ? explorer.ModelType.GetTypeInfo().GetMembers(BindingFlags.Public | BindingFlags.Static)
.Select((t, i) => new SelectListItem { Value = i.ToString(), Text = GetLocalizedPropertyName(localizer, explorer.ModelType, t.Name) }).ToList() : null;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/IAbpTagHelperLocalizer.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/IAbpTagHelperLocalizer.cs
new file mode 100644
index 0000000000..8107f58d23
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/IAbpTagHelperLocalizer.cs
@@ -0,0 +1,13 @@
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
+using Microsoft.Extensions.Localization;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers
+{
+ public interface IAbpTagHelperLocalizer : ITransientDependency
+ {
+ string GetLocalizedText(string text, ModelExplorer explorer);
+
+ IStringLocalizer GetLocalizer(ModelExplorer explorer);
+ }
+}
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
index acf4d7ce80..23b4e36b75 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
@@ -86,7 +86,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
if (autoSave)
{
- await DbContext.SaveChangesAsync(cancellationToken);
+ await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken));
}
return updatedEntity;
@@ -108,7 +108,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
if (autoSave)
{
- await DbContext.SaveChangesAsync(cancellationToken);
+ await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken));
}
}
@@ -122,8 +122,8 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
return includeDetails
- ? await WithDetails().ToListAsync(cancellationToken)
- : await DbSet.ToListAsync(cancellationToken);
+ ? await WithDetails().ToListAsync(GetCancellationToken(cancellationToken))
+ : await DbSet.ToListAsync(GetCancellationToken(cancellationToken));
}
public override long GetCount()
@@ -133,7 +133,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
public override async Task GetCountAsync(CancellationToken cancellationToken = default)
{
- return await DbSet.LongCountAsync(cancellationToken);
+ return await DbSet.LongCountAsync(GetCancellationToken(cancellationToken));
}
protected override IQueryable GetQueryable()
@@ -153,7 +153,10 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
public override async Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
- var entities = await GetQueryable().Where(predicate).ToListAsync(GetCancellationToken(cancellationToken));
+ var entities = await GetQueryable()
+ .Where(predicate)
+ .ToListAsync(GetCancellationToken(cancellationToken));
+
foreach (var entity in entities)
{
DbSet.Remove(entity);
@@ -161,7 +164,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
if (autoSave)
{
- await DbContext.SaveChangesAsync(cancellationToken);
+ await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken));
}
}
@@ -171,7 +174,10 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
CancellationToken cancellationToken = default)
where TProperty : class
{
- await DbContext.Entry(entity).Collection(propertyExpression).LoadAsync(GetCancellationToken(cancellationToken));
+ await DbContext
+ .Entry(entity)
+ .Collection(propertyExpression)
+ .LoadAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task EnsurePropertyLoadedAsync(
@@ -180,7 +186,10 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
CancellationToken cancellationToken = default)
where TProperty : class
{
- await DbContext.Entry(entity).Reference(propertyExpression).LoadAsync(GetCancellationToken(cancellationToken));
+ await DbContext
+ .Entry(entity)
+ .Reference(propertyExpression)
+ .LoadAsync(GetCancellationToken(cancellationToken));
}
public override IQueryable WithDetails()
diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj
new file mode 100644
index 0000000000..b96d471322
--- /dev/null
+++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj
@@ -0,0 +1,22 @@
+
+
+
+
+
+ netstandard2.0
+ Volo.Abp.Http.Client.IdentityModel
+ Volo.Abp.Http.Client.IdentityModel
+ $(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/AbpHttpClientIdentityModelModule.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/AbpHttpClientIdentityModelModule.cs
new file mode 100644
index 0000000000..356acfe16f
--- /dev/null
+++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/AbpHttpClientIdentityModelModule.cs
@@ -0,0 +1,14 @@
+using Volo.Abp.IdentityModel;
+using Volo.Abp.Modularity;
+
+namespace Volo.Abp.Http.Client.IdentityModel
+{
+ [DependsOn(
+ typeof(AbpHttpClientModule),
+ typeof(AbpIdentityModelModule)
+ )]
+ public class AbpHttpClientIdentityModelModule : AbpModule
+ {
+
+ }
+}
diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs
new file mode 100644
index 0000000000..a5ef33e83b
--- /dev/null
+++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs
@@ -0,0 +1,56 @@
+using System.Net.Http.Headers;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Http;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Http.Client.Authentication;
+using Volo.Abp.IdentityModel;
+
+namespace Volo.Abp.Http.Client.IdentityModel
+{
+ [Dependency(ReplaceServices = true)]
+ public class IdentityModelRemoteServiceHttpClientAuthenticator : IRemoteServiceHttpClientAuthenticator, ITransientDependency
+ {
+ public IHttpContextAccessor HttpContextAccessor { get; set; }
+
+ protected IIdentityModelHttpClientAuthenticator IdentityModelHttpClientAuthenticator { get; }
+
+ public IdentityModelRemoteServiceHttpClientAuthenticator(IIdentityModelHttpClientAuthenticator identityModelHttpClientAuthenticator)
+ {
+ IdentityModelHttpClientAuthenticator = identityModelHttpClientAuthenticator;
+ }
+
+ public async Task Authenticate(RemoteServiceHttpClientAuthenticateContext context)
+ {
+ var accessToken = await GetAccessTokenFromHttpContextOrNullAsync();
+
+ if (accessToken != null)
+ {
+ //TODO: "Bearer" should be configurable
+ context.Client.DefaultRequestHeaders.Authorization
+ = new AuthenticationHeaderValue("Bearer", accessToken);
+ }
+ else
+ {
+ await IdentityModelHttpClientAuthenticator.Authenticate(
+ new IdentityModelHttpClientAuthenticateContext(
+ context.Client,
+ context.RemoteService.GetIdentityClient()
+ )
+ );
+ }
+ }
+
+ protected virtual async Task GetAccessTokenFromHttpContextOrNullAsync()
+ {
+ //TODO: What if the access_token in the current Http Request is not usable for this client?
+ var httpContext = HttpContextAccessor?.HttpContext;
+ if (httpContext == null)
+ {
+ return null;
+ }
+
+ return await httpContext.GetTokenAsync("access_token");
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/RemoteServiceConfigurationExtensions.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/RemoteServiceConfigurationExtensions.cs
new file mode 100644
index 0000000000..9d1c8a71e9
--- /dev/null
+++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/RemoteServiceConfigurationExtensions.cs
@@ -0,0 +1,24 @@
+using System.Collections.Generic;
+using JetBrains.Annotations;
+
+namespace Volo.Abp.Http.Client
+{
+ public static class RemoteServiceConfigurationExtensions
+ {
+ public const string IdentityClient = "IdentityClient";
+
+ [CanBeNull]
+ public static string GetIdentityClient([NotNull] this RemoteServiceConfiguration configuration)
+ {
+ Check.NotNullOrEmpty(configuration, nameof(configuration));
+
+ return configuration.GetOrDefault(IdentityClient);
+ }
+
+ public static RemoteServiceConfiguration SetIdentityClient([NotNull] this RemoteServiceConfiguration configuration, [CanBeNull] string value)
+ {
+ configuration[IdentityClient] = value;
+ return configuration;
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/HttpContextAccessTokenProvider.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/HttpContextAccessTokenProvider.cs
deleted file mode 100644
index 7a4855fe04..0000000000
--- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/HttpContextAccessTokenProvider.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Authentication;
-using Microsoft.AspNetCore.Http;
-using Volo.Abp.DependencyInjection;
-
-namespace Volo.Abp.Http.Client.Authentication
-{
- public class HttpContextAccessTokenProvider : IAccessTokenProvider, ISingletonDependency
- {
- public IHttpContextAccessor HttpContextAccessor { get; set; }
-
- public async Task GetOrNullAsync()
- {
- var httpContext = HttpContextAccessor?.HttpContext;
- if (httpContext == null)
- {
- return null;
- }
-
- return await httpContext.GetTokenAsync("access_token");
- }
- }
-}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IAccessTokenProvider.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IAccessTokenProvider.cs
deleted file mode 100644
index 5cb1aa92bc..0000000000
--- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IAccessTokenProvider.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System.Threading.Tasks;
-
-namespace Volo.Abp.Http.Client.Authentication
-{
- public interface IAccessTokenProvider //TODO: Not sure if this class should be here
- {
- Task GetOrNullAsync();
- }
-}
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IRemoteServiceHttpClientAuthenticator.cs
new file mode 100644
index 0000000000..920d38f2e6
--- /dev/null
+++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IRemoteServiceHttpClientAuthenticator.cs
@@ -0,0 +1,9 @@
+using System.Threading.Tasks;
+
+namespace Volo.Abp.Http.Client.Authentication
+{
+ public interface IRemoteServiceHttpClientAuthenticator
+ {
+ Task Authenticate(RemoteServiceHttpClientAuthenticateContext context);
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/NullRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/NullRemoteServiceHttpClientAuthenticator.cs
new file mode 100644
index 0000000000..6928f10dae
--- /dev/null
+++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/NullRemoteServiceHttpClientAuthenticator.cs
@@ -0,0 +1,14 @@
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.Http.Client.Authentication
+{
+ [Dependency(TryRegister = true)]
+ public class NullRemoteServiceHttpClientAuthenticator : IRemoteServiceHttpClientAuthenticator, ISingletonDependency
+ {
+ public Task Authenticate(RemoteServiceHttpClientAuthenticateContext context)
+ {
+ return Task.CompletedTask;
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/RemoteServiceHttpClientAuthenticateContext.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/RemoteServiceHttpClientAuthenticateContext.cs
new file mode 100644
index 0000000000..fff00d5bf8
--- /dev/null
+++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/RemoteServiceHttpClientAuthenticateContext.cs
@@ -0,0 +1,23 @@
+using System.Net.Http;
+
+namespace Volo.Abp.Http.Client.Authentication
+{
+ public class RemoteServiceHttpClientAuthenticateContext
+ {
+ public HttpClient Client { get; }
+
+ public HttpRequestMessage Request { get; }
+
+ public RemoteServiceConfiguration RemoteService { get; }
+
+ public RemoteServiceHttpClientAuthenticateContext(
+ HttpClient client,
+ HttpRequestMessage request,
+ RemoteServiceConfiguration remoteService)
+ {
+ Client = client;
+ Request = request;
+ RemoteService = remoteService;
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs
index f6be5ac630..d367c7b09e 100644
--- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs
+++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
-using System.Net.Http.Headers;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
@@ -28,7 +27,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
private readonly RemoteServiceOptions _remoteServiceOptions;
private readonly AbpHttpClientOptions _clientOptions;
private readonly IJsonSerializer _jsonSerializer;
- private readonly IAccessTokenProvider _accessTokenProvider;
+ private readonly IRemoteServiceHttpClientAuthenticator _clientAuthenticator;
static DynamicHttpProxyInterceptor()
{
@@ -43,12 +42,12 @@ namespace Volo.Abp.Http.Client.DynamicProxying
IOptionsSnapshot remoteServiceOptions,
IApiDescriptionFinder apiDescriptionFinder,
IJsonSerializer jsonSerializer,
- IAccessTokenProvider accessTokenProvider)
+ IRemoteServiceHttpClientAuthenticator clientAuthenticator)
{
_httpClientFactory = httpClientFactory;
_apiDescriptionFinder = apiDescriptionFinder;
_jsonSerializer = jsonSerializer;
- _accessTokenProvider = accessTokenProvider;
+ _clientAuthenticator = clientAuthenticator;
_clientOptions = clientOptions.Value;
_remoteServiceOptions = remoteServiceOptions.Value;
}
@@ -110,11 +109,11 @@ namespace Volo.Abp.Http.Client.DynamicProxying
using (var client = _httpClientFactory.Create())
{
var clientConfig = _clientOptions.HttpClientProxies.GetOrDefault(typeof(TService)) ?? throw new AbpException($"Could not get DynamicHttpClientProxyConfig for {typeof(TService).FullName}.");
+ var remoteServiceConfig = _remoteServiceOptions.RemoteServices.GetConfigurationOrDefault(clientConfig.RemoteServiceName);
- var baseUrl = GetBaseUrl(clientConfig);
- var action = await _apiDescriptionFinder.FindActionAsync(baseUrl, typeof(TService), invocation.Method);
+ var action = await _apiDescriptionFinder.FindActionAsync(remoteServiceConfig.BaseUrl, typeof(TService), invocation.Method);
var apiVersion = GetApiVersionInfo(action);
- var url = baseUrl + UrlBuilder.GenerateUrlWithParameters(action, invocation.ArgumentsDictionary, apiVersion);
+ var url = remoteServiceConfig.BaseUrl + UrlBuilder.GenerateUrlWithParameters(action, invocation.ArgumentsDictionary, apiVersion);
var requestMessage = new HttpRequestMessage(action.GetHttpMethod(), url)
{
@@ -123,12 +122,13 @@ namespace Volo.Abp.Http.Client.DynamicProxying
AddHeaders(invocation, action, requestMessage, apiVersion);
- var accessToken = await _accessTokenProvider.GetOrNullAsync();
- if (accessToken != null)
- {
- //TODO: "Bearer" should not be static.
- client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
- }
+ await _clientAuthenticator.Authenticate(
+ new RemoteServiceHttpClientAuthenticateContext(
+ client,
+ requestMessage,
+ remoteServiceConfig
+ )
+ );
var response = await client.SendAsync(requestMessage);
@@ -174,8 +174,8 @@ namespace Volo.Abp.Http.Client.DynamicProxying
if (!apiVersion.Version.IsNullOrEmpty())
{
//TODO: What about other media types?
- requestMessage.Headers.Add("accept", $"text/plain; v={apiVersion.Version}");
- requestMessage.Headers.Add("accept", $"application/json; v={apiVersion.Version}");
+ requestMessage.Headers.Add("accept", $"{MimeTypes.Text.Plain}; v={apiVersion.Version}");
+ requestMessage.Headers.Add("accept", $"{MimeTypes.Application.Json}; v={apiVersion.Version}");
requestMessage.Headers.Add("api-version", apiVersion.Version);
}
@@ -191,13 +191,6 @@ namespace Volo.Abp.Http.Client.DynamicProxying
}
}
- private string GetBaseUrl(DynamicHttpClientProxyConfig config)
- {
- return _remoteServiceOptions.RemoteServices.GetOrDefault(config.RemoteServiceName)?.BaseUrl
- ?? _remoteServiceOptions.RemoteServices.Default?.BaseUrl
- ?? throw new AbpException($"Could not find Base URL for {typeof(TService).FullName}.");
- }
-
private string GetConfiguredApiVersion()
{
var clientConfig = _clientOptions.HttpClientProxies.GetOrDefault(typeof(TService))
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/RequestPayloadBuilder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/RequestPayloadBuilder.cs
index 8f5fbd0c39..afc5f9e4f0 100644
--- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/RequestPayloadBuilder.cs
+++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/RequestPayloadBuilder.cs
@@ -17,13 +17,13 @@ namespace Volo.Abp.Http.Client.DynamicProxying
var body = GenerateBody(action, methodArguments, jsonSerializer);
if (body != null)
{
- return new StringContent(body, Encoding.UTF8, "application/json"); //TODO: application/json to a constant
+ return new StringContent(body, Encoding.UTF8, MimeTypes.Application.Json);
}
body = GenerateFormPostData(action, methodArguments);
if (body != null)
{
- return new StringContent(body, Encoding.UTF8, "application/x-www-form-urlencoded"); //TODO: application/x-www-form-urlencoded to a constant
+ return new StringContent(body, Encoding.UTF8, MimeTypes.Application.XWwwFormUrlencoded);
}
return null;
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/RemoteServiceConfiguration.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/RemoteServiceConfiguration.cs
index 200e549c3e..d6e5021f78 100644
--- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/RemoteServiceConfiguration.cs
+++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/RemoteServiceConfiguration.cs
@@ -1,10 +1,26 @@
-namespace Volo.Abp.Http.Client
+using System.Collections.Generic;
+
+namespace Volo.Abp.Http.Client
{
- public class RemoteServiceConfiguration
+ public class RemoteServiceConfiguration : Dictionary
{
- public string BaseUrl { get; set; }
+ ///
+ /// Base Url.
+ ///
+ public string BaseUrl
+ {
+ get => this.GetOrDefault(nameof(BaseUrl));
+ set => this[BaseUrl] = value;
+ }
- public string Version { get; set; }
+ ///
+ /// Version.
+ ///
+ public string Version
+ {
+ get => this.GetOrDefault(nameof(Version));
+ set => this[Version] = value;
+ }
public RemoteServiceConfiguration()
{
@@ -13,8 +29,8 @@
public RemoteServiceConfiguration(string baseUrl, string version = null)
{
- BaseUrl = baseUrl;
- Version = version;
+ this[nameof(BaseUrl)] = baseUrl;
+ this[nameof(Version)] = version;
}
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/RemoteServiceConfigurationDictionary.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/RemoteServiceConfigurationDictionary.cs
index d59470fa57..248285d748 100644
--- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/RemoteServiceConfigurationDictionary.cs
+++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/RemoteServiceConfigurationDictionary.cs
@@ -8,8 +8,15 @@ namespace Volo.Abp.Http.Client
public RemoteServiceConfiguration Default
{
- get { return this.GetOrDefault(DefaultName); }
- set { this[DefaultName] = value; }
+ get => this.GetOrDefault(DefaultName);
+ set => this[DefaultName] = value;
+ }
+
+ public RemoteServiceConfiguration GetConfigurationOrDefault(string name)
+ {
+ return this.GetOrDefault(name)
+ ?? Default
+ ?? throw new AbpException($"Remote service '{name}' was not found and there is no default configuration.");
}
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj b/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj
index 1b2d7caa8d..df1e907450 100644
--- a/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj
+++ b/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj
@@ -14,7 +14,6 @@
-
diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/MimeTypes.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/MimeTypes.cs
index 850a070c8f..a4768a6af1 100644
--- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/MimeTypes.cs
+++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/MimeTypes.cs
@@ -32,6 +32,7 @@ namespace Volo.Abp.Http
public const string XPkcs12 = "application/x-pkcs12";
public const string XShockwaveFlash = "application/x-shockwave-flash";
public const string XSilverlightApp = "application/x-silverlight-app";
+ public const string XWwwFormUrlencoded = "application/x-www-form-urlencoded";
public const string XhtmlXml = "application/xhtml+xml";
public const string Xml = "application/xml";
public const string XmlDtd = "application/xml-dtd";
diff --git a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj
new file mode 100644
index 0000000000..ac757528c7
--- /dev/null
+++ b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj
@@ -0,0 +1,21 @@
+
+
+
+
+
+ netstandard2.0
+ Volo.Abp.IdentityModel
+ Volo.Abp.IdentityModel
+ $(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityModelModule.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityModelModule.cs
new file mode 100644
index 0000000000..cadeb794a7
--- /dev/null
+++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityModelModule.cs
@@ -0,0 +1,15 @@
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Modularity;
+
+namespace Volo.Abp.IdentityModel
+{
+ public class AbpIdentityModelModule : AbpModule
+ {
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ var configuration = context.Services.GetConfiguration();
+
+ Configure(configuration);
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IIdentityModelHttpClientAuthenticator.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IIdentityModelHttpClientAuthenticator.cs
new file mode 100644
index 0000000000..80215263c8
--- /dev/null
+++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IIdentityModelHttpClientAuthenticator.cs
@@ -0,0 +1,9 @@
+using System.Threading.Tasks;
+
+namespace Volo.Abp.IdentityModel
+{
+ public interface IIdentityModelHttpClientAuthenticator
+ {
+ Task Authenticate(IdentityModelHttpClientAuthenticateContext context);
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfiguration.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfiguration.cs
new file mode 100644
index 0000000000..520195e7ce
--- /dev/null
+++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfiguration.cs
@@ -0,0 +1,93 @@
+using System.Collections.Generic;
+using IdentityModel;
+
+namespace Volo.Abp.IdentityModel
+{
+ public class IdentityClientConfiguration : Dictionary
+ {
+ ///
+ /// Possible values: "client_credentials" or "password".
+ /// Default value: "client_credentials".
+ ///
+ public string GrantType
+ {
+ get => this.GetOrDefault(nameof(GrantType));
+ set => this[GrantType] = value;
+ }
+
+ ///
+ /// Client Id.
+ ///
+ public string ClientId
+ {
+ get => this.GetOrDefault(nameof(ClientId));
+ set => this[ClientId] = value;
+ }
+
+ ///
+ /// Client secret (as plain text - without hashed).
+ ///
+ public string ClientSecret
+ {
+ get => this.GetOrDefault(nameof(ClientSecret));
+ set => this[ClientSecret] = value;
+ }
+
+ ///
+ /// User name.
+ /// Valid only if is "password".
+ ///
+ public string UserName
+ {
+ get => this.GetOrDefault(nameof(UserName));
+ set => this[UserName] = value;
+ }
+
+ ///
+ /// Password of the .
+ /// Valid only if is "password".
+ ///
+ public string UserPassword
+ {
+ get => this.GetOrDefault(nameof(UserPassword));
+ set => this[UserPassword] = value;
+ }
+
+ ///
+ /// Authority.
+ ///
+ public string Authority
+ {
+ get => this.GetOrDefault(nameof(Authority));
+ set => this[Authority] = value;
+ }
+
+ ///
+ /// Scope.
+ ///
+ public string Scope
+ {
+ get => this.GetOrDefault(nameof(Scope));
+ set => this[Scope] = value;
+ }
+
+ public IdentityClientConfiguration()
+ {
+
+ }
+
+ public IdentityClientConfiguration(
+ string clientId,
+ string clientSecret,
+ string grantType = OidcConstants.GrantTypes.ClientCredentials,
+ string userName = null,
+ string userPassword = null)
+ {
+ this[nameof(ClientId)] = clientId;
+ this[nameof(ClientSecret)] = clientSecret;
+ this[nameof(GrantType)] = grantType;
+ this[nameof(UserName)] = userName;
+ this[nameof(UserPassword)] = userPassword;
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfigurationDictionary.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfigurationDictionary.cs
new file mode 100644
index 0000000000..62c9359a74
--- /dev/null
+++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfigurationDictionary.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+
+namespace Volo.Abp.IdentityModel
+{
+ public class IdentityClientConfigurationDictionary : Dictionary
+ {
+ public const string DefaultName = "Default";
+
+ public IdentityClientConfiguration Default
+ {
+ get => this.GetOrDefault(DefaultName);
+ set => this[DefaultName] = value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientOptions.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientOptions.cs
new file mode 100644
index 0000000000..f05d5c8511
--- /dev/null
+++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientOptions.cs
@@ -0,0 +1,12 @@
+namespace Volo.Abp.IdentityModel
+{
+ public class IdentityClientOptions
+ {
+ public IdentityClientConfigurationDictionary IdentityClients { get; set; }
+
+ public IdentityClientOptions()
+ {
+ IdentityClients = new IdentityClientConfigurationDictionary();
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelHttpClientAuthenticateContext.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelHttpClientAuthenticateContext.cs
new file mode 100644
index 0000000000..849ae7196d
--- /dev/null
+++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelHttpClientAuthenticateContext.cs
@@ -0,0 +1,27 @@
+using System.Net.Http;
+
+namespace Volo.Abp.IdentityModel
+{
+ public class IdentityModelHttpClientAuthenticateContext
+ {
+ public HttpClient Client { get; }
+
+ ///
+ /// The identity client name configured with the .
+ ///
+ public string IdentityClientName { get; }
+
+ ///
+ ///
+ ///
+ /// object to be authorized
+ /// The identity client name configured with the .
+ public IdentityModelHttpClientAuthenticateContext(
+ HttpClient client,
+ string identityClientName = null)
+ {
+ Client = client;
+ IdentityClientName = identityClientName;
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs
new file mode 100644
index 0000000000..4a0daea58d
--- /dev/null
+++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs
@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.Net.Http.Headers;
+using System.Threading.Tasks;
+using IdentityModel;
+using IdentityModel.Client;
+using Microsoft.Extensions.Options;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.IdentityModel
+{
+ [Dependency(ReplaceServices = true)]
+ public class IdentityModelHttpClientAuthenticator : IIdentityModelHttpClientAuthenticator, ITransientDependency
+ {
+ protected IdentityClientOptions ClientOptions { get; }
+
+ public IdentityModelHttpClientAuthenticator(
+ IOptions options)
+ {
+ ClientOptions = options.Value;
+ }
+
+ public async Task Authenticate(IdentityModelHttpClientAuthenticateContext context)
+ {
+ var accessToken = await GetAccessTokenFromServerOrNullAsync(context);
+
+ if (accessToken != null)
+ {
+ //TODO: "Bearer" should be configurable
+ context.Client.DefaultRequestHeaders.Authorization
+ = new AuthenticationHeaderValue("Bearer", accessToken);
+ }
+ }
+
+ protected virtual async Task GetAccessTokenFromServerOrNullAsync(IdentityModelHttpClientAuthenticateContext context)
+ {
+ var configuration = GetClientConfiguration(context);
+
+ if (configuration == null)
+ {
+ return null;
+ }
+
+ var discoveryResponse = await GetDiscoveryResponse(configuration);
+ if (discoveryResponse.IsError)
+ {
+ return null;
+ }
+
+ var tokenResponse = await GetTokenResponse(discoveryResponse, configuration);
+ if (tokenResponse.IsError)
+ {
+ return null;
+ }
+
+ return tokenResponse.AccessToken;
+ }
+
+ private IdentityClientConfiguration GetClientConfiguration(IdentityModelHttpClientAuthenticateContext context)
+ {
+ if (context.IdentityClientName.IsNullOrEmpty())
+ {
+ return ClientOptions.IdentityClients.Default;
+ }
+
+ return ClientOptions.IdentityClients.GetOrDefault(context.IdentityClientName) ??
+ ClientOptions.IdentityClients.Default;
+ }
+
+ protected virtual async Task GetDiscoveryResponse(IdentityClientConfiguration configuration)
+ {
+ return await DiscoveryClient.GetAsync(configuration.Authority);
+ }
+
+ protected virtual async Task GetTokenResponse(DiscoveryResponse discoveryResponse, IdentityClientConfiguration configuration)
+ {
+ var tokenClient = new TokenClient(discoveryResponse.TokenEndpoint, configuration.ClientId, configuration.ClientSecret);
+
+ switch (configuration.GrantType)
+ {
+ case OidcConstants.GrantTypes.ClientCredentials:
+ return await tokenClient.RequestClientCredentialsAsync(
+ configuration.Scope
+ );
+ case OidcConstants.GrantTypes.Password:
+ return await tokenClient.RequestResourceOwnerPasswordAsync(
+ configuration.UserName,
+ configuration.UserPassword,
+ configuration.Scope
+ );
+ default:
+ throw new AbpException("Grant type was not implemented: " + configuration.GrantType);
+ }
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs
index 11e79b32e2..194f604847 100644
--- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs
+++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs
@@ -221,7 +221,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default)
{
- return await GetMongoQueryable().ToListAsync(cancellationToken);
+ return await GetMongoQueryable().ToListAsync(GetCancellationToken(cancellationToken));
}
public override long GetCount()
@@ -231,7 +231,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
public override async Task GetCountAsync(CancellationToken cancellationToken = default)
{
- return await GetMongoQueryable().LongCountAsync(cancellationToken);
+ return await GetMongoQueryable().LongCountAsync(GetCancellationToken(cancellationToken));
}
public override void Delete(Expression> predicate, bool autoSave = false)
@@ -257,7 +257,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
foreach (var entity in entities)
{
- await DeleteAsync(entity, autoSave, GetCancellationToken(cancellationToken));
+ await DeleteAsync(entity, autoSave, cancellationToken);
}
}
diff --git a/framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/TenantSettingValueProvider.cs b/framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/TenantSettingValueProvider.cs
index 2f5ff72a6d..542af56fe2 100644
--- a/framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/TenantSettingValueProvider.cs
+++ b/framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/TenantSettingValueProvider.cs
@@ -19,27 +19,27 @@ namespace Volo.Abp.MultiTenancy
public override async Task GetOrNullAsync(SettingDefinition setting, string providerKey)
{
- if (providerKey == null)
- {
- if (CurrentTenant.Id == null)
- {
- return null;
- }
-
- providerKey = CurrentTenant.Id.ToString();
- }
-
- return await SettingStore.GetOrNullAsync(setting.Name, Name, providerKey);
+ return await SettingStore.GetOrNullAsync(setting.Name, Name, NormalizeProviderKey(providerKey));
}
public override Task SetAsync(SettingDefinition setting, string value, string providerKey)
{
- return SettingStore.SetAsync(setting.Name, value, Name, providerKey);
+ return SettingStore.SetAsync(setting.Name, value, Name, NormalizeProviderKey(providerKey));
}
public override Task ClearAsync(SettingDefinition setting, string providerKey)
{
- return SettingStore.DeleteAsync(setting.Name, Name, providerKey);
+ return SettingStore.DeleteAsync(setting.Name, Name, NormalizeProviderKey(providerKey));
+ }
+
+ private string NormalizeProviderKey(string providerKey)
+ {
+ if (providerKey == null && CurrentTenant.Id.HasValue)
+ {
+ return CurrentTenant.Id.Value.ToString();
+ }
+
+ return providerKey;
}
}
}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs
index 031a6d6c89..8bf86a3ace 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PersonAppService_Tests.cs
@@ -10,6 +10,7 @@ using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
+using Volo.Abp.Http;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Json;
using Volo.Abp.TestApp.Application.Dto;
@@ -66,7 +67,7 @@ namespace Volo.Abp.AspNetCore.Mvc
var response = await Client.PostAsync(
"/api/app/people",
- new StringContent(postData, Encoding.UTF8, "application/json")
+ new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json)
);
response.StatusCode.ShouldBe(HttpStatusCode.OK);
@@ -98,7 +99,7 @@ namespace Volo.Abp.AspNetCore.Mvc
var response = await Client.PutAsync(
$"/api/app/people/{updateDto.Id}",
- new StringContent(putData, Encoding.UTF8, "application/json")
+ new StringContent(putData, Encoding.UTF8, MimeTypes.Application.Json)
);
response.StatusCode.ShouldBe(HttpStatusCode.OK);
@@ -131,7 +132,7 @@ namespace Volo.Abp.AspNetCore.Mvc
var response = await Client.PostAsync(
$"/api/app/people/{personToAddNewPhone.Id}/phones",
- new StringContent(postData, Encoding.UTF8, "application/json")
+ new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json)
);
response.StatusCode.ShouldBe(HttpStatusCode.OK);
diff --git a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs
index a6c597aa3e..13d83b8231 100644
--- a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs
+++ b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs
@@ -5,7 +5,7 @@ using Volo.Abp.Account.Web.Settings;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars;
-using Volo.Abp.Identity;
+using Volo.Abp.Identity.AspNetCore;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
@@ -15,7 +15,7 @@ using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.Account.Web
{
- [DependsOn(typeof(AbpIdentityDomainModule))]
+ [DependsOn(typeof(AbpIdentityAspNetCoreModule))]
[DependsOn(typeof(AbpAspNetCoreMvcUiThemeSharedModule))]
public class AbpAccountWebModule : AbpModule
{
diff --git a/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj b/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj
index b1d622de86..50be3cbf0d 100644
--- a/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj
+++ b/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj
@@ -30,7 +30,7 @@
-
+
diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs
index 9a39a06dc2..d718e5d911 100644
--- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs
+++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs
@@ -76,7 +76,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
b.Property(x => x.ChangeType).IsRequired().HasColumnName(nameof(EntityChange.ChangeType));
b.Property(x => x.TenantId).HasColumnName(nameof(EntityChange.TenantId));
- b.HasMany().WithOne().HasForeignKey(x => x.EntityChangeId);
+ b.HasMany(a => a.PropertyChanges).WithOne().HasForeignKey(x => x.EntityChangeId);
b.HasIndex(x => new { x.AuditLogId });
b.HasIndex(x => new { x.TenantId, x.EntityTypeFullName, x.EntityId });
diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs
index c537473691..3b8f8836f2 100644
--- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs
+++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs
@@ -31,7 +31,7 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
public async Task OnGetAsync(string source)
{
- if (source == "GitHub")
+ if (source != null && source.ToLowerInvariant() == "github")
{
GithubProject = new CreateGithubProjectViewModel();
return Page();
diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml
index 6ed3eeda25..3d730caec4 100644
--- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml
+++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml
@@ -34,7 +34,7 @@
- Github
+ Github
}
diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json
index d84b737cf3..31d3835a3a 100644
--- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json
+++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json
@@ -7,6 +7,7 @@
"ShareOn": "Share on",
"Version": "Version",
"Edit": "Edit",
+ "Delete": "Delete",
"InThisDocument": "In this document",
"GoToTop": "Go to top",
"Projects": "Project(s)",
diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json
index 2c10c4f25d..da39c6cce3 100644
--- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json
+++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json
@@ -7,6 +7,7 @@
"ShareOn": "Paylaş",
"Version": "Versiyon",
"Edit": "Düzenle",
+ "Delete": "Sil",
"InThisDocument": "Bu dökümanda",
"GoToTop": "En üste çık",
"Projects": "Proje(ler)",
diff --git a/modules/identity/Volo.Abp.Identity.sln b/modules/identity/Volo.Abp.Identity.sln
index b6973a36ba..f84a829907 100644
--- a/modules/identity/Volo.Abp.Identity.sln
+++ b/modules/identity/Volo.Abp.Identity.sln
@@ -35,6 +35,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Identity.TestBase"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Identity.Domain.Tests", "test\Volo.Abp.Identity.Domain.Tests\Volo.Abp.Identity.Domain.Tests.csproj", "{588B6E38-323B-4251-AC21-5F67C815A44E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Identity.AspNetCore", "src\Volo.Abp.Identity.AspNetCore\Volo.Abp.Identity.AspNetCore.csproj", "{D5EFC912-75A0-4856-9B8D-DFDD4CD66BAB}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -97,6 +99,10 @@ Global
{588B6E38-323B-4251-AC21-5F67C815A44E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{588B6E38-323B-4251-AC21-5F67C815A44E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{588B6E38-323B-4251-AC21-5F67C815A44E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D5EFC912-75A0-4856-9B8D-DFDD4CD66BAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D5EFC912-75A0-4856-9B8D-DFDD4CD66BAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D5EFC912-75A0-4856-9B8D-DFDD4CD66BAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D5EFC912-75A0-4856-9B8D-DFDD4CD66BAB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -116,6 +122,7 @@ Global
{7291DCF0-7AA2-41A6-9AA7-98C2E9D13222} = {9FACAF96-A681-4B36-A938-A37DCA0B7EC1}
{D7F61598-E7CE-4DAB-99EA-C266F0423606} = {9FACAF96-A681-4B36-A938-A37DCA0B7EC1}
{588B6E38-323B-4251-AC21-5F67C815A44E} = {9FACAF96-A681-4B36-A938-A37DCA0B7EC1}
+ {D5EFC912-75A0-4856-9B8D-DFDD4CD66BAB} = {AADC5A0A-F100-4511-87DE-B74E55F5B69B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {05740D37-83CF-4041-9C2A-D89F1B3DB5A4}
diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj
new file mode 100644
index 0000000000..12b84640c0
--- /dev/null
+++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj
@@ -0,0 +1,21 @@
+
+
+
+
+
+ netstandard2.0
+ Volo.Abp.Identity.AspNetCore
+ Volo.Abp.Identity.AspNetCore
+ $(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpIdentityAspNetCoreModule.cs b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpIdentityAspNetCoreModule.cs
new file mode 100644
index 0000000000..388c0849b7
--- /dev/null
+++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpIdentityAspNetCoreModule.cs
@@ -0,0 +1,38 @@
+using Microsoft.AspNetCore.Identity;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Modularity;
+
+namespace Volo.Abp.Identity.AspNetCore
+{
+ [DependsOn(
+ typeof(AbpIdentityDomainModule)
+ )]
+ public class AbpIdentityAspNetCoreModule : AbpModule
+ {
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ context.Services
+ .GetObject()
+ .AddDefaultTokenProviders()
+ .AddSignInManager();
+
+ //(TODO: Extract an extension method like IdentityBuilder.AddAbpSecurityStampValidator())
+ context.Services.AddScoped();
+ context.Services.AddScoped(typeof(SecurityStampValidator), provider => provider.GetService(typeof(AbpSecurityStampValidator)));
+ context.Services.AddScoped(typeof(ISecurityStampValidator), provider => provider.GetService(typeof(AbpSecurityStampValidator)));
+
+ var options = context.Services.ExecutePreConfiguredActions(new AbpIdentityAspNetCoreOptions());
+
+ if (options.ConfigureAuthentication)
+ {
+ context.Services
+ .AddAuthentication(o =>
+ {
+ o.DefaultScheme = IdentityConstants.ApplicationScheme;
+ o.DefaultSignInScheme = IdentityConstants.ExternalScheme;
+ })
+ .AddIdentityCookies();
+ }
+ }
+ }
+}
diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpIdentityAspNetCoreOptions.cs b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpIdentityAspNetCoreOptions.cs
new file mode 100644
index 0000000000..ad42a23f9a
--- /dev/null
+++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpIdentityAspNetCoreOptions.cs
@@ -0,0 +1,10 @@
+namespace Volo.Abp.Identity.AspNetCore
+{
+ public class AbpIdentityAspNetCoreOptions
+ {
+ ///
+ /// Default: true.
+ ///
+ public bool ConfigureAuthentication { get; set; } = true;
+ }
+}
\ No newline at end of file
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpSecurityStampValidator.cs b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpSecurityStampValidator.cs
similarity index 100%
rename from modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpSecurityStampValidator.cs
rename to modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpSecurityStampValidator.cs
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimValueType.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimValueType.cs
index 69d40a4607..7ea73ef3f0 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimValueType.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimValueType.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Volo.Abp.Identity
+namespace Volo.Abp.Identity
{
public enum IdentityClaimValueType
{
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/Extensions/DependencyInjection/AbpIdentityServiceCollectionExtensions.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/Extensions/DependencyInjection/AbpIdentityServiceCollectionExtensions.cs
index 5a59253205..c2d91eafd7 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/Extensions/DependencyInjection/AbpIdentityServiceCollectionExtensions.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/Extensions/DependencyInjection/AbpIdentityServiceCollectionExtensions.cs
@@ -22,11 +22,6 @@ namespace Microsoft.Extensions.DependencyInjection
services.TryAddScoped();
services.TryAddScoped(typeof(UserManager), provider => provider.GetService(typeof(IdentityUserManager)));
- //AbpSecurityStampValidator
- services.TryAddScoped();
- services.TryAddScoped(typeof(SecurityStampValidator), provider => provider.GetService(typeof(AbpSecurityStampValidator)));
- services.TryAddScoped(typeof(ISecurityStampValidator), provider => provider.GetService(typeof(AbpSecurityStampValidator)));
-
//AbpUserStore
services.TryAddScoped();
services.TryAddScoped(typeof(IUserStore), provider => provider.GetService(typeof(IdentityUserStore)));
@@ -35,10 +30,10 @@ namespace Microsoft.Extensions.DependencyInjection
services.TryAddScoped();
services.TryAddScoped(typeof(IRoleStore), provider => provider.GetService(typeof(IdentityRoleStore)));
- return services.AddIdentity(setupAction)
- .AddDefaultTokenProviders()
+ return services
+ .AddIdentityCore(setupAction)
+ .AddRoles()
.AddClaimsPrincipalFactory();
- //return services.AddIdentityCore(setupAction);
}
}
}
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj b/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj
index a151c385b9..bdf9c1edd0 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj
@@ -27,7 +27,7 @@
-
+
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs
index 9b639f4b34..6465fe692f 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs
@@ -55,6 +55,7 @@ namespace Volo.Abp.Identity
options.User.RequireUniqueEmail = true;
});
+ context.Services.AddObjectAccessor(identityBuilder);
context.Services.ExecutePreConfiguredActions(identityBuilder);
AddAbpIdentityOptionsFactory(context.Services);
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIDentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIDentityClaimTypeRepository.cs
index e55bdd966b..c2d5b4fd5c 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIDentityClaimTypeRepository.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIDentityClaimTypeRepository.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
@@ -8,10 +7,16 @@ namespace Volo.Abp.Identity
{
public interface IIdentityClaimTypeRepository : IBasicRepository
{
- Task DoesNameExist(string name, Guid? claimTypeId = null);
+ ///
+ /// Checks if there is a entity with given name.
+ ///
+ /// Name to check
+ ///
+ /// An Id value to ignore on checking.
+ /// If there is an entity with given it's ignored.
+ ///
+ Task AnyAsync(string name, Guid? ignoredId = null);
Task> GetListAsync(string sorting, int maxResultCount, int skipCount);
-
- Task GetTotalCount();
}
}
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdenityClaimTypeManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdenityClaimTypeManager.cs
index eac38b9f24..69e5428e66 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdenityClaimTypeManager.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdenityClaimTypeManager.cs
@@ -1,26 +1,20 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
-using Volo.Abp.Guids;
namespace Volo.Abp.Identity
{
public class IdenityClaimTypeManager : DomainService
{
private readonly IIdentityClaimTypeRepository _identityClaimTypeRepository;
- private readonly IGuidGenerator _guidGenerator;
- public IdenityClaimTypeManager(IIdentityClaimTypeRepository identityClaimTypeRepository, IGuidGenerator guidGenerator)
+ public IdenityClaimTypeManager(IIdentityClaimTypeRepository identityClaimTypeRepository)
{
_identityClaimTypeRepository = identityClaimTypeRepository;
- _guidGenerator = guidGenerator;
}
public virtual async Task CreateAsync(IdentityClaimType claimType)
{
- if (await _identityClaimTypeRepository.DoesNameExist(claimType.Name))
+ if (await _identityClaimTypeRepository.AnyAsync(claimType.Name))
{
throw new AbpException($"Name Exist: {claimType.Name}");
}
@@ -30,7 +24,7 @@ namespace Volo.Abp.Identity
public virtual async Task UpdateAsync(IdentityClaimType claimType)
{
- if (await _identityClaimTypeRepository.DoesNameExist(claimType.Name, claimType.Id))
+ if (await _identityClaimTypeRepository.AnyAsync(claimType.Name, claimType.Id))
{
throw new AbpException($"Name Exist: {claimType.Name}");
}
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs
index d8722669fb..b857c940f8 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimType.cs
@@ -1,5 +1,5 @@
-using System;
-using JetBrains.Annotations;
+using JetBrains.Annotations;
+using System;
using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Identity
@@ -8,15 +8,15 @@ namespace Volo.Abp.Identity
{
public virtual string Name { get; protected set; }
- public virtual bool Required { get; protected set; }
+ public virtual bool Required { get; set; }
public virtual bool IsStatic { get; protected set; }
- public virtual string Regex { get; protected set; }
+ public virtual string Regex { get; set; }
- public virtual string RegexDescription { get; protected set; }
+ public virtual string RegexDescription { get; set; }
- public virtual string Description { get; protected set; }
+ public virtual string Description { get; set; }
public virtual IdentityClaimValueType ValueType { get; protected set; }
@@ -25,12 +25,18 @@ namespace Volo.Abp.Identity
}
- public IdentityClaimType(Guid id, [NotNull] string name, bool required, bool isStatic, [CanBeNull]string regex, [CanBeNull]string regexDescription, [CanBeNull] string description, IdentityClaimValueType valueType = IdentityClaimValueType.String)
+ public IdentityClaimType(
+ Guid id,
+ [NotNull] string name,
+ bool required = false,
+ bool isStatic = false,
+ [CanBeNull] string regex = null,
+ [CanBeNull] string regexDescription = null,
+ [CanBeNull] string description = null,
+ IdentityClaimValueType valueType = IdentityClaimValueType.String)
{
- Check.NotNull(name, nameof(name));
-
Id = id;
- Name = name;
+ Name = Check.NotNull(name, nameof(name));
Required = required;
IsStatic = isStatic;
Regex = regex;
diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs
index f50ed08d35..50a4578cae 100644
--- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs
+++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs
@@ -11,13 +11,17 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
{
public class EfCoreIdentityClaimTypeRepository : EfCoreRepository, IIdentityClaimTypeRepository
{
- public EfCoreIdentityClaimTypeRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider)
+ public EfCoreIdentityClaimTypeRepository(IDbContextProvider dbContextProvider)
+ : base(dbContextProvider)
{
+
}
- public async Task DoesNameExist(string name, Guid? claimTypeId = null)
+ public async Task AnyAsync(string name, Guid? ignoredId = null)
{
- return await DbSet.WhereIf(claimTypeId != null, ct => ct.Id != claimTypeId).CountAsync(ct => ct.Name == name) > 0;
+ return await DbSet
+ .WhereIf(ignoredId != null, ct => ct.Id != ignoredId)
+ .CountAsync(ct => ct.Name == name) > 0;
}
public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount)
@@ -28,10 +32,5 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
return identityClaimTypes;
}
-
- public async Task GetTotalCount()
- {
- return await DbSet.CountAsync();
- }
}
}
diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs
index 654848bb1b..c2bbd56a6d 100644
--- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs
+++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs
@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
+using MongoDB.Driver;
using MongoDB.Driver.Linq;
+using System.Linq;
+using System.Linq.Dynamic.Core;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.MongoDB;
@@ -15,23 +16,29 @@ namespace Volo.Abp.Identity.MongoDB
{
}
- public async Task DoesNameExist(string name, Guid? claimTypeId = null)
+ public async Task AnyAsync(string name, Guid? ignoredId = null)
{
- return GetMongoQueryable().WhereIf(claimTypeId != null, ct => ct.Id != claimTypeId).Count(ct => ct.Name == name) > 0;
+ if (ignoredId == null)
+ {
+ return await GetMongoQueryable()
+ .Where(ct => ct.Name == name)
+ .AnyAsync();
+ }
+ else
+ {
+ return await GetMongoQueryable()
+ .Where(ct => ct.Id != ignoredId && ct.Name == name)
+ .AnyAsync();
+ }
}
public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount)
{
- var identityClaimTypes = GetMongoQueryable().OrderBy(sorting ?? "name desc")
- .PageBy(skipCount, maxResultCount)
- .ToList();
-
- return identityClaimTypes;
- }
-
- public async Task GetTotalCount()
- {
- return await GetMongoQueryable().CountAsync();
+ return await GetMongoQueryable()
+ .OrderBy(sorting ?? nameof(IdentityClaimType.Name))
+ .As>()
+ .PageBy>(skipCount, maxResultCount)
+ .ToListAsync();
}
}
}
diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs
index c1f0518b49..fc0334ce05 100644
--- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs
+++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs
@@ -1,6 +1,5 @@
using System;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using NSubstitute;
using Shouldly;
@@ -12,16 +11,12 @@ namespace Volo.Abp.Identity
public class ProfileAppService_Tests : AbpIdentityApplicationTestBase
{
private readonly IProfileAppService _profileAppService;
- private readonly IIdentityUserRepository _userRepository;
- private readonly SignInManager _signInManager;
private readonly IdentityTestData _testData;
private ICurrentUser _currentUser;
public ProfileAppService_Tests()
{
_profileAppService = GetRequiredService();
- _userRepository = GetRequiredService();
- _signInManager = GetRequiredService>();
_testData = GetRequiredService();
}
diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs
index 56de1d5d5f..3250c0b04a 100644
--- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs
+++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs
@@ -28,11 +28,11 @@ namespace Volo.Abp.Identity
{
var claim = (await ClaimTypeRepository.GetListAsync()).FirstOrDefault();
- var result1 = await ClaimTypeRepository.DoesNameExist(claim.Name);
+ var result1 = await ClaimTypeRepository.AnyAsync(claim.Name);
result1.ShouldBe(true);
- var result2 = await ClaimTypeRepository.DoesNameExist(Guid.NewGuid().ToString());
+ var result2 = await ClaimTypeRepository.AnyAsync(Guid.NewGuid().ToString());
result2.ShouldBe(false);
}
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs
index fef31bdec5..c6c74ac24f 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResource.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using IdentityServer4;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities;
@@ -57,16 +58,27 @@ namespace Volo.Abp.IdentityServer.ApiResources
Secrets.Add(new ApiSecret(Id, value, expiration, type, description));
}
- public virtual void AddScope(
+ public virtual void RemoveSecret([NotNull] string value, string type = IdentityServerConstants.SecretTypes.SharedSecret)
+ {
+ Secrets.RemoveAll(s => s.Value == value && s.Type == type);
+ }
+
+ public virtual ApiSecret FindSecret([NotNull] string value, string type = IdentityServerConstants.SecretTypes.SharedSecret)
+ {
+ return Secrets.FirstOrDefault(s => s.Type == type && s.Value == value);
+ }
+
+ public virtual ApiScope AddScope(
[NotNull] string name,
string displayName = null,
string description = null,
bool required = false,
bool emphasize = false,
- bool showInDiscoveryDocument = true,
- ApiScopeClaim[] userClaims = null)
+ bool showInDiscoveryDocument = true)
{
- Scopes.Add(new ApiScope(Id, name, displayName, description, required, emphasize, showInDiscoveryDocument));
+ var scope = new ApiScope(Id, name, displayName, description, required, emphasize, showInDiscoveryDocument);
+ Scopes.Add(scope);
+ return scope;
}
public virtual void AddUserClaim([NotNull] string type)
@@ -79,6 +91,16 @@ namespace Volo.Abp.IdentityServer.ApiResources
UserClaims.Clear();
}
+ public virtual void RemoveClaim(string type)
+ {
+ UserClaims.RemoveAll(c => c.Type == type);
+ }
+
+ public virtual ApiResourceClaim FindClaim(string type)
+ {
+ return UserClaims.FirstOrDefault(c => c.Type == type);
+ }
+
public virtual void RemoveAllSecrets()
{
Secrets.Clear();
@@ -92,5 +114,15 @@ namespace Volo.Abp.IdentityServer.ApiResources
}
Scopes.Clear();
}
+
+ public virtual void RemoveScope(string name)
+ {
+ Scopes.RemoveAll(r => r.Name == name);
+ }
+
+ public virtual ApiScope FindScope(string name)
+ {
+ return Scopes.FirstOrDefault(r => r.Name == name);
+ }
}
}
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs
index 89fec1c017..e71d694656 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiResourceClaim.cs
@@ -9,7 +9,12 @@ namespace Volo.Abp.IdentityServer.ApiResources
protected ApiResourceClaim()
{
-
+
+ }
+
+ public virtual bool Equals(Guid apiResourceId, [NotNull] string type)
+ {
+ return ApiResourceId == apiResourceId && Type == type;
}
protected internal ApiResourceClaim(Guid apiResourceId, [NotNull] string type)
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs
index f96debb31a..e81dd849ec 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScope.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities;
@@ -26,7 +27,12 @@ namespace Volo.Abp.IdentityServer.ApiResources
protected ApiScope()
{
-
+
+ }
+
+ public virtual bool Equals(Guid apiResourceId, [NotNull] string name)
+ {
+ return ApiResourceId == apiResourceId && Name == name;
}
protected internal ApiScope(
@@ -61,6 +67,16 @@ namespace Volo.Abp.IdentityServer.ApiResources
UserClaims.Clear();
}
+ public virtual void RemoveClaim(string name, string type)
+ {
+ UserClaims.RemoveAll(r => r.Name == name && r.Type == type);
+ }
+
+ public virtual ApiScopeClaim FindClaim(string name, string type)
+ {
+ return UserClaims.FirstOrDefault(r => r.Name == name && r.Type == type);
+ }
+
public override object[] GetKeys()
{
return new object[] { ApiResourceId, Name };
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs
index 5c7dbdbe23..729ff9c344 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiScopeClaim.cs
@@ -15,6 +15,11 @@ namespace Volo.Abp.IdentityServer.ApiResources
}
+ public virtual bool Equals(Guid apiResourceId, [NotNull] string name, [NotNull] string type)
+ {
+ return ApiResourceId == apiResourceId && Name == name && Type == type;
+ }
+
protected internal ApiScopeClaim(Guid apiResourceId, [NotNull] string name, [NotNull] string type)
: base(type)
{
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecret.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecret.cs
index 41c4bc53c2..e692183a71 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecret.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ApiResources/ApiSecret.cs
@@ -10,7 +10,12 @@ namespace Volo.Abp.IdentityServer.ApiResources
protected ApiSecret()
{
-
+
+ }
+
+ public virtual bool Equals(Guid apiResourceId, [NotNull] string value, string type = IdentityServerConstants.SecretTypes.SharedSecret)
+ {
+ return ApiResourceId == apiResourceId && Value == value && Type == type;
}
protected internal ApiSecret(
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs
index cc2fae9900..f45926fb9a 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs
@@ -144,18 +144,19 @@ namespace Volo.Abp.IdentityServer.Clients
AllowedGrantTypes.Add(new ClientGrantType(Id, grantType));
}
- public virtual void AddGrantTypes(IEnumerable grantTypes)
+ public virtual void RemoveAllAllowedGrantTypes()
{
- AllowedGrantTypes.AddRange(
- grantTypes.Select(
- grantType => new ClientGrantType(Id, grantType)
- )
- );
+ AllowedGrantTypes.Clear();
}
- public virtual void RemoveAllAllowedGrantTypes()
+ public virtual void RemoveGrantType(string grantType)
{
- AllowedGrantTypes.Clear();
+ AllowedGrantTypes.RemoveAll(r => r.GrantType == grantType);
+ }
+
+ public virtual ClientGrantType FindGrantType(string grantType)
+ {
+ return AllowedGrantTypes.FirstOrDefault(r => r.GrantType == grantType);
}
public virtual void AddSecret([NotNull] string value, DateTime? expiration = null, string type = IdentityServerConstants.SecretTypes.SharedSecret, string description = null)
@@ -168,11 +169,6 @@ namespace Volo.Abp.IdentityServer.Clients
ClientSecrets.RemoveAll(s => s.Value == value && s.Type == type);
}
- public virtual void RemoveAllSecrets()
- {
- ClientSecrets.Clear();
- }
-
public virtual ClientSecret FindSecret([NotNull] string value, string type = IdentityServerConstants.SecretTypes.SharedSecret)
{
return ClientSecrets.FirstOrDefault(s => s.Type == type && s.Value == value);
@@ -188,6 +184,16 @@ namespace Volo.Abp.IdentityServer.Clients
AllowedScopes.Clear();
}
+ public virtual void RemoveScope(string scope)
+ {
+ AllowedScopes.RemoveAll(r => r.Scope == scope);
+ }
+
+ public virtual ClientScope FindScope(string scope)
+ {
+ return AllowedScopes.FirstOrDefault(r => r.Scope == scope);
+ }
+
public virtual void AddCorsOrigin([NotNull] string origin)
{
AllowedCorsOrigins.Add(new ClientCorsOrigin(Id, origin));
@@ -203,29 +209,49 @@ namespace Volo.Abp.IdentityServer.Clients
PostLogoutRedirectUris.Add(new ClientPostLogoutRedirectUri(Id, postLogoutRedirectUri));
}
- public virtual void RemoveAllCorsOrigin()
+ public virtual void RemoveAllCorsOrigins()
{
AllowedCorsOrigins.Clear();
}
- public virtual void RemoveAllRedirectUri()
+ public virtual void RemoveCorsOrigin(string uri)
+ {
+ AllowedCorsOrigins.RemoveAll(c => c.Origin == uri);
+ }
+
+ public virtual void RemoveAllRedirectUris()
{
RedirectUris.Clear();
}
- public virtual void RemoveAllPostLogoutRedirectUri()
+ public virtual void RemoveRedirectUri(string uri)
+ {
+ RedirectUris.RemoveAll(r => r.RedirectUri == uri);
+ }
+
+ public virtual void RemoveAllPostLogoutRedirectUris()
{
PostLogoutRedirectUris.Clear();
}
- public virtual void AddIdentityProviderRestriction([NotNull] string provider)
+ public virtual void RemovePostLogoutRedirectUri(string uri)
{
- IdentityProviderRestrictions.Add(new ClientIdPRestriction(Id, provider));
+ PostLogoutRedirectUris.RemoveAll(p => p.PostLogoutRedirectUri == uri);
}
- public virtual void RemoveAllIdentityProviderRestriction()
+ public virtual ClientCorsOrigin FindCorsOrigin(string uri)
{
- IdentityProviderRestrictions.Clear();
+ return AllowedCorsOrigins.FirstOrDefault(c => c.Origin == uri);
+ }
+
+ public virtual ClientRedirectUri FindRedirectUri(string uri)
+ {
+ return RedirectUris.FirstOrDefault(r => r.RedirectUri == uri);
+ }
+
+ public virtual ClientPostLogoutRedirectUri FindPostLogoutRedirectUri(string uri)
+ {
+ return PostLogoutRedirectUris.FirstOrDefault(p => p.PostLogoutRedirectUri == uri);
}
public virtual void AddProperty([NotNull] string key, [NotNull] string value)
@@ -238,14 +264,54 @@ namespace Volo.Abp.IdentityServer.Clients
Properties.Clear();
}
- public virtual void AddClaim(IGuidGenerator guidGenerator, [NotNull] string type, string value)
+ public virtual void RemoveProperty(string key, string value)
+ {
+ Properties.RemoveAll(c => c.Value == value && c.Key == key);
+ }
+
+ public virtual ClientProperty FindProperty(string key, string value)
+ {
+ return Properties.FirstOrDefault(c => c.Key == key && c.Value == value);
+ }
+
+ public virtual void AddClaim([NotNull] string value, string type)
{
- Claims.Add(new ClientClaim(guidGenerator.Create(), Id, type, value));
+ Claims.Add(new ClientClaim(Id, type, value));
}
public virtual void RemoveAllClaims()
{
Claims.Clear();
}
+
+ public virtual void RemoveClaim(string value, string type)
+ {
+ Claims.RemoveAll(c => c.Value == value && c.Type == type);
+ }
+
+ public virtual ClientClaim FindClaim(string value, string type)
+ {
+ return Claims.FirstOrDefault(c => c.Type == type && c.Value == value);
+ }
+
+ public virtual void AddIdentityProviderRestriction([NotNull] string provider)
+ {
+ IdentityProviderRestrictions.Add(new ClientIdPRestriction(Id, provider));
+ }
+
+ public virtual void RemoveAllIdentityProviderRestrictions()
+ {
+ IdentityProviderRestrictions.Clear();
+ }
+
+ public virtual void RemoveIdentityProviderRestriction(string provider)
+ {
+ IdentityProviderRestrictions.RemoveAll(r => r.Provider == provider);
+ }
+
+ public virtual ClientIdPRestriction FindIdentityProviderRestriction(string provider)
+ {
+ return IdentityProviderRestrictions.FirstOrDefault(r => r.Provider == provider);
+ }
}
}
\ No newline at end of file
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaim.cs
index 29b44a40f7..f0b35d772a 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaim.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientClaim.cs
@@ -4,7 +4,7 @@ using Volo.Abp.Domain.Entities;
namespace Volo.Abp.IdentityServer.Clients
{
- public class ClientClaim : Entity
+ public class ClientClaim : Entity
{
public virtual Guid ClientId { get; set; }
@@ -14,17 +14,26 @@ namespace Volo.Abp.IdentityServer.Clients
protected ClientClaim()
{
-
+
+ }
+
+ public virtual bool Equals(Guid clientId, string value, string type)
+ {
+ return ClientId == clientId && Type == type && Value == value;
}
- protected internal ClientClaim(Guid id, Guid clientId, [NotNull] string type, string value)
+ protected internal ClientClaim(Guid clientId, [NotNull] string type, string value)
{
Check.NotNull(type, nameof(type));
- Id = id;
ClientId = clientId;
Type = type;
Value = value;
}
+
+ public override object[] GetKeys()
+ {
+ return new object[] { ClientId, Type, Value };
+ }
}
}
\ No newline at end of file
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientCorsOrigin.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientCorsOrigin.cs
index c8177baee8..73f4b47637 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientCorsOrigin.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientCorsOrigin.cs
@@ -12,7 +12,12 @@ namespace Volo.Abp.IdentityServer.Clients
protected ClientCorsOrigin()
{
-
+
+ }
+
+ public virtual bool Equals(Guid clientId, [NotNull] string uri)
+ {
+ return ClientId == clientId && Origin == uri;
}
protected internal ClientCorsOrigin(Guid clientId, [NotNull] string origin)
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientGrantType.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientGrantType.cs
index ccbf0b666e..696ae1cd46 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientGrantType.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientGrantType.cs
@@ -15,6 +15,11 @@ namespace Volo.Abp.IdentityServer.Clients
}
+ public virtual bool Equals(Guid clientId, [NotNull] string grantType)
+ {
+ return ClientId == clientId && GrantType == grantType;
+ }
+
protected internal ClientGrantType(Guid clientId, [NotNull] string grantType)
{
Check.NotNull(grantType, nameof(grantType));
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientIdPRestriction.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientIdPRestriction.cs
index 00f1aa1020..aff16986c2 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientIdPRestriction.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientIdPRestriction.cs
@@ -15,6 +15,11 @@ namespace Volo.Abp.IdentityServer.Clients
}
+ public virtual bool Equals(Guid clientId, [NotNull] string provider)
+ {
+ return ClientId == clientId && Provider == provider;
+ }
+
protected internal ClientIdPRestriction(Guid clientId, [NotNull] string provider)
{
Check.NotNull(provider, nameof(provider));
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUri.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUri.cs
index 9042d54522..0e0ca17ae8 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUri.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUri.cs
@@ -15,6 +15,11 @@ namespace Volo.Abp.IdentityServer.Clients
}
+ public virtual bool Equals(Guid clientId, [NotNull] string uri)
+ {
+ return ClientId == clientId && PostLogoutRedirectUri == uri;
+ }
+
protected internal ClientPostLogoutRedirectUri(Guid clientId, [NotNull] string postLogoutRedirectUri)
{
Check.NotNull(postLogoutRedirectUri, nameof(postLogoutRedirectUri));
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs
index 31d131e762..daddd94e83 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientProperty.cs
@@ -17,6 +17,11 @@ namespace Volo.Abp.IdentityServer.Clients
}
+ public virtual bool Equals(Guid clientId, [NotNull] string key, string value)
+ {
+ return ClientId == clientId && Key == key && Value == value;
+ }
+
protected internal ClientProperty(Guid clientId, [NotNull] string key, [NotNull] string value)
{
Check.NotNull(key, nameof(key));
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientRedirectUri.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientRedirectUri.cs
index ff8a3edc05..89d461b58b 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientRedirectUri.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientRedirectUri.cs
@@ -15,6 +15,11 @@ namespace Volo.Abp.IdentityServer.Clients
}
+ public virtual bool Equals(Guid clientId, [NotNull] string uri)
+ {
+ return ClientId == clientId && RedirectUri == uri;
+ }
+
protected internal ClientRedirectUri(Guid clientId, [NotNull] string redirectUri)
{
Check.NotNull(redirectUri, nameof(redirectUri));
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientScope.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientScope.cs
index eb72ddf7cb..f94de116bb 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientScope.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientScope.cs
@@ -1,4 +1,5 @@
using System;
+using JetBrains.Annotations;
using Volo.Abp.Domain.Entities;
namespace Volo.Abp.IdentityServer.Clients
@@ -14,6 +15,11 @@ namespace Volo.Abp.IdentityServer.Clients
}
+ public virtual bool Equals(Guid clientId, [NotNull] string scope)
+ {
+ return ClientId == clientId && Scope == scope;
+ }
+
protected internal ClientScope(Guid clientId, string scope)
{
ClientId = clientId;
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceDataSeeder.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceDataSeeder.cs
new file mode 100644
index 0000000000..cd50765ec5
--- /dev/null
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceDataSeeder.cs
@@ -0,0 +1,9 @@
+using System.Threading.Tasks;
+
+namespace Volo.Abp.IdentityServer.IdentityResources
+{
+ public interface IIdentityResourceDataSeeder
+ {
+ Task CreateStandardResourcesAsync();
+ }
+}
\ No newline at end of file
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs
index 09eb9a762b..af53d12d38 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IIdentityResourceRepository.cs
@@ -22,11 +22,12 @@ namespace Volo.Abp.IdentityServer.IdentityResources
CancellationToken cancellationToken = default
);
- Task> GetListAsync(
- bool includeDetails = false,
+ Task FindByNameAsync(
+ string name,
+ bool includeDetails = true,
CancellationToken cancellationToken = default
);
- Task GetTotalCount();
+ Task GetTotalCountAsync();
}
}
\ No newline at end of file
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityClaim.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityClaim.cs
index 39453421ef..8b4a22b584 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityClaim.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityClaim.cs
@@ -9,7 +9,12 @@ namespace Volo.Abp.IdentityServer.IdentityResources
protected IdentityClaim()
{
-
+
+ }
+
+ public virtual bool Equals(Guid identityResourceId, [NotNull] string type)
+ {
+ return IdentityResourceId == identityResourceId && Type == type;
}
protected internal IdentityClaim(Guid identityResourceId, [NotNull] string type)
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs
index 37b259fe61..67c8e37a65 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResource.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities;
@@ -52,6 +53,19 @@ namespace Volo.Abp.IdentityServer.IdentityResources
UserClaims = new List();
}
+ public IdentityResource(Guid id, IdentityServer4.Models.IdentityResource resource)
+ {
+ Id = id;
+ Name = resource.Name;
+ DisplayName = resource.DisplayName;
+ Description = resource.Description;
+ Enabled = resource.Enabled;
+ Required = resource.Required;
+ Emphasize = resource.Emphasize;
+ ShowInDiscoveryDocument = resource.ShowInDiscoveryDocument;
+ UserClaims = resource.UserClaims.Select(claimType => new IdentityClaim(id, claimType)).ToList();
+ }
+
public virtual void AddUserClaim([NotNull] string type)
{
UserClaims.Add(new IdentityClaim(Id, type));
@@ -61,5 +75,15 @@ namespace Volo.Abp.IdentityServer.IdentityResources
{
UserClaims.Clear();
}
+
+ public virtual void RemoveUserClaim(string type)
+ {
+ UserClaims.RemoveAll(c => c.Type == type);
+ }
+
+ public virtual IdentityClaim FindUserClaim(string type)
+ {
+ return UserClaims.FirstOrDefault(c => c.Type == type);
+ }
}
}
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs
new file mode 100644
index 0000000000..a5c1e23861
--- /dev/null
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs
@@ -0,0 +1,77 @@
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Guids;
+using Volo.Abp.Identity;
+
+namespace Volo.Abp.IdentityServer.IdentityResources
+{
+ public class IdentityResourceDataSeeder : IIdentityResourceDataSeeder, ITransientDependency
+ {
+ protected IIdentityClaimTypeRepository ClaimTypeRepository { get; }
+ protected IIdentityResourceRepository IdentityResourceRepository { get; }
+ protected IGuidGenerator GuidGenerator { get; }
+
+ public IdentityResourceDataSeeder(
+ IIdentityResourceRepository identityResourceRepository,
+ IGuidGenerator guidGenerator,
+ IIdentityClaimTypeRepository claimTypeRepository)
+ {
+ IdentityResourceRepository = identityResourceRepository;
+ GuidGenerator = guidGenerator;
+ ClaimTypeRepository = claimTypeRepository;
+ }
+
+ public virtual async Task CreateStandardResourcesAsync()
+ {
+ var resources = new IdentityServer4.Models.IdentityResource[]
+ {
+ new IdentityServer4.Models.IdentityResources.OpenId(),
+ new IdentityServer4.Models.IdentityResources.Profile(),
+ new IdentityServer4.Models.IdentityResources.Email(),
+ new IdentityServer4.Models.IdentityResources.Address(),
+ new IdentityServer4.Models.IdentityResources.Phone()
+ };
+
+ foreach (var resource in resources)
+ {
+ foreach (var claimType in resource.UserClaims)
+ {
+ await AddClaimTypeIfNotExistsAsync(claimType);
+ }
+
+ await AddIdentityResourceIfNotExistsAsync(resource);
+ }
+ }
+
+ protected virtual async Task AddIdentityResourceIfNotExistsAsync(IdentityServer4.Models.IdentityResource resource)
+ {
+ if (await IdentityResourceRepository.FindByNameAsync(resource.Name) != null)
+ {
+ return;
+ }
+
+ await IdentityResourceRepository.InsertAsync(
+ new IdentityResource(
+ GuidGenerator.Create(),
+ resource
+ )
+ );
+ }
+
+ protected virtual async Task AddClaimTypeIfNotExistsAsync(string claimType)
+ {
+ if (await ClaimTypeRepository.AnyAsync(claimType))
+ {
+ return;
+ }
+
+ await ClaimTypeRepository.InsertAsync(
+ new IdentityClaimType(
+ GuidGenerator.Create(),
+ claimType,
+ isStatic: true
+ )
+ );
+ }
+ }
+}
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs
index 1234141229..bad674f435 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs
@@ -66,32 +66,6 @@ namespace Volo.Abp.IdentityServer.ApiResources
return await DbSet.CountAsync();
}
- public override async Task UpdateAsync(ApiResource entity, bool autoSave = false, CancellationToken cancellationToken = default)
- {
- var scopeClaims = DbContext.Set().Where(sc => sc.ApiResourceId == entity.Id);
-
- foreach (var scopeClaim in scopeClaims)
- {
- DbContext.Set().Remove(scopeClaim);
- }
-
- var scopes = DbContext.Set().Where(s => s.ApiResourceId == entity.Id);
-
- foreach (var scope in scopes)
- {
- DbContext.Set().Remove(scope);
- }
-
- var secrets = DbContext.Set().Where(s => s.ApiResourceId == entity.Id);
-
- foreach (var secret in secrets)
- {
- DbContext.Set().Remove(secret);
- }
-
- return await base.UpdateAsync(entity, autoSave, cancellationToken);
- }
-
public override async Task DeleteAsync(Guid id, bool autoSave = false, CancellationToken cancellationToken = default)
{
var scopeClaims = DbContext.Set().Where(sc => sc.ApiResourceId == id);
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs
index aee58475fe..62043562e8 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs
@@ -42,75 +42,6 @@ namespace Volo.Abp.IdentityServer.Clients
return await DbSet.CountAsync();
}
- //public override async Task UpdateAsync(Client entity, bool autoSave = false, CancellationToken cancellationToken = default)
- //{
-
- // var secrets = DbContext.Set().Where(s => s.ClientId == entity.Id);
-
- // foreach (var secret in secrets)
- // {
- // DbContext.Set().Remove(secret);
- // }
-
- // var claims = DbContext.Set().Where(s => s.ClientId == entity.Id);
-
- // foreach (var claim in claims)
- // {
- // DbContext.Set().Remove(claim);
- // }
-
- // var grantTypes = DbContext.Set().Where(s => s.ClientId == entity.Id);
-
- // foreach (var grantType in grantTypes)
- // {
- // DbContext.Set().Remove(grantType);
- // }
-
- // var restrictions = DbContext.Set().Where(s => s.ClientId == entity.Id);
-
- // foreach (var restriction in restrictions)
- // {
- // DbContext.Set().Remove(restriction);
- // }
-
- // var properties = DbContext.Set().Where(s => s.ClientId == entity.Id);
-
- // foreach (var clientProperty in properties)
- // {
- // DbContext.Set().Remove(clientProperty);
- // }
-
- // var scopes = DbContext.Set().Where(s => s.ClientId == entity.Id);
-
- // foreach (var scope in scopes)
- // {
- // DbContext.Set().Remove(scope);
- // }
-
- // var corsOrigins = DbContext.Set().Where(s => s.ClientId == entity.Id);
-
- // foreach (var corsOrigin in corsOrigins)
- // {
- // DbContext.Set().Remove(corsOrigin);
- // }
-
- // var redirectUris = DbContext.Set().Where(s => s.ClientId == entity.Id);
-
- // foreach (var redirectUri in redirectUris)
- // {
- // DbContext.Set().Remove(redirectUri);
- // }
-
- // var postLogoutRedirectUris = DbContext.Set().Where(s => s.ClientId == entity.Id);
-
- // foreach (var postLogoutRedirectUri in postLogoutRedirectUris)
- // {
- // DbContext.Set().Remove(postLogoutRedirectUri);
- // }
-
- // return await base.UpdateAsync(entity, autoSave, cancellationToken);
- //}
-
public override IQueryable WithDetails()
{
return GetQueryable().IncludeDetails();
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs
index efda009d68..3c38f2e2c7 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs
@@ -103,6 +103,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore
{
claim.ToTable(tablePrefix + "ClientClaims", schema);
+ claim.HasKey(x => new { x.ClientId, x.Type, x.Value });
+
claim.Property(x => x.Type).HasMaxLength(ClientClaimConsts.TypeMaxLength).IsRequired();
claim.Property(x => x.Value).HasMaxLength(ClientClaimConsts.ValueMaxLength).IsRequired();
});
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs
index deef97424f..a6ff62fc05 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs
@@ -31,15 +31,6 @@ namespace Volo.Abp.IdentityServer.IdentityResources
return await query.ToListAsync(GetCancellationToken(cancellationToken));
}
- public virtual async Task> GetListAsync(
- bool includeDetails = false,
- CancellationToken cancellationToken = default)
- {
- return await DbSet
- .IncludeDetails(includeDetails)
- .ToListAsync(GetCancellationToken(cancellationToken));
- }
-
public override IQueryable WithDetails()
{
return GetQueryable().IncludeDetails();
@@ -49,12 +40,24 @@ namespace Volo.Abp.IdentityServer.IdentityResources
bool includeDetails = false, CancellationToken cancellationToken = default)
{
return await DbSet
- .IncludeDetails(includeDetails).OrderBy(sorting ?? "name desc")
+ .IncludeDetails(includeDetails)
+ .OrderBy(sorting ?? "name desc")
.PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
- public virtual async Task GetTotalCount()
+ public async Task FindByNameAsync(
+ string name,
+ bool includeDetails = true,
+ CancellationToken cancellationToken = default)
+ {
+ return await DbSet
+ .IncludeDetails(includeDetails)
+ .Where(x => x.Name == name)
+ .FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
+ }
+
+ public virtual async Task GetTotalCountAsync()
{
return await DbSet.CountAsync();
}
diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs
index c5d4d7750f..85505c2987 100644
--- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs
+++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs
@@ -28,6 +28,16 @@ namespace Volo.Abp.IdentityServer.MongoDB
.ToListAsync(GetCancellationToken(cancellationToken));
}
+ public async Task FindByNameAsync(
+ string name,
+ bool includeDetails = true,
+ CancellationToken cancellationToken = default)
+ {
+ return await GetMongoQueryable()
+ .Where(x => x.Name == name)
+ .FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
+ }
+
public async Task> GetListByScopesAsync(string[] scopeNames, bool includeDetails = false,
CancellationToken cancellationToken = default)
{
@@ -36,7 +46,7 @@ namespace Volo.Abp.IdentityServer.MongoDB
.ToListAsync(GetCancellationToken(cancellationToken));
}
- public virtual async Task GetTotalCount()
+ public virtual async Task GetTotalCountAsync()
{
return await GetCountAsync();
}
diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestData.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestData.cs
new file mode 100644
index 0000000000..0392cc889d
--- /dev/null
+++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestData.cs
@@ -0,0 +1,14 @@
+using System;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.IdentityServer
+{
+ public class AbpIdentityServerTestData : ISingletonDependency
+ {
+ public Guid Client1Id { get; } = Guid.NewGuid();
+
+ public Guid ApiResource1Id { get; } = Guid.NewGuid();
+
+ public Guid IdentityResource1Id { get; } = Guid.NewGuid();
+ }
+}
diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs
index 472c23b7e2..f3db9821b8 100644
--- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs
+++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.DependencyInjection;
+using System.Collections.Generic;
+using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.IdentityServer.ApiResources;
using Volo.Abp.IdentityServer.Clients;
@@ -14,14 +15,17 @@ namespace Volo.Abp.IdentityServer
private readonly IClientRepository _clientRepository;
private readonly IIdentityResourceRepository _identityResourceRepository;
//private readonly IPersistentGrantRepository _persistentGrantRepository;
+ private readonly AbpIdentityServerTestData _testData;
public AbpIdentityServerTestDataBuilder(
IGuidGenerator guidGenerator,
IApiResourceRepository apiResourceRepository,
IClientRepository clientRepository,
- IIdentityResourceRepository identityResourceRepository
+ IIdentityResourceRepository identityResourceRepository,
+ AbpIdentityServerTestData testData
/*IPersistentGrantRepository persistentGrantRepository*/)
{
+ _testData = testData;
_guidGenerator = guidGenerator;
_apiResourceRepository = apiResourceRepository;
_clientRepository = clientRepository;
@@ -46,21 +50,42 @@ namespace Volo.Abp.IdentityServer
private void AddIdentityResources()
{
- _identityResourceRepository.Insert(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource1"));
+ _identityResourceRepository.Insert(new IdentityResource(_testData.IdentityResource1Id, "NewIdentityResource1"));
_identityResourceRepository.Insert(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource2"));
_identityResourceRepository.Insert(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource3"));
}
private void AddApiResources()
{
- _apiResourceRepository.Insert(new ApiResource(_guidGenerator.Create(), "NewApiResource1"));
+ _apiResourceRepository.Insert(new ApiResource(_testData.ApiResource1Id, "NewApiResource1"));
_apiResourceRepository.Insert(new ApiResource(_guidGenerator.Create(), "NewApiResource2"));
_apiResourceRepository.Insert(new ApiResource(_guidGenerator.Create(), "NewApiResource3"));
}
private void AddClients()
{
- _clientRepository.Insert(new Client(_guidGenerator.Create(), "ClientId1"));
+ var client = new Client(_testData.Client1Id, "ClientId1")
+ {
+ Description = nameof(Client.Description),
+ ClientName = nameof(Client.ClientName),
+ ClientUri = nameof(Client.ClientUri),
+ LogoUri = nameof(Client.LogoUri),
+ ProtocolType = nameof(Client.ProtocolType),
+ FrontChannelLogoutUri = nameof(Client.FrontChannelLogoutUri)
+ };
+
+ client.AddCorsOrigin(nameof(ClientCorsOrigin.Origin));
+ client.AddClaim(nameof(ClientClaim.Value), nameof(ClientClaim.Type));
+ client.AddGrantType(nameof(ClientGrantType.GrantType));
+ client.AddIdentityProviderRestriction(nameof(ClientIdPRestriction.Provider));
+ client.AddPostLogoutRedirectUri(nameof(ClientPostLogoutRedirectUri.PostLogoutRedirectUri));
+ client.AddProperty(nameof(ClientProperty.Key), nameof(ClientProperty.Value));
+ client.AddRedirectUri(nameof(ClientRedirectUri.RedirectUri));
+ client.AddScope(nameof(ClientScope.Scope));
+ client.AddSecret(nameof(ClientSecret.Value));
+
+ _clientRepository.Insert(client);
+
_clientRepository.Insert(new Client(_guidGenerator.Create(), "ClientId2"));
_clientRepository.Insert(new Client(_guidGenerator.Create(), "ClientId3"));
}
diff --git a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserSettingValueProvider.cs b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserSettingValueProvider.cs
index 8beba5d31e..345b0e6929 100644
--- a/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserSettingValueProvider.cs
+++ b/modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserSettingValueProvider.cs
@@ -22,27 +22,27 @@ namespace Volo.Abp.Users
public override async Task GetOrNullAsync(SettingDefinition setting, string providerKey)
{
- if (providerKey == null)
- {
- if (CurrentUser.Id == null)
- {
- return null;
- }
-
- providerKey = CurrentUser.Id.ToString();
- }
-
- return await SettingStore.GetOrNullAsync(setting.Name, Name, providerKey);
+ return await SettingStore.GetOrNullAsync(setting.Name, Name, NormalizeProviderKey(providerKey));
}
public override Task SetAsync(SettingDefinition setting, string value, string providerKey)
{
- return SettingStore.SetAsync(setting.Name, value, Name, providerKey);
+ return SettingStore.SetAsync(setting.Name, value, Name, NormalizeProviderKey(providerKey));
}
public override Task ClearAsync(SettingDefinition setting, string providerKey)
{
- return SettingStore.DeleteAsync(setting.Name, Name, providerKey);
+ return SettingStore.DeleteAsync(setting.Name, Name, NormalizeProviderKey(providerKey));
+ }
+
+ private string NormalizeProviderKey(string providerKey)
+ {
+ if (providerKey == null && CurrentUser.Id.HasValue)
+ {
+ return CurrentUser.Id.Value.ToString();
+ }
+
+ return providerKey;
}
}
}
\ No newline at end of file
diff --git a/nupkg/common.ps1 b/nupkg/common.ps1
index 3871b73a1e..e29ba634b9 100644
--- a/nupkg/common.ps1
+++ b/nupkg/common.ps1
@@ -62,7 +62,9 @@ $projects = (
"framework/src/Volo.Abp.HangFire",
"framework/src/Volo.Abp.Http",
"framework/src/Volo.Abp.Http.Abstractions",
- "framework/src/Volo.Abp.Http.Client",
+ "framework/src/Volo.Abp.Http.Client",
+ "framework/src/Volo.Abp.Http.Client.IdentityModel",
+ "framework/src/Volo.Abp.IdentityModel",
"framework/src/Volo.Abp.Json",
"framework/src/Volo.Abp.Localization",
"framework/src/Volo.Abp.Localization.Abstractions",
@@ -119,6 +121,7 @@ $projects = (
"modules/tenant-management/src/Volo.Abp.TenantManagement.Web",
# modules/identity
+ "modules/identity/src/Volo.Abp.Identity.AspNetCore",
"modules/identity/src/Volo.Abp.Identity.Application",
"modules/identity/src/Volo.Abp.Identity.Application.Contracts",
"modules/identity/src/Volo.Abp.Identity.Domain",
diff --git a/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj b/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj
index 85ac94b35c..3ee243de7b 100644
--- a/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj
+++ b/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj b/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj
index 3cd414eeec..525f8e7568 100644
--- a/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj
+++ b/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj
index aec9870017..a3bce1956f 100644
--- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj
+++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj
@@ -12,10 +12,10 @@
-
-
-
-
+
+
+
+
diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContext.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContext.cs
index 40e8a79dd0..ed7e9862ed 100644
--- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContext.cs
+++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreDbContext.cs
@@ -21,10 +21,6 @@ namespace Acme.BookStore.EntityFrameworkCore
{
base.OnModelCreating(modelBuilder);
- modelBuilder.Entity(
- b => b.ConfigureExtraProperties()
- );
-
modelBuilder.ConfigureIdentity();
modelBuilder.ConfigurePermissionManagement();
modelBuilder.ConfigureSettingManagement();
diff --git a/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj b/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj
index 21d3bd0ff6..969b152ef4 100644
--- a/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj
+++ b/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj
@@ -27,10 +27,10 @@
-
-
-
-
+
+
+
+
diff --git a/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj b/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj
index d9875549ff..ca55850f68 100644
--- a/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj
+++ b/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/samples/BookStore/test/Acme.BookStore.ConsoleApiClient/Acme.BookStore.ConsoleApiClient.csproj b/samples/BookStore/test/Acme.BookStore.ConsoleApiClient/Acme.BookStore.ConsoleApiClient.csproj
index 84d6d00e79..6df3ffa32d 100644
--- a/samples/BookStore/test/Acme.BookStore.ConsoleApiClient/Acme.BookStore.ConsoleApiClient.csproj
+++ b/samples/BookStore/test/Acme.BookStore.ConsoleApiClient/Acme.BookStore.ConsoleApiClient.csproj
@@ -6,8 +6,8 @@
-
-
+
+
diff --git a/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj b/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj
index 2db791b6bf..d4e9e1ee74 100644
--- a/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj
+++ b/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181218134206_Initial.Designer.cs b/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20190107113413_Initial.Designer.cs
similarity index 93%
rename from templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181218134206_Initial.Designer.cs
rename to templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20190107113413_Initial.Designer.cs
index 3ab0c0721f..8d0c81b5f8 100644
--- a/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181218134206_Initial.Designer.cs
+++ b/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20190107113413_Initial.Designer.cs
@@ -10,14 +10,14 @@ using MyCompanyName.MyProjectName.DemoApp;
namespace MyCompanyName.MyProjectName.DemoApp.Migrations
{
[DbContext(typeof(DemoAppDbContext))]
- [Migration("20181218134206_Initial")]
+ [Migration("20190107113413_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
+ .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
@@ -134,17 +134,19 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
- .IsRequired()
- .HasColumnName("ConcurrencyStamp")
- .HasMaxLength(256);
+ .HasColumnName("ConcurrencyStamp");
- b.Property("CreationTime");
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime");
- b.Property("CreatorId");
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId");
- b.Property("DeleterId");
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId");
- b.Property("DeletionTime");
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime");
b.Property("Email")
.HasColumnName("Email")
@@ -158,11 +160,16 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property("ExtraProperties")
.HasColumnName("ExtraProperties");
- b.Property("IsDeleted");
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasDefaultValue(false);
- b.Property("LastModificationTime");
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime");
- b.Property("LastModifierId");
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181218134206_Initial.cs b/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20190107113413_Initial.cs
similarity index 99%
rename from templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181218134206_Initial.cs
rename to templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20190107113413_Initial.cs
index cefa12dfaf..53361cc99e 100644
--- a/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20181218134206_Initial.cs
+++ b/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/20190107113413_Initial.cs
@@ -82,12 +82,12 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
{
Id = table.Column(nullable: false),
ExtraProperties = table.Column(nullable: true),
- ConcurrencyStamp = table.Column(maxLength: 256, nullable: false),
+ ConcurrencyStamp = table.Column(nullable: true),
CreationTime = table.Column(nullable: false),
CreatorId = table.Column(nullable: true),
LastModificationTime = table.Column(nullable: true),
LastModifierId = table.Column(nullable: true),
- IsDeleted = table.Column(nullable: false),
+ IsDeleted = table.Column(nullable: false, defaultValue: false),
DeleterId = table.Column(nullable: true),
DeletionTime = table.Column(nullable: true),
TenantId = table.Column(nullable: true),
@@ -158,9 +158,9 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
name: "AbpUserLogins",
columns: table => new
{
- TenantId = table.Column(nullable: true),
UserId = table.Column(nullable: false),
LoginProvider = table.Column(maxLength: 64, nullable: false),
+ TenantId = table.Column(nullable: true),
ProviderKey = table.Column(maxLength: 196, nullable: false),
ProviderDisplayName = table.Column(maxLength: 128, nullable: true)
},
@@ -179,9 +179,9 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
name: "AbpUserRoles",
columns: table => new
{
- TenantId = table.Column(nullable: true),
UserId = table.Column(nullable: false),
- RoleId = table.Column(nullable: false)
+ RoleId = table.Column(nullable: false),
+ TenantId = table.Column(nullable: true)
},
constraints: table =>
{
@@ -204,10 +204,10 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
name: "AbpUserTokens",
columns: table => new
{
- TenantId = table.Column(nullable: true),
UserId = table.Column(nullable: false),
LoginProvider = table.Column(maxLength: 64, nullable: false),
Name = table.Column(maxLength: 128, nullable: false),
+ TenantId = table.Column(nullable: true),
Value = table.Column(nullable: true)
},
constraints: table =>
diff --git a/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/DemoAppDbContextModelSnapshot.cs b/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/DemoAppDbContextModelSnapshot.cs
index b64a132e07..b3474a1d80 100644
--- a/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/DemoAppDbContextModelSnapshot.cs
+++ b/templates/module/app/MyCompanyName.MyProjectName.DemoApp/Migrations/DemoAppDbContextModelSnapshot.cs
@@ -15,7 +15,7 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
+ .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
@@ -132,17 +132,19 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
- .IsRequired()
- .HasColumnName("ConcurrencyStamp")
- .HasMaxLength(256);
+ .HasColumnName("ConcurrencyStamp");
- b.Property("CreationTime");
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime");
- b.Property("CreatorId");
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId");
- b.Property("DeleterId");
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId");
- b.Property("DeletionTime");
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime");
b.Property("Email")
.HasColumnName("Email")
@@ -156,11 +158,16 @@ namespace MyCompanyName.MyProjectName.DemoApp.Migrations
b.Property("ExtraProperties")
.HasColumnName("ExtraProperties");
- b.Property("IsDeleted");
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasDefaultValue(false);
- b.Property("LastModificationTime");
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime");
- b.Property("LastModifierId");
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/module/app/MyCompanyName.MyProjectName.DemoApp/MyCompanyName.MyProjectName.DemoApp.csproj b/templates/module/app/MyCompanyName.MyProjectName.DemoApp/MyCompanyName.MyProjectName.DemoApp.csproj
index f6ff852ca7..668f12ad1b 100644
--- a/templates/module/app/MyCompanyName.MyProjectName.DemoApp/MyCompanyName.MyProjectName.DemoApp.csproj
+++ b/templates/module/app/MyCompanyName.MyProjectName.DemoApp/MyCompanyName.MyProjectName.DemoApp.csproj
@@ -34,7 +34,7 @@
-
+
diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181218134025_Initial.Designer.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20190107113038_Initial.Designer.cs
similarity index 95%
rename from templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181218134025_Initial.Designer.cs
rename to templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20190107113038_Initial.Designer.cs
index 7821feff86..f39ddf1cc7 100644
--- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181218134025_Initial.Designer.cs
+++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20190107113038_Initial.Designer.cs
@@ -6,19 +6,18 @@ using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using MyCompanyName.MyProjectName.EntityFrameworkCore;
-using Volo.Abp.BackgroundJobs;
namespace MyCompanyName.MyProjectName.Migrations
{
[DbContext(typeof(MyProjectNameDbContext))]
- [Migration("20181218134025_Initial")]
+ [Migration("20190107113038_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
+ .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
@@ -367,17 +366,19 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
- .IsRequired()
- .HasColumnName("ConcurrencyStamp")
- .HasMaxLength(256);
+ .HasColumnName("ConcurrencyStamp");
- b.Property("CreationTime");
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime");
- b.Property("CreatorId");
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId");
- b.Property("DeleterId");
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId");
- b.Property("DeletionTime");
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime");
b.Property("Email")
.HasColumnName("Email")
@@ -391,11 +392,16 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property("ExtraProperties")
.HasColumnName("ExtraProperties");
- b.Property("IsDeleted");
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasDefaultValue(false);
- b.Property("LastModificationTime");
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime");
- b.Property("LastModifierId");
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181218134025_Initial.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20190107113038_Initial.cs
similarity index 99%
rename from templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181218134025_Initial.cs
rename to templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20190107113038_Initial.cs
index 1f76a505a8..72aba4d129 100644
--- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20181218134025_Initial.cs
+++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20190107113038_Initial.cs
@@ -131,12 +131,12 @@ namespace MyCompanyName.MyProjectName.Migrations
{
Id = table.Column(nullable: false),
ExtraProperties = table.Column(nullable: true),
- ConcurrencyStamp = table.Column(maxLength: 256, nullable: false),
+ ConcurrencyStamp = table.Column(nullable: true),
CreationTime = table.Column(nullable: false),
CreatorId = table.Column(nullable: true),
LastModificationTime = table.Column(nullable: true),
LastModifierId = table.Column(nullable: true),
- IsDeleted = table.Column(nullable: false),
+ IsDeleted = table.Column(nullable: false, defaultValue: false),
DeleterId = table.Column(nullable: true),
DeletionTime = table.Column(nullable: true),
TenantId = table.Column(nullable: true),
@@ -256,9 +256,9 @@ namespace MyCompanyName.MyProjectName.Migrations
name: "AbpUserLogins",
columns: table => new
{
- TenantId = table.Column(nullable: true),
UserId = table.Column(nullable: false),
LoginProvider = table.Column(maxLength: 64, nullable: false),
+ TenantId = table.Column(nullable: true),
ProviderKey = table.Column(maxLength: 196, nullable: false),
ProviderDisplayName = table.Column(maxLength: 128, nullable: true)
},
@@ -277,9 +277,9 @@ namespace MyCompanyName.MyProjectName.Migrations
name: "AbpUserRoles",
columns: table => new
{
- TenantId = table.Column(nullable: true),
UserId = table.Column(nullable: false),
- RoleId = table.Column(nullable: false)
+ RoleId = table.Column(nullable: false),
+ TenantId = table.Column(nullable: true)
},
constraints: table =>
{
@@ -302,10 +302,10 @@ namespace MyCompanyName.MyProjectName.Migrations
name: "AbpUserTokens",
columns: table => new
{
- TenantId = table.Column(nullable: true),
UserId = table.Column(nullable: false),
LoginProvider = table.Column(maxLength: 64, nullable: false),
Name = table.Column(maxLength: 128, nullable: false),
+ TenantId = table.Column(nullable: true),
Value = table.Column(nullable: true)
},
constraints: table =>
diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs
index 2ff93f8fde..a1e702f708 100644
--- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs
+++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs
@@ -5,7 +5,6 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using MyCompanyName.MyProjectName.EntityFrameworkCore;
-using Volo.Abp.BackgroundJobs;
namespace MyCompanyName.MyProjectName.Migrations
{
@@ -16,7 +15,7 @@ namespace MyCompanyName.MyProjectName.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
+ .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
@@ -365,17 +364,19 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
- .IsRequired()
- .HasColumnName("ConcurrencyStamp")
- .HasMaxLength(256);
+ .HasColumnName("ConcurrencyStamp");
- b.Property("CreationTime");
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime");
- b.Property("CreatorId");
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId");
- b.Property("DeleterId");
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId");
- b.Property("DeletionTime");
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime");
b.Property("Email")
.HasColumnName("Email")
@@ -389,11 +390,16 @@ namespace MyCompanyName.MyProjectName.Migrations
b.Property("ExtraProperties")
.HasColumnName("ExtraProperties");
- b.Property("IsDeleted");
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasDefaultValue(false);
- b.Property("LastModificationTime");
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime");
- b.Property("LastModifierId");
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj
index 4fa814320c..7788dcfdea 100644
--- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj
+++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj
@@ -9,6 +9,8 @@
+
+
diff --git a/templates/service/host/IdentityServerHost/IdentityServerHost.csproj b/templates/service/host/IdentityServerHost/IdentityServerHost.csproj
index 56c6a75b51..a41a8ffac5 100644
--- a/templates/service/host/IdentityServerHost/IdentityServerHost.csproj
+++ b/templates/service/host/IdentityServerHost/IdentityServerHost.csproj
@@ -27,6 +27,7 @@
+
diff --git a/templates/service/host/IdentityServerHost/Migrations/20181218135354_Initial.Designer.cs b/templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.Designer.cs
similarity index 96%
rename from templates/service/host/IdentityServerHost/Migrations/20181218135354_Initial.Designer.cs
rename to templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.Designer.cs
index 757aa9d169..1dd595dfd1 100644
--- a/templates/service/host/IdentityServerHost/Migrations/20181218135354_Initial.Designer.cs
+++ b/templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.Designer.cs
@@ -10,14 +10,14 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace IdentityServerHost.Migrations
{
[DbContext(typeof(DemoAppDbContext))]
- [Migration("20181218135354_Initial")]
+ [Migration("20190107114341_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
+ .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
@@ -134,17 +134,19 @@ namespace IdentityServerHost.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
- .IsRequired()
- .HasColumnName("ConcurrencyStamp")
- .HasMaxLength(256);
+ .HasColumnName("ConcurrencyStamp");
- b.Property("CreationTime");
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime");
- b.Property("CreatorId");
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId");
- b.Property("DeleterId");
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId");
- b.Property("DeletionTime");
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime");
b.Property("Email")
.HasColumnName("Email")
@@ -158,11 +160,16 @@ namespace IdentityServerHost.Migrations
b.Property("ExtraProperties")
.HasColumnName("ExtraProperties");
- b.Property("IsDeleted");
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasDefaultValue(false);
- b.Property("LastModificationTime");
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime");
- b.Property("LastModifierId");
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/service/host/IdentityServerHost/Migrations/20181218135354_Initial.cs b/templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.cs
similarity index 99%
rename from templates/service/host/IdentityServerHost/Migrations/20181218135354_Initial.cs
rename to templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.cs
index cab668b256..ddb2f14c1c 100644
--- a/templates/service/host/IdentityServerHost/Migrations/20181218135354_Initial.cs
+++ b/templates/service/host/IdentityServerHost/Migrations/20190107114341_Initial.cs
@@ -52,12 +52,12 @@ namespace IdentityServerHost.Migrations
{
Id = table.Column(nullable: false),
ExtraProperties = table.Column(nullable: true),
- ConcurrencyStamp = table.Column(maxLength: 256, nullable: false),
+ ConcurrencyStamp = table.Column(nullable: true),
CreationTime = table.Column(nullable: false),
CreatorId = table.Column(nullable: true),
LastModificationTime = table.Column(nullable: true),
LastModifierId = table.Column(nullable: true),
- IsDeleted = table.Column(nullable: false),
+ IsDeleted = table.Column(nullable: false, defaultValue: false),
DeleterId = table.Column(nullable: true),
DeletionTime = table.Column(nullable: true),
TenantId = table.Column(nullable: true),
@@ -170,10 +170,10 @@ namespace IdentityServerHost.Migrations
name: "IdentityServerPersistedGrants",
columns: table => new
{
+ Key = table.Column(maxLength: 200, nullable: false),
Id = table.Column(nullable: false),
ExtraProperties = table.Column(nullable: true),
ConcurrencyStamp = table.Column(nullable: true),
- Key = table.Column(maxLength: 200, nullable: false),
Type = table.Column(maxLength: 50, nullable: false),
SubjectId = table.Column(maxLength: 200, nullable: true),
ClientId = table.Column(maxLength: 200, nullable: false),
@@ -232,9 +232,9 @@ namespace IdentityServerHost.Migrations
name: "AbpUserLogins",
columns: table => new
{
- TenantId = table.Column(nullable: true),
UserId = table.Column(nullable: false),
LoginProvider = table.Column(maxLength: 64, nullable: false),
+ TenantId = table.Column(nullable: true),
ProviderKey = table.Column(maxLength: 196, nullable: false),
ProviderDisplayName = table.Column(maxLength: 128, nullable: true)
},
@@ -253,9 +253,9 @@ namespace IdentityServerHost.Migrations
name: "AbpUserRoles",
columns: table => new
{
- TenantId = table.Column(nullable: true),
UserId = table.Column(nullable: false),
- RoleId = table.Column(nullable: false)
+ RoleId = table.Column(nullable: false),
+ TenantId = table.Column(nullable: true)
},
constraints: table =>
{
@@ -278,10 +278,10 @@ namespace IdentityServerHost.Migrations
name: "AbpUserTokens",
columns: table => new
{
- TenantId = table.Column(nullable: true),
UserId = table.Column(nullable: false),
LoginProvider = table.Column(maxLength: 64, nullable: false),
Name = table.Column(maxLength: 128, nullable: false),
+ TenantId = table.Column(nullable: true),
Value = table.Column(nullable: true)
},
constraints: table =>
@@ -340,11 +340,11 @@ namespace IdentityServerHost.Migrations
name: "IdentityServerApiSecrets",
columns: table => new
{
- Expiration = table.Column(nullable: true),
Type = table.Column(maxLength: 32, nullable: false),
Value = table.Column(maxLength: 196, nullable: false),
+ ApiResourceId = table.Column(nullable: false),
Description = table.Column(maxLength: 256, nullable: true),
- ApiResourceId = table.Column(nullable: false)
+ Expiration = table.Column(nullable: true)
},
constraints: table =>
{
@@ -508,11 +508,11 @@ namespace IdentityServerHost.Migrations
name: "IdentityServerClientSecrets",
columns: table => new
{
- Expiration = table.Column(nullable: true),
Type = table.Column(maxLength: 32, nullable: false),
Value = table.Column(maxLength: 196, nullable: false),
+ ClientId = table.Column(nullable: false),
Description = table.Column(maxLength: 256, nullable: true),
- ClientId = table.Column(nullable: false)
+ Expiration = table.Column(nullable: true)
},
constraints: table =>
{
diff --git a/templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs b/templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs
index 8961166967..2a102778ee 100644
--- a/templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs
+++ b/templates/service/host/IdentityServerHost/Migrations/DemoAppDbContextModelSnapshot.cs
@@ -15,7 +15,7 @@ namespace IdentityServerHost.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
+ .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
@@ -132,17 +132,19 @@ namespace IdentityServerHost.Migrations
b.Property("ConcurrencyStamp")
.IsConcurrencyToken()
- .IsRequired()
- .HasColumnName("ConcurrencyStamp")
- .HasMaxLength(256);
+ .HasColumnName("ConcurrencyStamp");
- b.Property("CreationTime");
+ b.Property("CreationTime")
+ .HasColumnName("CreationTime");
- b.Property("CreatorId");
+ b.Property("CreatorId")
+ .HasColumnName("CreatorId");
- b.Property("DeleterId");
+ b.Property("DeleterId")
+ .HasColumnName("DeleterId");
- b.Property("DeletionTime");
+ b.Property("DeletionTime")
+ .HasColumnName("DeletionTime");
b.Property("Email")
.HasColumnName("Email")
@@ -156,11 +158,16 @@ namespace IdentityServerHost.Migrations
b.Property("ExtraProperties")
.HasColumnName("ExtraProperties");
- b.Property("IsDeleted");
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("IsDeleted")
+ .HasDefaultValue(false);
- b.Property("LastModificationTime");
+ b.Property("LastModificationTime")
+ .HasColumnName("LastModificationTime");
- b.Property("LastModifierId");
+ b.Property("LastModifierId")
+ .HasColumnName("LastModifierId");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/DemoAppDbContext.cs b/templates/service/host/MyCompanyName.MyProjectName.Host/DemoAppDbContext.cs
index 80740f67f6..1b3540e00b 100644
--- a/templates/service/host/MyCompanyName.MyProjectName.Host/DemoAppDbContext.cs
+++ b/templates/service/host/MyCompanyName.MyProjectName.Host/DemoAppDbContext.cs
@@ -12,7 +12,7 @@ namespace MyCompanyName.MyProjectName.Host
public DemoAppDbContext(DbContextOptions options)
: base(options)
{
-
+
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/Logs/logs.txt b/templates/service/host/MyCompanyName.MyProjectName.Host/Logs/logs.txt
index 9e865a4b7d..7cef254f44 100644
--- a/templates/service/host/MyCompanyName.MyProjectName.Host/Logs/logs.txt
+++ b/templates/service/host/MyCompanyName.MyProjectName.Host/Logs/logs.txt
@@ -135,3 +135,209 @@
2018-10-30 18:17:38.171 +03:00 [INF] Request finished in 8.1569ms 200 text/html
2018-10-30 18:17:38.401 +03:00 [INF] Request starting HTTP/1.1 GET http://localhost:57992/swagger/v1/swagger.json
2018-10-30 18:17:38.581 +03:00 [INF] Request finished in 179.8033ms 200 application/json
+2019-01-07 14:46:19.756 +03:00 [INF] Starting web host.
+2019-01-07 14:46:21.104 +03:00 [INF] User profile is available. Using 'C:\Users\halil\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
+2019-01-07 14:46:21.168 +03:00 [INF] Loaded modules:
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Castle.AbpCastleCoreModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Autofac.AbpAutofacModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Localization.AbpLocalizationAbstractionsModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Security.AbpSecurityModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Settings.AbpSettingsModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Localization.AbpLocalizationModule
+2019-01-07 14:46:21.168 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameDomainSharedModule
+2019-01-07 14:46:21.168 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameDomainModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Data.AbpDataModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Timing.AbpTimingModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Json.AbpJsonModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Threading.AbpThreadingModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.MultiTenancy.AbpMultiTenancyAbstractionsModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Auditing.AbpAuditingModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.EventBus.AbpEventBusModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Guids.AbpGuidsModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Uow.AbpUnitOfWorkModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.ObjectMapping.AbpObjectMappingModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Domain.AbpDddDomainModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Validation.AbpValidationModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Authorization.AbpAuthorizationModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Http.AbpHttpAbstractionsModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.Application.AbpDddApplicationModule
+2019-01-07 14:46:21.168 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameApplicationContractsModule
+2019-01-07 14:46:21.168 +03:00 [INF] - Volo.Abp.AutoMapper.AbpAutoMapperModule
+2019-01-07 14:46:21.168 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameApplicationModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule
+2019-01-07 14:46:21.169 +03:00 [INF] - MyCompanyName.MyProjectName.EntityFrameworkCore.MyProjectNameEntityFrameworkCoreModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.Http.AbpHttpModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.UI.AbpUiModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.AspNetCore.AbpAspNetCoreModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.ApiVersioning.AbpApiVersioningAbstractionsModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule
+2019-01-07 14:46:21.169 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameHttpApiModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementDomainSharedModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.Serialization.AbpSerializationModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.Caching.AbpCachingModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementDomainModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.PermissionManagement.EntityFrameworkCore.AbpPermissionManagementEntityFrameworkCoreModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementDomainSharedModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementDomainModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.SettingManagement.EntityFrameworkCore.AbpSettingManagementEntityFrameworkCoreModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.AuditLogging.AbpAuditLoggingDomainSharedModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.AuditLogging.AbpAuditLoggingDomainModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.AuditLogging.EntityFrameworkCore.AbpAuditLoggingEntityFrameworkCoreModule
+2019-01-07 14:46:21.169 +03:00 [INF] - Volo.Abp.EntityFrameworkCore.SqlServer.AbpEntityFrameworkCoreSqlServerModule
+2019-01-07 14:46:21.169 +03:00 [INF] - MyCompanyName.MyProjectName.Host.DemoAppModule
+2019-01-07 14:46:21.213 +03:00 [DBG] No class found with auto mapping attributes.
+2019-01-07 14:46:21.668 +03:00 [FTL] Application startup exception
+System.Data.SqlClient.SqlException (0x80131904): Cannot open database "MyProjectNameCache" requested by the login. The login failed.
+Login failed for user 'MicrosoftAccount\halilibrahimkalkan@outlook.com'.
+ at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken)
+ at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
+ at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
+ at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
+ at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
+ at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
+ at System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
+--- End of stack trace from previous location where exception was thrown ---
+ at Microsoft.Extensions.Caching.SqlServer.DatabaseOperations.GetCacheItemAsync(String key, Boolean includeValue, CancellationToken token)
+ at Microsoft.Extensions.Caching.SqlServer.DatabaseOperations.GetCacheItemAsync(String key, CancellationToken token)
+ at Microsoft.Extensions.Caching.SqlServer.SqlServerCache.GetAsync(String key, CancellationToken token)
+ at Volo.Abp.Caching.DistributedCache`1.GetAsync(String key, CancellationToken token) in D:\Github\abp\framework\src\Volo.Abp.Caching\Volo\Abp\Caching\DistributedCache.cs:line 57
+ at Volo.Abp.SettingManagement.SettingStore.GetCacheItemAsync(String name, String providerName, String providerKey) in D:\Github\abp\modules\setting-management\src\Volo.Abp.SettingManagement.Domain\Volo\Abp\SettingManagement\SettingStore.cs:line 66
+ at Volo.Abp.SettingManagement.SettingStore.GetOrNullAsync(String name, String providerName, String providerKey) in D:\Github\abp\modules\setting-management\src\Volo.Abp.SettingManagement.Domain\Volo\Abp\SettingManagement\SettingStore.cs:line 29
+ at Volo.Abp.Settings.SettingManager.GetOrNullValueFromProvidersAsync(String providerKey, IEnumerable`1 providers, SettingDefinition setting) in D:\Github\abp\framework\src\Volo.Abp.Settings\Volo\Abp\Settings\SettingManager.cs:line 217
+ at Volo.Abp.Settings.SettingManager.GetOrNullInternalAsync(String name, String providerName, String providerKey, Boolean fallback) in D:\Github\abp\framework\src\Volo.Abp.Settings\Volo\Abp\Settings\SettingManager.cs:line 201
+ at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
+ at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
+ at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
+--- End of stack trace from previous location where exception was thrown ---
+ at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
+--- End of stack trace from previous location where exception was thrown ---
+ at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
+ at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
+ at Volo.Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func) in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\Threading\AsyncHelper.cs:line 60
+ at Volo.Abp.Settings.SettingManagerSyncExtensions.GetOrNull(ISettingManager settingManager, String name) in D:\Github\abp\framework\src\Volo.Abp.Settings\Volo\Abp\Settings\SettingManagerSyncExtensions.cs:line 13
+ at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.UseAbpRequestLocalization(IApplicationBuilder app) in D:\Github\abp\framework\src\Volo.Abp.AspNetCore\Microsoft\AspNetCore\Builder\AbpApplicationBuilderExtensions.cs:line 54
+ at MyCompanyName.MyProjectName.Host.DemoAppModule.OnApplicationInitialization(ApplicationInitializationContext context) in D:\Github\abp\templates\service\host\MyCompanyName.MyProjectName.Host\DemoAppModule.cs:line 109
+ at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module) in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\Modularity\DefaultModuleLifecycleContributor.cs:line 7
+ at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context) in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\Modularity\ModuleManager.cs:line 41
+ at Volo.Abp.AbpApplicationBase.InitializeModules() in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationBase.cs:line 72
+ at Volo.Abp.AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider) in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationWithExternalServiceProvider.cs:line 27
+ at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplication(IApplicationBuilder app) in D:\Github\abp\framework\src\Volo.Abp.AspNetCore\Microsoft\AspNetCore\Builder\AbpApplicationBuilderExtensions.cs:line 27
+ at MyCompanyName.MyProjectName.Host.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in D:\Github\abp\templates\service\host\MyCompanyName.MyProjectName.Host\Startup.cs:line 24
+--- End of stack trace from previous location where exception was thrown ---
+ at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
+ at Microsoft.AspNetCore.Mvc.Internal.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
+ at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass4_0.b__0(IApplicationBuilder app)
+ at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder builder)
+ at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
+ClientConnectionId:f4f9905c-c66c-41ee-8497-649f2e111e03
+Error Number:4060,State:1,Class:11
+2019-01-07 14:46:22.022 +03:00 [INF] Request starting HTTP/1.1 GET http://localhost:57992/
+2019-01-07 14:46:22.061 +03:00 [INF] Request finished in 39.0742ms 500 text/html; charset=utf-8
+2019-01-07 14:46:39.070 +03:00 [INF] Request starting HTTP/1.1 GET http://localhost:57992/
+2019-01-07 14:46:39.085 +03:00 [INF] Request finished in 14.9782ms 500 text/html; charset=utf-8
+2019-01-07 14:46:48.817 +03:00 [INF] Request starting HTTP/1.1 GET http://localhost:57992/
+2019-01-07 14:46:48.855 +03:00 [INF] Request finished in 38.2239ms 500 text/html; charset=utf-8
+2019-01-07 14:47:42.990 +03:00 [INF] Starting web host.
+2019-01-07 14:47:44.287 +03:00 [INF] User profile is available. Using 'C:\Users\halil\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
+2019-01-07 14:47:44.347 +03:00 [INF] Loaded modules:
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Castle.AbpCastleCoreModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Autofac.AbpAutofacModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Localization.AbpLocalizationAbstractionsModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Security.AbpSecurityModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Settings.AbpSettingsModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Localization.AbpLocalizationModule
+2019-01-07 14:47:44.347 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameDomainSharedModule
+2019-01-07 14:47:44.347 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameDomainModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Data.AbpDataModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Timing.AbpTimingModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Json.AbpJsonModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Threading.AbpThreadingModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.MultiTenancy.AbpMultiTenancyAbstractionsModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Auditing.AbpAuditingModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.EventBus.AbpEventBusModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Guids.AbpGuidsModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Uow.AbpUnitOfWorkModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.ObjectMapping.AbpObjectMappingModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Domain.AbpDddDomainModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Validation.AbpValidationModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Authorization.AbpAuthorizationModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Http.AbpHttpAbstractionsModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Application.AbpDddApplicationModule
+2019-01-07 14:47:44.347 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameApplicationContractsModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.AutoMapper.AbpAutoMapperModule
+2019-01-07 14:47:44.347 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameApplicationModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule
+2019-01-07 14:47:44.347 +03:00 [INF] - MyCompanyName.MyProjectName.EntityFrameworkCore.MyProjectNameEntityFrameworkCoreModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Http.AbpHttpModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.UI.AbpUiModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.AspNetCore.AbpAspNetCoreModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.ApiVersioning.AbpApiVersioningAbstractionsModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule
+2019-01-07 14:47:44.347 +03:00 [INF] - MyCompanyName.MyProjectName.MyProjectNameHttpApiModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementDomainSharedModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Serialization.AbpSerializationModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.Caching.AbpCachingModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementDomainModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.PermissionManagement.EntityFrameworkCore.AbpPermissionManagementEntityFrameworkCoreModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementDomainSharedModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementDomainModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.SettingManagement.EntityFrameworkCore.AbpSettingManagementEntityFrameworkCoreModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.AuditLogging.AbpAuditLoggingDomainSharedModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.AuditLogging.AbpAuditLoggingDomainModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.AuditLogging.EntityFrameworkCore.AbpAuditLoggingEntityFrameworkCoreModule
+2019-01-07 14:47:44.347 +03:00 [INF] - Volo.Abp.EntityFrameworkCore.SqlServer.AbpEntityFrameworkCoreSqlServerModule
+2019-01-07 14:47:44.347 +03:00 [INF] - MyCompanyName.MyProjectName.Host.DemoAppModule
+2019-01-07 14:47:44.390 +03:00 [DBG] No class found with auto mapping attributes.
+2019-01-07 14:47:44.806 +03:00 [FTL] Application startup exception
+System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'dbo.TestCache'.
+ at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
+ at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
+ at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
+ at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
+ at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
+ at System.Data.SqlClient.SqlDataReader.get_MetaData()
+ at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
+ at System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader()
+ at System.Data.SqlClient.SqlCommand.InternalEndExecuteReader(IAsyncResult asyncResult, String endMethod)
+ at System.Data.SqlClient.SqlCommand.EndExecuteReaderInternal(IAsyncResult asyncResult)
+ at System.Data.SqlClient.SqlCommand.EndExecuteReader(IAsyncResult asyncResult)
+ at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
+--- End of stack trace from previous location where exception was thrown ---
+ at Microsoft.Extensions.Caching.SqlServer.DatabaseOperations.GetCacheItemAsync(String key, Boolean includeValue, CancellationToken token)
+ at Microsoft.Extensions.Caching.SqlServer.DatabaseOperations.GetCacheItemAsync(String key, CancellationToken token)
+ at Microsoft.Extensions.Caching.SqlServer.SqlServerCache.GetAsync(String key, CancellationToken token)
+ at Volo.Abp.Caching.DistributedCache`1.GetAsync(String key, CancellationToken token) in D:\Github\abp\framework\src\Volo.Abp.Caching\Volo\Abp\Caching\DistributedCache.cs:line 57
+ at Volo.Abp.SettingManagement.SettingStore.GetCacheItemAsync(String name, String providerName, String providerKey) in D:\Github\abp\modules\setting-management\src\Volo.Abp.SettingManagement.Domain\Volo\Abp\SettingManagement\SettingStore.cs:line 66
+ at Volo.Abp.SettingManagement.SettingStore.GetOrNullAsync(String name, String providerName, String providerKey) in D:\Github\abp\modules\setting-management\src\Volo.Abp.SettingManagement.Domain\Volo\Abp\SettingManagement\SettingStore.cs:line 29
+ at Volo.Abp.Settings.SettingManager.GetOrNullValueFromProvidersAsync(String providerKey, IEnumerable`1 providers, SettingDefinition setting) in D:\Github\abp\framework\src\Volo.Abp.Settings\Volo\Abp\Settings\SettingManager.cs:line 217
+ at Volo.Abp.Settings.SettingManager.GetOrNullInternalAsync(String name, String providerName, String providerKey, Boolean fallback) in D:\Github\abp\framework\src\Volo.Abp.Settings\Volo\Abp\Settings\SettingManager.cs:line 201
+ at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
+ at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
+ at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
+--- End of stack trace from previous location where exception was thrown ---
+ at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
+--- End of stack trace from previous location where exception was thrown ---
+ at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
+ at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
+ at Volo.Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func) in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\Threading\AsyncHelper.cs:line 60
+ at Volo.Abp.Settings.SettingManagerSyncExtensions.GetOrNull(ISettingManager settingManager, String name) in D:\Github\abp\framework\src\Volo.Abp.Settings\Volo\Abp\Settings\SettingManagerSyncExtensions.cs:line 13
+ at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.UseAbpRequestLocalization(IApplicationBuilder app) in D:\Github\abp\framework\src\Volo.Abp.AspNetCore\Microsoft\AspNetCore\Builder\AbpApplicationBuilderExtensions.cs:line 54
+ at MyCompanyName.MyProjectName.Host.DemoAppModule.OnApplicationInitialization(ApplicationInitializationContext context) in D:\Github\abp\templates\service\host\MyCompanyName.MyProjectName.Host\DemoAppModule.cs:line 109
+ at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module) in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\Modularity\DefaultModuleLifecycleContributor.cs:line 7
+ at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context) in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\Modularity\ModuleManager.cs:line 41
+ at Volo.Abp.AbpApplicationBase.InitializeModules() in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationBase.cs:line 72
+ at Volo.Abp.AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider) in D:\Github\abp\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationWithExternalServiceProvider.cs:line 27
+ at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplication(IApplicationBuilder app) in D:\Github\abp\framework\src\Volo.Abp.AspNetCore\Microsoft\AspNetCore\Builder\AbpApplicationBuilderExtensions.cs:line 27
+ at MyCompanyName.MyProjectName.Host.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in D:\Github\abp\templates\service\host\MyCompanyName.MyProjectName.Host\Startup.cs:line 24
+--- End of stack trace from previous location where exception was thrown ---
+ at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
+ at Microsoft.AspNetCore.Mvc.Internal.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
+ at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass4_0.b__0(IApplicationBuilder app)
+ at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder builder)
+ at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
+ClientConnectionId:d28745af-08b1-4111-a089-3f46c995c65d
+Error Number:208,State:1,Class:16
+2019-01-07 14:47:44.964 +03:00 [INF] Request starting HTTP/1.1 GET http://localhost:57992/
+2019-01-07 14:47:44.998 +03:00 [INF] Request finished in 33.8928ms 500 text/html; charset=utf-8
diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181218135310_Initial.Designer.cs b/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190107114531_Initial.Designer.cs
similarity index 98%
rename from templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181218135310_Initial.Designer.cs
rename to templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190107114531_Initial.Designer.cs
index 67977b2f6a..600c904f2b 100644
--- a/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181218135310_Initial.Designer.cs
+++ b/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190107114531_Initial.Designer.cs
@@ -10,14 +10,14 @@ using MyCompanyName.MyProjectName.Host;
namespace MyCompanyName.MyProjectName.Host.Migrations
{
[DbContext(typeof(DemoAppDbContext))]
- [Migration("20181218135310_Initial")]
+ [Migration("20190107114531_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
+ .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181218135310_Initial.cs b/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190107114531_Initial.cs
similarity index 100%
rename from templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20181218135310_Initial.cs
rename to templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/20190107114531_Initial.cs
diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/DemoAppDbContextModelSnapshot.cs b/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/DemoAppDbContextModelSnapshot.cs
index c5e59b55fd..70e88b9973 100644
--- a/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/DemoAppDbContextModelSnapshot.cs
+++ b/templates/service/host/MyCompanyName.MyProjectName.Host/Migrations/DemoAppDbContextModelSnapshot.cs
@@ -15,7 +15,7 @@ namespace MyCompanyName.MyProjectName.Host.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
+ .HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
diff --git a/templates/service/host/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj b/templates/service/host/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj
index f3e3056f84..b034148995 100644
--- a/templates/service/host/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj
+++ b/templates/service/host/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj
@@ -32,6 +32,7 @@
+