\ No newline at end of file
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs
new file mode 100644
index 0000000000..8c5440e747
--- /dev/null
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Claims;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Components;
+using Volo.Abp.AspNetCore.Components.WebAssembly;
+
+namespace MyCompanyName.MyProjectName.Blazor.Pages
+{
+ public partial class Index
+ {
+ private IEnumerable _claims;
+
+ protected override async Task OnInitializedAsync()
+ {
+ var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
+ if ( authState.User.Identity.IsAuthenticated )
+ {
+ _claims = authState.User.Claims;
+ }
+ }
+
+ Task OnInfoTestClicked()
+ {
+ return UiMessageService.InfoAsync( "This is the Info message", "Info" );
+ }
+
+ Task OnSuccessTestClicked()
+ {
+ return UiMessageService.SuccessAsync( "This is the Success message", "Success" );
+ }
+
+ Task OnWarningTestClicked()
+ {
+ return UiMessageService.WarnAsync( "This is the Warning message", "Warning" );
+ }
+
+ Task OnErrorTestClicked()
+ {
+ return UiMessageService.ErrorAsync( "This is the Error message", "Error" );
+ }
+
+ Task OnConfirmTestClicked()
+ {
+ return UiMessageService.ConfirmAsync( "This is the Confirm message", "Confirm" )
+ .ContinueWith( result =>
+ {
+ if ( result.Result )
+ {
+ Console.WriteLine( "Confirmed" );
+ }
+ else
+ {
+ Console.WriteLine( "Cancelled" );
+ }
+ } );
+ }
+
+ [Inject] IUiMessageService UiMessageService { get; set; }
+ }
+}
From 38c3579d29dcd638ae2914286b46bf0c9fd325f6 Mon Sep 17 00:00:00 2001
From: Mladen Macanovic
Date: Tue, 6 Oct 2020 11:41:29 +0200
Subject: [PATCH 027/108] Fixed message icon styles
---
.../Components/UiMessageAlert.razor.cs | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
index dadab8135b..4d543174e0 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
@@ -9,8 +9,6 @@ namespace Volo.Abp.BlazoriseUI.Components
{
public partial class UiMessageAlert : ComponentBase, IDisposable
{
- private object messageIcon;
-
protected override void OnInitialized()
{
UiMessageNotifierService.MessageReceived += OnMessageReceived;
@@ -80,18 +78,18 @@ namespace Volo.Abp.BlazoriseUI.Components
UiMessageType.Info => IconName.Info,
UiMessageType.Success => IconName.Check,
UiMessageType.Warning => IconName.Exclamation,
- UiMessageType.Error => IconName.Stop,
+ UiMessageType.Error => IconName.Times,
UiMessageType.Confirmation => IconName.QuestionCircle,
_ => null,
};
protected virtual string MessageIconColor => MessageType switch
{
- UiMessageType.Info => "#0000ff",
- UiMessageType.Success => "#00ff00",
- UiMessageType.Warning => "#ffae00",
- UiMessageType.Error => "#e8301c",
- UiMessageType.Confirmation => "#de692f",
+ UiMessageType.Info => "var(--b-theme-info, var(--info, #17a2b8))",
+ UiMessageType.Success => "var(--b-theme-success, var(--success, #28a745))",
+ UiMessageType.Warning => "var(--b-theme-warning, var(--warning, #ffc107))",
+ UiMessageType.Error => "var(--b-theme-danger, var(--danger, #dc3545))",
+ UiMessageType.Confirmation => "var(--b-theme-secondary, var(--secondary, #6c757d))",
_ => null,
};
From 7519d6fc7e9be0dd22d1aa988bf9bb51cd99eb62 Mon Sep 17 00:00:00 2001
From: parag
Date: Tue, 6 Oct 2020 15:59:17 +0530
Subject: [PATCH 028/108] Update Entity-Framework-Core-SQLite.md
---
docs/en/Entity-Framework-Core-SQLite.md | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/docs/en/Entity-Framework-Core-SQLite.md b/docs/en/Entity-Framework-Core-SQLite.md
index 62a8ef815d..2a13bf530c 100644
--- a/docs/en/Entity-Framework-Core-SQLite.md
+++ b/docs/en/Entity-Framework-Core-SQLite.md
@@ -23,6 +23,16 @@ Find `UseSqlServer()` calls in your solution, replace with `UseSqlite()`. Check
SQLite connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com]( https://www.connectionstrings.com/sqlite/ ) for details of SQLite connection string options.
+An example connection string is
+
+```
+{
+ "ConnectionStrings": {
+ "Default": "Filename=./MySQLiteDBFile.sqlite"
+ }
+}
+```
+
You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure.
## Re-Generate the Migrations
@@ -38,4 +48,4 @@ Run the `.DbMigrator` project to create the database and seed the initial data.
## Run the Application
-It is ready. Just run the application and enjoy coding.
\ No newline at end of file
+It is ready. Just run the application and enjoy coding.
From 7bceb03e24e8079f90155851b4f949008fc4edcc Mon Sep 17 00:00:00 2001
From: bnymncoskuner
Date: Fri, 2 Oct 2020 17:19:18 +0300
Subject: [PATCH 029/108] feat: redirect instead of new tab on manageProfile
---
.../packages/account/src/lib/guards/manage-profile.guard.ts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/npm/ng-packs/packages/account/src/lib/guards/manage-profile.guard.ts b/npm/ng-packs/packages/account/src/lib/guards/manage-profile.guard.ts
index ca840bd913..2770fa24bd 100644
--- a/npm/ng-packs/packages/account/src/lib/guards/manage-profile.guard.ts
+++ b/npm/ng-packs/packages/account/src/lib/guards/manage-profile.guard.ts
@@ -9,7 +9,9 @@ export class ManageProfileGuard implements CanActivate {
canActivate(_: ActivatedRouteSnapshot, __: RouterStateSnapshot) {
const env = this.configState.getEnvironment();
if (env.oAuthConfig.responseType === 'code') {
- window.open(`${env.oAuthConfig.issuer}/Account/Manage`, '_blank');
+ window.location.replace(
+ `${env.oAuthConfig.issuer}/Account/Manage?returnUrl=${window.location.href}`,
+ );
return false;
} else {
return true;
From bc8e0ea8ad37759ea3e3e2ebb60bdef75b49a911 Mon Sep 17 00:00:00 2001
From: maliming <6908465+maliming@users.noreply.github.com>
Date: Tue, 6 Oct 2020 21:33:44 +0800
Subject: [PATCH 030/108] Update Application-Services.md
---
docs/en/Best-Practices/Application-Services.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/docs/en/Best-Practices/Application-Services.md b/docs/en/Best-Practices/Application-Services.md
index 3332ce08ea..b14770d654 100644
--- a/docs/en/Best-Practices/Application-Services.md
+++ b/docs/en/Best-Practices/Application-Services.md
@@ -213,6 +213,12 @@ This method votes a question and returns the current score of the question.
* **Do** always get all the related entities from repositories to perform the operations on them.
* **Do** call repository's Update/UpdateAsync method after updating an entity. Because, not all database APIs support change tracking & auto update.
+#### Handle files
+
+* **Do not** use any file-related components(like `IFormFile`) or `Stream` in the application service interface. You can use primitive types as file parameters. Such as `byte[]`.
+* **Do** use a controller to handle file upload and call a application service method.
+
+
#### Using Other Application Services
* **Do not** use other application services of the same module/application. Instead;
From dbd3d2dd86dbcdfb6f7e4d4ad33209a7556cc022 Mon Sep 17 00:00:00 2001
From: maliming <6908465+maliming@users.noreply.github.com>
Date: Tue, 6 Oct 2020 21:42:45 +0800
Subject: [PATCH 031/108] Add Add saveResolveResult parameter to
ITenantConfigurationProvider.
---
.../Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs | 2 +-
.../Volo/Abp/MultiTenancy/ITenantConfigurationProvider.cs | 2 +-
.../Volo/Abp/MultiTenancy/TenantConfigurationProvider.cs | 8 ++++++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs
index 24e2b40067..0aeb97e89d 100644
--- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs
+++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs
@@ -20,7 +20,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
- var tenant = await _tenantConfigurationProvider.GetAsync();
+ var tenant = await _tenantConfigurationProvider.GetAsync(saveResolveResult: true);
using (_currentTenant.Change(tenant?.Id, tenant?.Name))
{
await next(context);
diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/ITenantConfigurationProvider.cs b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/ITenantConfigurationProvider.cs
index d46b6b2497..010a10791a 100644
--- a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/ITenantConfigurationProvider.cs
+++ b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/ITenantConfigurationProvider.cs
@@ -4,6 +4,6 @@ namespace Volo.Abp.MultiTenancy
{
public interface ITenantConfigurationProvider
{
- Task GetAsync();
+ Task GetAsync(bool saveResolveResult = false);
}
}
diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfigurationProvider.cs b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfigurationProvider.cs
index 7e32611dfb..a89c44b465 100644
--- a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfigurationProvider.cs
+++ b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/TenantConfigurationProvider.cs
@@ -20,10 +20,14 @@ namespace Volo.Abp.MultiTenancy
TenantResolveResultAccessor = tenantResolveResultAccessor;
}
- public virtual async Task GetAsync()
+ public virtual async Task GetAsync(bool saveResolveResult = false)
{
var resolveResult = TenantResolver.ResolveTenantIdOrName();
- TenantResolveResultAccessor.Result = resolveResult;
+
+ if (saveResolveResult)
+ {
+ TenantResolveResultAccessor.Result = resolveResult;
+ }
TenantConfiguration tenant = null;
if (resolveResult.TenantIdOrName != null)
From ab705e9d956bc8fe804f7ba564be6581bb27c680 Mon Sep 17 00:00:00 2001
From: Bunyamin Coskuner
Date: Tue, 6 Oct 2020 17:23:59 +0300
Subject: [PATCH 032/108] Update
npm/ng-packs/packages/account/src/lib/guards/manage-profile.guard.ts
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Levent Arman Özak
---
.../packages/account/src/lib/guards/manage-profile.guard.ts | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/npm/ng-packs/packages/account/src/lib/guards/manage-profile.guard.ts b/npm/ng-packs/packages/account/src/lib/guards/manage-profile.guard.ts
index 2770fa24bd..4a5b5a0709 100644
--- a/npm/ng-packs/packages/account/src/lib/guards/manage-profile.guard.ts
+++ b/npm/ng-packs/packages/account/src/lib/guards/manage-profile.guard.ts
@@ -9,9 +9,7 @@ export class ManageProfileGuard implements CanActivate {
canActivate(_: ActivatedRouteSnapshot, __: RouterStateSnapshot) {
const env = this.configState.getEnvironment();
if (env.oAuthConfig.responseType === 'code') {
- window.location.replace(
- `${env.oAuthConfig.issuer}/Account/Manage?returnUrl=${window.location.href}`,
- );
+ window.location.href = `${env.oAuthConfig.issuer}/Account/Manage?returnUrl=${window.location.href}`;
return false;
} else {
return true;
From dbb8b4c6fa1532bbde1bf2dfc630161a40ec2a86 Mon Sep 17 00:00:00 2001
From: JamesStallworthy
Date: Tue, 6 Oct 2020 18:22:30 +0100
Subject: [PATCH 033/108] Adding resource mapping example that copies all sub
folders and maintains folder structure
---
docs/en/UI/AspNetCore/Client-Side-Package-Management.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/en/UI/AspNetCore/Client-Side-Package-Management.md b/docs/en/UI/AspNetCore/Client-Side-Package-Management.md
index 63c5cec225..624507dd0e 100644
--- a/docs/en/UI/AspNetCore/Client-Side-Package-Management.md
+++ b/docs/en/UI/AspNetCore/Client-Side-Package-Management.md
@@ -95,6 +95,7 @@ mappings: {
"@node_modules/bootstrap/dist/css/bootstrap.css": "@libs/bootstrap/css/",
"@node_modules/bootstrap/dist/js/bootstrap.bundle.js": "@libs/bootstrap/js/",
"@node_modules/bootstrap-datepicker/dist/locales/*.*": "@libs/bootstrap-datepicker/locales/"
+ "@node_modules/bootstrap-v4-rtl/dist/**/*": "@libs/bootstrap-v4-rtl/dist/"
}
````
From 1770acdfafd94a4ef8f6e4abd50a86732b6088f2 Mon Sep 17 00:00:00 2001
From: JamesStallworthy
Date: Tue, 6 Oct 2020 18:48:36 +0100
Subject: [PATCH 034/108] PR5719 - Resolved issue with example, missing comma
for array
---
docs/en/UI/AspNetCore/Client-Side-Package-Management.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/en/UI/AspNetCore/Client-Side-Package-Management.md b/docs/en/UI/AspNetCore/Client-Side-Package-Management.md
index 624507dd0e..77dee7a383 100644
--- a/docs/en/UI/AspNetCore/Client-Side-Package-Management.md
+++ b/docs/en/UI/AspNetCore/Client-Side-Package-Management.md
@@ -94,7 +94,7 @@ An example mapping configuration is shown below:
mappings: {
"@node_modules/bootstrap/dist/css/bootstrap.css": "@libs/bootstrap/css/",
"@node_modules/bootstrap/dist/js/bootstrap.bundle.js": "@libs/bootstrap/js/",
- "@node_modules/bootstrap-datepicker/dist/locales/*.*": "@libs/bootstrap-datepicker/locales/"
+ "@node_modules/bootstrap-datepicker/dist/locales/*.*": "@libs/bootstrap-datepicker/locales/",
"@node_modules/bootstrap-v4-rtl/dist/**/*": "@libs/bootstrap-v4-rtl/dist/"
}
````
From 1683441f63df8bbb523b1c58fe8ac45d93350a13 Mon Sep 17 00:00:00 2001
From: Luis Pignataro
Date: Tue, 6 Oct 2020 14:51:35 -0300
Subject: [PATCH 035/108] Spanish localization update for v3.2
---
.../Mvc/UI/MultiTenancy/Localization/es.json | 12 ++++++++++++
.../Volo.Abp.Ddd.Application.Contracts.csproj | 4 ++++
.../Localization/Resources/AbpDdd/es.json | 6 ++++++
.../Volo/Abp/Emailing/Localization/es.json | 4 +++-
.../Volo/Abp/Ldap/Localization/es.json | 19 +++++++++++++++++++
.../Volo.Abp.Timing/Volo.Abp.Timing.csproj | 4 ++++
.../Volo/Abp/Timing/Localization/es.json | 7 +++++++
.../Localization/Resources/AbpUi/es.json | 10 ++++++++--
.../Volo.Abp.AspNetCore.Mvc.Tests.csproj | 4 ++++
.../Mvc/Localization/Resource/es.json | 7 +++++++
.../Volo/Abp/Emailing/Localization/es.json | 6 ++++++
11 files changed, 80 insertions(+), 3 deletions(-)
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/es.json
create mode 100644 framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/es.json
create mode 100644 framework/src/Volo.Abp.Ldap/Volo/Abp/Ldap/Localization/es.json
create mode 100644 framework/src/Volo.Abp.Timing/Volo/Abp/Timing/Localization/es.json
create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/Resource/es.json
create mode 100644 framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/es.json
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/es.json b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/es.json
new file mode 100644
index 0000000000..d6fd84dcbe
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/es.json
@@ -0,0 +1,12 @@
+{
+ "culture": "es",
+ "texts": {
+ "GivenTenantIsNotAvailable": "El inquilino {0} no está disponible",
+ "Tenant": "Inquilino",
+ "Switch": "cambiar",
+ "Name": "Nombre",
+ "SwitchTenant": "Cambiar inquilino",
+ "SwitchTenantHint": "Deje en blanco el campo nombre para cambiar el lado del host.",
+ "NotSelected": "No seleccionado"
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj
index 6668f9c649..3b45f3d42f 100644
--- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj
+++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj
@@ -19,6 +19,10 @@
+
+
+
+
diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/es.json b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/es.json
new file mode 100644
index 0000000000..4563876228
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/es.json
@@ -0,0 +1,6 @@
+{
+ "culture": "es",
+ "texts": {
+ "MaxResultCountExceededExceptionMessage": "{0} no puede tener más de {1}! Incremente {2}.{3} en el lado del servidor para obtener más resultados."
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/es.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/es.json
index 33c59be8b5..da1d7fde95 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/es.json
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/es.json
@@ -18,6 +18,8 @@
"Description:Abp.Mailing.Smtp.Password": "La contraseña del ususario asociado a las credenciales.",
"Description:Abp.Mailing.Smtp.Domain": "El dominio o equipo que valida las credenciales.",
"Description:Abp.Mailing.Smtp.EnableSsl": "Si SmtpClient usa Secure Sockets Layer (SSL) para encriptar la conección.",
- "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Si las credenciales por defecto se envían con los request."
+ "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Si las credenciales por defecto se envían con los request.",
+ "TextTemplate:StandardEmailTemplates.Layout": "Plantilla de email por defecto",
+ "TextTemplate:StandardEmailTemplates.Message": "Plantilla de mensaje simple para emails"
}
}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Ldap/Volo/Abp/Ldap/Localization/es.json b/framework/src/Volo.Abp.Ldap/Volo/Abp/Ldap/Localization/es.json
new file mode 100644
index 0000000000..365856425e
--- /dev/null
+++ b/framework/src/Volo.Abp.Ldap/Volo/Abp/Ldap/Localization/es.json
@@ -0,0 +1,19 @@
+{
+ "culture": "es",
+ "texts": {
+ "DisplayName:Abp.Ldap.ServerHost": "Server host",
+ "Description:Abp.Ldap.ServerHost": "Servidor host",
+
+ "DisplayName:Abp.Ldap.ServerPort": "Server port",
+ "Description:Abp.Ldap.ServerPort": "Puerto del servidor host",
+
+ "DisplayName:Abp.Ldap.BaseDc": "Base domain component",
+ "Description:Abp.Ldap.BaseDc": "Dominio base",
+
+ "DisplayName:Abp.Ldap.UserName": "Username",
+ "Description:Abp.Ldap.UserName": "Nombre de usuario",
+
+ "DisplayName:Abp.Ldap.Password": "Password",
+ "Description:Abp.Ldap.Password": "Contraseña"
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj b/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj
index 53ef23fd62..5af3709638 100644
--- a/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj
+++ b/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj
@@ -19,6 +19,10 @@
+
+
+
+
diff --git a/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/Localization/es.json b/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/Localization/es.json
new file mode 100644
index 0000000000..a23fccc1c4
--- /dev/null
+++ b/framework/src/Volo.Abp.Timing/Volo/Abp/Timing/Localization/es.json
@@ -0,0 +1,7 @@
+{
+ "culture": "es",
+ "texts": {
+ "DisplayName:Abp.Timing.Timezone": "Zona horaria",
+ "Description:Abp.Timing.Timezone": "Zona horaria de la Aplicacion"
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json
index fb0bc45903..56d6b117cf 100644
--- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json
+++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/es.json
@@ -4,6 +4,7 @@
"Languages": "Lenguajes",
"AreYouSure": "¿Está seguro?",
"Cancel": "Cancelar",
+ "Clear": "Limpiar",
"Yes": "Si",
"No": "No",
"Ok": "Aceptar",
@@ -34,6 +35,8 @@
"PagerInfoEmpty": "Mostrando desde 0 hasta 0 de 0 registros",
"PagerInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"NoDataAvailableInDatatable": "No hay datos",
+ "Total": "total",
+ "Selected": "seleccionado",
"PagerShowMenuEntries": "Mostrar _MENU_ registros",
"DatatableActionDropdownDefaultText": "Acciones",
"ChangePassword": "Cambiar contraseña",
@@ -41,6 +44,9 @@
"AreYouSureYouWantToCancelEditingWarningMessage": "Tiene cambios sin guardar.",
"GoHomePage": "Ir a la página principal",
"GoBack": "Atras",
- "Search": "Buscar"
+ "Search": "Buscar",
+ "ItemWillBeDeletedMessageWithFormat": "Se eliminarán {0}!",
+ "ItemWillBeDeletedMessage": "Este itém será eliminado!",
+ "ManageYourAccount": "Administre su cuenta"
}
-}
+}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj
index c6450e6df1..50ec149137 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj
@@ -19,6 +19,10 @@
+
+
+
+
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/Resource/es.json b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/Resource/es.json
new file mode 100644
index 0000000000..baf2d0c45b
--- /dev/null
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/Resource/es.json
@@ -0,0 +1,7 @@
+{
+ "culture": "es",
+ "texts": {
+ "BirthDate": "Fecha de nacimiento",
+ "Value1": "Valor uno"
+ }
+}
\ No newline at end of file
diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/es.json b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/es.json
new file mode 100644
index 0000000000..7cf144aab4
--- /dev/null
+++ b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/es.json
@@ -0,0 +1,6 @@
+{
+ "culture": "es",
+ "texts": {
+ "hello": "Hola"
+ }
+}
\ No newline at end of file
From 3e8e8c019d6b52512a6db29019ebf460ef1d5163 Mon Sep 17 00:00:00 2001
From: Alper Ebicoglu
Date: Wed, 7 Oct 2020 09:16:02 +0300
Subject: [PATCH 036/108] Update Application-Services.md
---
docs/en/Best-Practices/Application-Services.md | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/docs/en/Best-Practices/Application-Services.md b/docs/en/Best-Practices/Application-Services.md
index b14770d654..ff8afe81d2 100644
--- a/docs/en/Best-Practices/Application-Services.md
+++ b/docs/en/Best-Practices/Application-Services.md
@@ -215,9 +215,8 @@ This method votes a question and returns the current score of the question.
#### Handle files
-* **Do not** use any file-related components(like `IFormFile`) or `Stream` in the application service interface. You can use primitive types as file parameters. Such as `byte[]`.
-* **Do** use a controller to handle file upload and call a application service method.
-
+* **Do not** use any web components like `IFormFile` or `Stream` in the application services. If you want to serve a file you can use `byte[]`.
+* **Do** use a `Controller` to handle file uploading then pass the `byte[]` of the file to the application service method.
#### Using Other Application Services
From f8c9d7ddb914e23f05951b0a03e56be8dec6e80b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 10:28:19 +0300
Subject: [PATCH 037/108] Enable AbpAutoValidateAntiforgeryTokenAttribute by
default.
---
.../AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 11 +-
.../Mvc/AntiForgery/AbpAntiForgeryOptions.cs | 10 +-
.../AntiForgery/AbpAntiForgeryPreOptions.cs | 10 ++
...bpAutoValidateAntiforgeryTokenAttribute.cs | 37 +++++++
...dateAntiforgeryTokenAuthorizationFilter.cs | 78 ++++++++++++++
.../AbpValidateAntiForgeryTokenAttribute.cs | 37 +++++++
...dateAntiforgeryTokenAuthorizationFilter.cs | 100 ++++++++++++++++++
...ltAbpRequestLocalizationOptionsProvider.cs | 1 -
8 files changed, 277 insertions(+), 7 deletions(-)
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryPreOptions.cs
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAttribute.cs
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiForgeryTokenAttribute.cs
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
index 88a81fa1ec..f1efac83ce 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
@@ -22,6 +22,7 @@ using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Localization;
using Volo.Abp.ApiVersioning;
+using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.AspNetCore.Mvc.ApiExploring;
using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.AspNetCore.Mvc.DataAnnotations;
@@ -94,7 +95,15 @@ namespace Volo.Abp.AspNetCore.Mvc
}
});
- var mvcCoreBuilder = context.Services.AddMvcCore();
+ var antiForgeryPreOptions = context.Services.ExecutePreConfiguredActions();
+
+ var mvcCoreBuilder = context.Services.AddMvcCore(options =>
+ {
+ if (antiForgeryPreOptions.AutoValidate)
+ {
+ options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
+ }
+ });
context.Services.ExecutePreConfiguredActions(mvcCoreBuilder);
var abpMvcDataAnnotationsLocalizationOptions = context.Services
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
index 0dc573fd5d..defc794998 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
@@ -9,15 +9,15 @@
public string TokenCookieName { get; set; }
///
- /// Get/sets header name to transfer Anti Forgery token from client to the server.
- /// Default value: "X-XSRF-TOKEN".
+ /// Used to find auth cookie when validating Anti Forgery token.
+ /// Default value: ".AspNet.ApplicationCookie".
///
- public string TokenHeaderName { get; set; }
+ public string AuthorizationCookieName { get; set; }
public AbpAntiForgeryOptions()
{
TokenCookieName = "XSRF-TOKEN";
- TokenHeaderName = "X-XSRF-TOKEN";
+ AuthorizationCookieName = ".AspNet.ApplicationCookie";
}
}
-}
\ No newline at end of file
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryPreOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryPreOptions.cs
new file mode 100644
index 0000000000..887153fd1b
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryPreOptions.cs
@@ -0,0 +1,10 @@
+namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
+{
+ public class AbpAntiForgeryPreOptions
+ {
+ ///
+ /// Default value: true.
+ ///
+ public bool AutoValidate { get; set; } = true;
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAttribute.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAttribute.cs
new file mode 100644
index 0000000000..346d5e9db4
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAttribute.cs
@@ -0,0 +1,37 @@
+using System;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
+ public class AbpAutoValidateAntiforgeryTokenAttribute : Attribute, IFilterFactory, IOrderedFilter
+ {
+ ///
+ /// Gets the order value for determining the order of execution of filters. Filters execute in
+ /// ascending numeric value of the property.
+ ///
+ ///
+ ///
+ /// Filters are executed in a sequence determined by an ascending sort of the property.
+ ///
+ ///
+ /// The default Order for this attribute is 1000 because it must run after any filter which does authentication
+ /// or login in order to allow them to behave as expected (ie Unauthenticated or Redirect instead of 400).
+ ///
+ ///
+ /// Look at for more detailed info.
+ ///
+ ///
+ public int Order { get; set; } = 1000;
+
+ ///
+ public bool IsReusable => true;
+
+ ///
+ public IFilterMetadata CreateInstance(IServiceProvider serviceProvider)
+ {
+ return serviceProvider.GetRequiredService();
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
new file mode 100644
index 0000000000..ba78746390
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -0,0 +1,78 @@
+using System;
+using Microsoft.AspNetCore.Antiforgery;
+using Microsoft.AspNetCore.Authentication.Cookies;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
+{
+ public class AbpAutoValidateAntiforgeryTokenAuthorizationFilter : AbpValidateAntiforgeryTokenAuthorizationFilter, ITransientDependency
+ {
+ private readonly AntiforgeryOptions _antiforgeryOptions;
+ private readonly IOptionsSnapshot _namedOptionsAccessor;
+ private readonly AbpAntiForgeryOptions _abpAntiForgeryOptions;
+
+ public AbpAutoValidateAntiforgeryTokenAuthorizationFilter(
+ IAntiforgery antiforgery,
+ IOptions antiforgeryOptions,
+ IOptions abpAntiForgeryOptions,
+ IOptionsSnapshot namedOptionsAccessor,
+ ILogger logger)
+ : base(antiforgery, antiforgeryOptions, abpAntiForgeryOptions, namedOptionsAccessor, logger)
+ {
+ _namedOptionsAccessor = namedOptionsAccessor;
+ _abpAntiForgeryOptions = abpAntiForgeryOptions.Value;
+ _antiforgeryOptions = antiforgeryOptions.Value;
+ }
+
+ protected override bool ShouldValidate(AuthorizationFilterContext context)
+ {
+ if (!ShouldValidateInternal(context))
+ {
+ return false;
+ }
+
+ var cookieAuthenticationOptions = _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthorizationCookieName);
+
+ //Always perform antiforgery validation when request contains authentication cookie
+ if (cookieAuthenticationOptions?.Cookie.Name != null &&
+ context.HttpContext.Request.Cookies.ContainsKey(cookieAuthenticationOptions.Cookie.Name))
+ {
+ return true;
+ }
+
+ //No need to validate if antiforgery cookie is not sent.
+ //That means the request is sent from a non-browser client.
+ //See https://github.com/aspnet/Antiforgery/issues/115
+ if (!context.HttpContext.Request.Cookies.ContainsKey(_antiforgeryOptions.Cookie.Name))
+ {
+ return false;
+ }
+
+ // Anything else requires a token.
+ return true;
+ }
+
+ private static bool ShouldValidateInternal(AuthorizationFilterContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ var method = context.HttpContext.Request.Method;
+ if (string.Equals("GET", method, StringComparison.OrdinalIgnoreCase) ||
+ string.Equals("HEAD", method, StringComparison.OrdinalIgnoreCase) ||
+ string.Equals("TRACE", method, StringComparison.OrdinalIgnoreCase) ||
+ string.Equals("OPTIONS", method, StringComparison.OrdinalIgnoreCase))
+ {
+ return false;
+ }
+
+ // Anything else requires a token.
+ return true;
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiForgeryTokenAttribute.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiForgeryTokenAttribute.cs
new file mode 100644
index 0000000000..853f642b29
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiForgeryTokenAttribute.cs
@@ -0,0 +1,37 @@
+using System;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
+ public class AbpValidateAntiForgeryTokenAttribute : Attribute, IFilterFactory, IOrderedFilter
+ {
+ ///
+ /// Gets the order value for determining the order of execution of filters. Filters execute in
+ /// ascending numeric value of the property.
+ ///
+ ///
+ ///
+ /// Filters are executed in an ordering determined by an ascending sort of the property.
+ ///
+ ///
+ /// The default Order for this attribute is 1000 because it must run after any filter which does authentication
+ /// or login in order to allow them to behave as expected (ie Unauthenticated or Redirect instead of 400).
+ ///
+ ///
+ /// Look at for more detailed info.
+ ///
+ ///
+ public int Order { get; set; } = 1000;
+
+ ///
+ public bool IsReusable => true;
+
+ ///
+ public IFilterMetadata CreateInstance(IServiceProvider serviceProvider)
+ {
+ return serviceProvider.GetRequiredService();
+ }
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
new file mode 100644
index 0000000000..662f161595
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -0,0 +1,100 @@
+using System;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Antiforgery;
+using Microsoft.AspNetCore.Authentication.Cookies;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+
+namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
+{
+ public class AbpValidateAntiforgeryTokenAuthorizationFilter : IAsyncAuthorizationFilter, IAntiforgeryPolicy
+ {
+ private IAntiforgery _antiforgery;
+ private readonly AntiforgeryOptions _antiforgeryOptions;
+ private readonly IOptionsSnapshot _namedOptionsAccessor;
+ private readonly AbpAntiForgeryOptions _abpAntiForgeryOptions;
+ private readonly ILogger _logger;
+
+ public AbpValidateAntiforgeryTokenAuthorizationFilter(
+ IAntiforgery antiforgery,
+ IOptions antiforgeryOptions,
+ IOptions abpAntiForgeryOptions,
+ IOptionsSnapshot namedOptionsAccessor,
+ ILogger logger)
+ {
+ _antiforgery = antiforgery;
+ _antiforgeryOptions = antiforgeryOptions.Value;
+ _namedOptionsAccessor = namedOptionsAccessor;
+ _logger = logger;
+ _abpAntiForgeryOptions = abpAntiForgeryOptions.Value;
+ }
+
+ public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ if (!context.IsEffectivePolicy(this))
+ {
+ _logger.LogInformation("Skipping the execution of current filter as its not the most effective filter implementing the policy " + typeof(IAntiforgeryPolicy));
+ return;
+ }
+
+ if (ShouldValidate(context))
+ {
+ try
+ {
+ await _antiforgery.ValidateRequestAsync(context.HttpContext);
+ }
+ catch (AntiforgeryValidationException exception)
+ {
+ _logger.LogError(exception.Message, exception);
+ context.Result = new AntiforgeryValidationFailedResult();
+ }
+ }
+ }
+
+ protected virtual bool ShouldValidate(AuthorizationFilterContext context)
+ {
+ if (!ShouldValidateInternal(context))
+ {
+ return false;
+ }
+
+ var cookieAuthenticationOptions = _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthorizationCookieName);
+
+ //Always perform antiforgery validation when request contains authentication cookie
+ if (cookieAuthenticationOptions?.Cookie.Name != null &&
+ context.HttpContext.Request.Cookies.ContainsKey(cookieAuthenticationOptions.Cookie.Name))
+ {
+ return true;
+ }
+
+ //No need to validate if antiforgery cookie is not sent.
+ //That means the request is sent from a non-browser client.
+ //See https://github.com/aspnet/Antiforgery/issues/115
+ if (!context.HttpContext.Request.Cookies.ContainsKey(_antiforgeryOptions.Cookie.Name))
+ {
+ return false;
+ }
+
+ // Anything else requires a token.
+ return true;
+ }
+
+ private static bool ShouldValidateInternal(AuthorizationFilterContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs
index 263d0532d0..001fc6a02d 100644
--- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs
@@ -5,7 +5,6 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.DependencyInjection;
using Nito.AsyncEx;
From b5c075ae0fbb7fbd4999597333ec2708527ce4fb Mon Sep 17 00:00:00 2001
From: bnymncoskuner
Date: Wed, 7 Oct 2020 10:31:34 +0300
Subject: [PATCH 038/108] feat: disable manage profile guard
---
.../packages/account/src/lib/account-routing.module.ts | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/npm/ng-packs/packages/account/src/lib/account-routing.module.ts b/npm/ng-packs/packages/account/src/lib/account-routing.module.ts
index 0b80242aab..6883921202 100644
--- a/npm/ng-packs/packages/account/src/lib/account-routing.module.ts
+++ b/npm/ng-packs/packages/account/src/lib/account-routing.module.ts
@@ -11,7 +11,6 @@ import { ManageProfileComponent } from './components/manage-profile/manage-profi
import { RegisterComponent } from './components/register/register.component';
import { eAccountComponents } from './enums/components';
import { AuthenticationFlowGuard } from './guards/authentication-flow.guard';
-import { ManageProfileGuard } from './guards/manage-profile.guard';
const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: 'login' },
@@ -44,7 +43,7 @@ const routes: Routes = [
{
path: 'manage-profile',
component: ReplaceableRouteContainerComponent,
- canActivate: [AuthGuard, ManageProfileGuard],
+ canActivate: [AuthGuard],
data: {
replaceableComponent: {
key: eAccountComponents.ManageProfile,
From 8c4ecf6af0e5e32de7adfe809a2b9af81e36f832 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 10:35:01 +0300
Subject: [PATCH 039/108] Fixed logger injection
---
.../AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs | 2 +-
.../AbpValidateAntiforgeryTokenAuthorizationFilter.cs | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
index ba78746390..04c3326b15 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -19,7 +19,7 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
IOptions antiforgeryOptions,
IOptions abpAntiForgeryOptions,
IOptionsSnapshot namedOptionsAccessor,
- ILogger logger)
+ ILogger logger)
: base(antiforgery, antiforgeryOptions, abpAntiForgeryOptions, namedOptionsAccessor, logger)
{
_namedOptionsAccessor = namedOptionsAccessor;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
index 662f161595..5ff410a9c2 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -16,14 +16,14 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
private readonly AntiforgeryOptions _antiforgeryOptions;
private readonly IOptionsSnapshot _namedOptionsAccessor;
private readonly AbpAntiForgeryOptions _abpAntiForgeryOptions;
- private readonly ILogger _logger;
+ private readonly ILogger _logger;
public AbpValidateAntiforgeryTokenAuthorizationFilter(
IAntiforgery antiforgery,
IOptions antiforgeryOptions,
IOptions abpAntiForgeryOptions,
IOptionsSnapshot namedOptionsAccessor,
- ILogger logger)
+ ILogger logger)
{
_antiforgery = antiforgery;
_antiforgeryOptions = antiforgeryOptions.Value;
From 63c87a106e9f40dde8c4df29da05af18e5123370 Mon Sep 17 00:00:00 2001
From: Mladen Macanovic
Date: Wed, 7 Oct 2020 10:07:03 +0200
Subject: [PATCH 040/108] Options are now sent with the message. Cleaned and
optimized the code.
---
.../WebAssembly/IUiMessageNotifierService.cs | 21 +++++---------
.../WebAssembly/IUiMessageService.cs | 18 ++++++------
.../WebAssembly/NullUiMessageService.cs | 10 +++----
.../WebAssembly/UiMessageOptions.cs | 29 +++++++++++++++++++
.../WebAssembly/UiMessageService.cs | 14 ++++-----
.../Components/WebAssembly/UiMessageType.cs | 14 +++++++++
.../BlazoriseUiMessageService.cs | 20 ++++++-------
.../Components/UiMessageAlert.razor.cs | 4 ++-
.../UiMessageNotifierService.cs | 11 ++-----
.../Pages/Index.razor.cs | 7 ++++-
10 files changed, 92 insertions(+), 56 deletions(-)
create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageType.cs
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageNotifierService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageNotifierService.cs
index 309b73337b..456eb1bed7 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageNotifierService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageNotifierService.cs
@@ -7,25 +7,25 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
event EventHandler MessageReceived;
- Task NotifyMessageReceivedAsync(UiMessageType messageType, string message, string title = null);
-
- Task NotifyConfirmationReceivedAsync(string message, string title, TaskCompletionSource callback);
+ Task NotifyMessageReceivedAsync(UiMessageType messageType, string message, string title, UiMessageOptions options, TaskCompletionSource callback = null);
}
public class UiMessageEventArgs : EventArgs
{
- public UiMessageEventArgs(UiMessageType messageType, string message, string title)
+ public UiMessageEventArgs(UiMessageType messageType, string message, string title, UiMessageOptions options)
{
MessageType = messageType;
Message = message;
Title = title;
+ Options = options;
}
- public UiMessageEventArgs(UiMessageType messageType, string message, string title, TaskCompletionSource callback)
+ public UiMessageEventArgs(UiMessageType messageType, string message, string title, UiMessageOptions options, TaskCompletionSource callback)
{
MessageType = messageType;
Message = message;
Title = title;
+ Options = options;
Callback = callback;
}
@@ -35,15 +35,8 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly
public string Title { get; }
- public TaskCompletionSource Callback { get; }
- }
+ public UiMessageOptions Options { get; }
- public enum UiMessageType
- {
- Info,
- Success,
- Warning,
- Error,
- Confirmation,
+ public TaskCompletionSource Callback { get; }
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageService.cs
index 2c834ddc87..ff86c1c867 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageService.cs
@@ -4,14 +4,14 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
public interface IUiMessageService
{
- Task InfoAsync(string message, string title = null);
-
- Task SuccessAsync(string message, string title = null);
-
- Task WarnAsync(string message, string title = null);
-
- Task ErrorAsync(string message, string title = null);
-
- Task ConfirmAsync(string message, string title = null);
+ Task InfoAsync(string message, string title = null, UiMessageOptions options = null);
+
+ Task SuccessAsync(string message, string title = null, UiMessageOptions options = null);
+
+ Task WarnAsync(string message, string title = null, UiMessageOptions options = null);
+
+ Task ErrorAsync(string message, string title = null, UiMessageOptions options = null);
+
+ Task ConfirmAsync(string message, string title = null, UiMessageOptions options = null);
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/NullUiMessageService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/NullUiMessageService.cs
index 59830b0480..0c7df5780d 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/NullUiMessageService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/NullUiMessageService.cs
@@ -5,27 +5,27 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
public class NullUiMessageService : IUiMessageService, ITransientDependency
{
- public Task InfoAsync(string message, string title = null)
+ public Task InfoAsync(string message, string title = null, UiMessageOptions options = null)
{
return Task.CompletedTask;
}
- public Task SuccessAsync(string message, string title = null)
+ public Task SuccessAsync(string message, string title = null, UiMessageOptions options = null)
{
return Task.CompletedTask;
}
- public Task WarnAsync(string message, string title = null)
+ public Task WarnAsync(string message, string title = null, UiMessageOptions options = null)
{
return Task.CompletedTask;
}
- public Task ErrorAsync(string message, string title = null)
+ public Task ErrorAsync(string message, string title = null, UiMessageOptions options = null)
{
return Task.CompletedTask;
}
- public Task ConfirmAsync(string message, string title = null)
+ public Task ConfirmAsync(string message, string title = null, UiMessageOptions options = null)
{
return Task.FromResult(true);
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageOptions.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageOptions.cs
index 7909911c7e..85b26bc4b6 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageOptions.cs
@@ -1,19 +1,48 @@
namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
+ ///
+ /// Options to override message dialog appearance.
+ ///
public class UiMessageOptions
{
+ ///
+ /// If true, the message dialog will show the large icon for the current message type.
+ ///
public bool ShowMessageIcon { get; set; } = true;
+ ///
+ /// Overrides the build-in message icon.
+ ///
+ public object MessageIcon { get; set; }
+
+ ///
+ /// Custom text for the Ok button.
+ ///
public string OkButtonText { get; set; }
+ ///
+ /// Custom icon for the Ok button.
+ ///
public object OkButtonIcon { get; set; }
+ ///
+ /// Custom text for the Confirmation button.
+ ///
public string ConfirmButtonText { get; set; }
+ ///
+ /// Custom icon for the Confirmation button.
+ ///
public object ConfirmButtonIcon { get; set; }
+ ///
+ /// Custom text for the Cancel button.
+ ///
public string CancelButtonText { get; set; }
+ ///
+ /// Custom icon for the Cancel button.
+ ///
public object CancelButtonIcon { get; set; }
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageService.cs
index 16fe041de4..dfdc09f55d 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageService.cs
@@ -14,27 +14,27 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly
JsRuntime = jsRuntime;
}
- public async Task InfoAsync(string message, string title = null)
+ public async Task InfoAsync(string message, string title = null, UiMessageOptions options = null)
{
await JsRuntime.InvokeVoidAsync("alert", message);
}
- public async Task SuccessAsync(string message, string title = null)
+ public async Task SuccessAsync(string message, string title = null, UiMessageOptions options = null)
{
await JsRuntime.InvokeVoidAsync("alert", message);
}
- public async Task WarnAsync(string message, string title = null)
+ public async Task WarnAsync(string message, string title = null, UiMessageOptions options = null)
{
await JsRuntime.InvokeVoidAsync("alert", message);
}
-
- public async Task ErrorAsync(string message, string title = null)
+
+ public async Task ErrorAsync(string message, string title = null, UiMessageOptions options = null)
{
await JsRuntime.InvokeVoidAsync("alert", message);
}
-
- public async Task ConfirmAsync(string message, string title = null)
+
+ public async Task ConfirmAsync(string message, string title = null, UiMessageOptions options = null)
{
return await JsRuntime.InvokeAsync("confirm", message);
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageType.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageType.cs
new file mode 100644
index 0000000000..5e3a77a3c5
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageType.cs
@@ -0,0 +1,14 @@
+namespace Volo.Abp.AspNetCore.Components.WebAssembly
+{
+ ///
+ /// Defines the possible ui message types with predefined actions.
+ ///
+ public enum UiMessageType
+ {
+ Info,
+ Success,
+ Warning,
+ Error,
+ Confirmation,
+ }
+}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs
index e7795f928d..2c3481f313 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs
@@ -20,31 +20,31 @@ namespace Volo.Abp.BlazoriseUI
Logger = NullLogger.Instance;
}
- public Task InfoAsync(string message, string title = null)
+ public Task InfoAsync(string message, string title = null, UiMessageOptions options = null)
{
- return uiMessageNotifierService.NotifyMessageReceivedAsync(UiMessageType.Info, message, title);
+ return uiMessageNotifierService.NotifyMessageReceivedAsync(UiMessageType.Info, message, title, options);
}
- public Task SuccessAsync(string message, string title = null)
+ public Task SuccessAsync(string message, string title = null, UiMessageOptions options = null)
{
- return uiMessageNotifierService.NotifyMessageReceivedAsync(UiMessageType.Success, message, title);
+ return uiMessageNotifierService.NotifyMessageReceivedAsync(UiMessageType.Success, message, title, options);
}
- public Task WarnAsync(string message, string title = null)
+ public Task WarnAsync(string message, string title = null, UiMessageOptions options = null)
{
- return uiMessageNotifierService.NotifyMessageReceivedAsync(UiMessageType.Warning, message, title);
+ return uiMessageNotifierService.NotifyMessageReceivedAsync(UiMessageType.Warning, message, title, options);
}
- public Task ErrorAsync(string message, string title = null)
+ public Task ErrorAsync(string message, string title = null, UiMessageOptions options = null)
{
- return uiMessageNotifierService.NotifyMessageReceivedAsync(UiMessageType.Error, message, title);
+ return uiMessageNotifierService.NotifyMessageReceivedAsync(UiMessageType.Error, message, title, options);
}
- public async Task ConfirmAsync(string message, string title = null)
+ public async Task ConfirmAsync(string message, string title = null, UiMessageOptions options = null)
{
var callback = new TaskCompletionSource();
- await uiMessageNotifierService.NotifyConfirmationReceivedAsync(message, title, callback);
+ await uiMessageNotifierService.NotifyMessageReceivedAsync(UiMessageType.Confirmation, message, title, options, callback);
return await callback.Task;
}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
index 4d543174e0..a3cd3f8f1e 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
@@ -21,6 +21,7 @@ namespace Volo.Abp.BlazoriseUI.Components
MessageType = e.MessageType;
Message = e.Message;
Title = e.Title;
+ Options = e.Options;
Callback = e.Callback;
ModalRef.Show();
@@ -73,7 +74,7 @@ namespace Volo.Abp.BlazoriseUI.Components
protected virtual bool ShowMessageIcon
=> Options?.ShowMessageIcon ?? true;
- protected virtual object MessageIcon => MessageType switch
+ protected virtual object MessageIcon => Options?.MessageIcon ?? MessageType switch
{
UiMessageType.Info => IconName.Info,
UiMessageType.Success => IconName.Check,
@@ -85,6 +86,7 @@ namespace Volo.Abp.BlazoriseUI.Components
protected virtual string MessageIconColor => MessageType switch
{
+ // gets the color in the order of importance: Blazorise > Bootstrap > fallback color
UiMessageType.Info => "var(--b-theme-info, var(--info, #17a2b8))",
UiMessageType.Success => "var(--b-theme-success, var(--success, #28a745))",
UiMessageType.Warning => "var(--b-theme-warning, var(--warning, #ffc107))",
diff --git a/framework/src/Volo.Abp.BlazoriseUI/UiMessageNotifierService.cs b/framework/src/Volo.Abp.BlazoriseUI/UiMessageNotifierService.cs
index 3b97045a93..c8ae0ecb0d 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/UiMessageNotifierService.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/UiMessageNotifierService.cs
@@ -10,16 +10,9 @@ namespace Volo.Abp.BlazoriseUI
{
public event EventHandler MessageReceived;
- public Task NotifyMessageReceivedAsync(UiMessageType messageType, string message, string title = null)
+ public Task NotifyMessageReceivedAsync(UiMessageType messageType, string message, string title, UiMessageOptions options, TaskCompletionSource callback)
{
- MessageReceived?.Invoke(this, new UiMessageEventArgs(messageType, message, title));
-
- return Task.CompletedTask;
- }
-
- public Task NotifyConfirmationReceivedAsync(string message, string title, TaskCompletionSource callback)
- {
- MessageReceived?.Invoke(this, new UiMessageEventArgs(UiMessageType.Confirmation, message, title, callback));
+ MessageReceived?.Invoke(this, new UiMessageEventArgs(messageType, message, title, options, callback));
return Task.CompletedTask;
}
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs
index 8c5440e747..730da74983 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
+using Blazorise;
using Microsoft.AspNetCore.Components;
using Volo.Abp.AspNetCore.Components.WebAssembly;
@@ -23,7 +24,11 @@ namespace MyCompanyName.MyProjectName.Blazor.Pages
Task OnInfoTestClicked()
{
- return UiMessageService.InfoAsync( "This is the Info message", "Info" );
+ return UiMessageService.InfoAsync( "This is the Info message", "Info", new UiMessageOptions
+ {
+ OkButtonIcon = IconName.InfoCircle,
+ OkButtonText = "Hello info"
+ } );
}
Task OnSuccessTestClicked()
From 73216ee1ef9cd5d739a938bb08b152e36f733160 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 11:18:03 +0300
Subject: [PATCH 041/108] Extract service: AbpAntiForgeryAuthCookieNameProvider
---
.../AbpAntiForgeryAuthCookieNameProvider.cs | 25 +++++++++++++++++++
.../Mvc/AntiForgery/AbpAntiForgeryOptions.cs | 6 ++---
...dateAntiforgeryTokenAuthorizationFilter.cs | 22 ++++++++--------
...dateAntiforgeryTokenAuthorizationFilter.cs | 16 +++++-------
4 files changed, 45 insertions(+), 24 deletions(-)
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs
new file mode 100644
index 0000000000..48b71e34ae
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs
@@ -0,0 +1,25 @@
+using Microsoft.AspNetCore.Authentication.Cookies;
+using Microsoft.Extensions.Options;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
+{
+ public class AbpAntiForgeryAuthCookieNameProvider : ITransientDependency
+ {
+ private readonly IOptionsSnapshot _namedOptionsAccessor;
+ private readonly AbpAntiForgeryOptions _abpAntiForgeryOptions;
+
+ public AbpAntiForgeryAuthCookieNameProvider(
+ IOptionsSnapshot namedOptionsAccessor,
+ IOptions abpAntiForgeryOptions)
+ {
+ _namedOptionsAccessor = namedOptionsAccessor;
+ _abpAntiForgeryOptions = abpAntiForgeryOptions.Value;
+ }
+
+ public virtual string GetNameOrNull()
+ {
+ return _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthCookieName)?.Cookie?.Name;
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
index defc794998..5cfd1cf1e7 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
@@ -10,14 +10,14 @@
///
/// Used to find auth cookie when validating Anti Forgery token.
- /// Default value: ".AspNet.ApplicationCookie".
+ /// Default value: ".AspNetCore.Identity.Application".
///
- public string AuthorizationCookieName { get; set; }
+ public string AuthCookieName { get; set; }
public AbpAntiForgeryOptions()
{
TokenCookieName = "XSRF-TOKEN";
- AuthorizationCookieName = ".AspNet.ApplicationCookie";
+ AuthCookieName = ".AspNetCore.Identity.Application";
}
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
index 04c3326b15..c0dbcd246a 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -1,6 +1,5 @@
using System;
using Microsoft.AspNetCore.Antiforgery;
-using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@@ -11,19 +10,20 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
public class AbpAutoValidateAntiforgeryTokenAuthorizationFilter : AbpValidateAntiforgeryTokenAuthorizationFilter, ITransientDependency
{
private readonly AntiforgeryOptions _antiforgeryOptions;
- private readonly IOptionsSnapshot _namedOptionsAccessor;
- private readonly AbpAntiForgeryOptions _abpAntiForgeryOptions;
+ private readonly AbpAntiForgeryAuthCookieNameProvider _antiForgeryAuthCookieNameProvider;
public AbpAutoValidateAntiforgeryTokenAuthorizationFilter(
IAntiforgery antiforgery,
IOptions antiforgeryOptions,
- IOptions abpAntiForgeryOptions,
- IOptionsSnapshot namedOptionsAccessor,
+ AbpAntiForgeryAuthCookieNameProvider antiForgeryAuthCookieNameProvider,
ILogger logger)
- : base(antiforgery, antiforgeryOptions, abpAntiForgeryOptions, namedOptionsAccessor, logger)
+ : base(
+ antiforgery,
+ antiforgeryOptions,
+ antiForgeryAuthCookieNameProvider,
+ logger)
{
- _namedOptionsAccessor = namedOptionsAccessor;
- _abpAntiForgeryOptions = abpAntiForgeryOptions.Value;
+ _antiForgeryAuthCookieNameProvider = antiForgeryAuthCookieNameProvider;
_antiforgeryOptions = antiforgeryOptions.Value;
}
@@ -34,11 +34,11 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
return false;
}
- var cookieAuthenticationOptions = _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthorizationCookieName);
+ var authCookieName = _antiForgeryAuthCookieNameProvider.GetNameOrNull();
//Always perform antiforgery validation when request contains authentication cookie
- if (cookieAuthenticationOptions?.Cookie.Name != null &&
- context.HttpContext.Request.Cookies.ContainsKey(cookieAuthenticationOptions.Cookie.Name))
+ if (authCookieName != null &&
+ context.HttpContext.Request.Cookies.ContainsKey(authCookieName))
{
return true;
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
index 5ff410a9c2..a544de4f17 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -1,7 +1,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Antiforgery;
-using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
@@ -14,22 +13,19 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
{
private IAntiforgery _antiforgery;
private readonly AntiforgeryOptions _antiforgeryOptions;
- private readonly IOptionsSnapshot _namedOptionsAccessor;
- private readonly AbpAntiForgeryOptions _abpAntiForgeryOptions;
+ private readonly AbpAntiForgeryAuthCookieNameProvider _antiForgeryAuthCookieNameProvider;
private readonly ILogger _logger;
public AbpValidateAntiforgeryTokenAuthorizationFilter(
IAntiforgery antiforgery,
IOptions antiforgeryOptions,
- IOptions abpAntiForgeryOptions,
- IOptionsSnapshot namedOptionsAccessor,
+ AbpAntiForgeryAuthCookieNameProvider antiForgeryAuthCookieNameProvider,
ILogger logger)
{
_antiforgery = antiforgery;
_antiforgeryOptions = antiforgeryOptions.Value;
- _namedOptionsAccessor = namedOptionsAccessor;
_logger = logger;
- _abpAntiForgeryOptions = abpAntiForgeryOptions.Value;
+ _antiForgeryAuthCookieNameProvider = antiForgeryAuthCookieNameProvider;
}
public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
@@ -66,11 +62,11 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
return false;
}
- var cookieAuthenticationOptions = _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthorizationCookieName);
+ var authCookieName = _antiForgeryAuthCookieNameProvider.GetNameOrNull();
//Always perform antiforgery validation when request contains authentication cookie
- if (cookieAuthenticationOptions?.Cookie.Name != null &&
- context.HttpContext.Request.Cookies.ContainsKey(cookieAuthenticationOptions.Cookie.Name))
+ if (authCookieName != null &&
+ context.HttpContext.Request.Cookies.ContainsKey(authCookieName))
{
return true;
}
From 989fd3f53db28be3971f677e186c515bba4c1ccc Mon Sep 17 00:00:00 2001
From: Mladen Macanovic
Date: Wed, 7 Oct 2020 10:22:31 +0200
Subject: [PATCH 042/108] Moved objects to their own file
---
...{IUiMessageNotifierService.cs => UiMessageEventArgs.cs} | 7 -------
.../src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs | 4 ++--
.../Components/UiMessageAlert.razor.cs | 2 +-
.../src/Volo.Abp.BlazoriseUI/UiMessageNotifierService.cs | 4 ++--
4 files changed, 5 insertions(+), 12 deletions(-)
rename framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/{IUiMessageNotifierService.cs => UiMessageEventArgs.cs} (77%)
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageNotifierService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageEventArgs.cs
similarity index 77%
rename from framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageNotifierService.cs
rename to framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageEventArgs.cs
index 456eb1bed7..4431d3c819 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IUiMessageNotifierService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiMessageEventArgs.cs
@@ -3,13 +3,6 @@ using System.Threading.Tasks;
namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
- public interface IUiMessageNotifierService
- {
- event EventHandler MessageReceived;
-
- Task NotifyMessageReceivedAsync(UiMessageType messageType, string message, string title, UiMessageOptions options, TaskCompletionSource callback = null);
- }
-
public class UiMessageEventArgs : EventArgs
{
public UiMessageEventArgs(UiMessageType messageType, string message, string title, UiMessageOptions options)
diff --git a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs
index 2c3481f313..70643069be 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs
@@ -9,11 +9,11 @@ namespace Volo.Abp.BlazoriseUI
[Dependency(ReplaceServices = true)]
public class BlazoriseUiMessageService : IUiMessageService, IScopedDependency
{
- private readonly IUiMessageNotifierService uiMessageNotifierService;
+ private readonly UiMessageNotifierService uiMessageNotifierService;
public ILogger Logger { get; set; }
- public BlazoriseUiMessageService(IUiMessageNotifierService uiMessageNotifierService)
+ public BlazoriseUiMessageService(UiMessageNotifierService uiMessageNotifierService)
{
this.uiMessageNotifierService = uiMessageNotifierService;
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
index a3cd3f8f1e..7dada11bd3 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor.cs
@@ -132,6 +132,6 @@ namespace Volo.Abp.BlazoriseUI.Components
[Parameter] public EventCallback Canceled { get; set; }
- [Inject] protected IUiMessageNotifierService UiMessageNotifierService { get; set; }
+ [Inject] protected UiMessageNotifierService UiMessageNotifierService { get; set; }
}
}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/UiMessageNotifierService.cs b/framework/src/Volo.Abp.BlazoriseUI/UiMessageNotifierService.cs
index c8ae0ecb0d..af49f993b5 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/UiMessageNotifierService.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/UiMessageNotifierService.cs
@@ -6,11 +6,11 @@ using Volo.Abp.DependencyInjection;
namespace Volo.Abp.BlazoriseUI
{
[Dependency(ReplaceServices = true)]
- public class UiMessageNotifierService : IUiMessageNotifierService, IScopedDependency
+ public class UiMessageNotifierService : IScopedDependency
{
public event EventHandler MessageReceived;
- public Task NotifyMessageReceivedAsync(UiMessageType messageType, string message, string title, UiMessageOptions options, TaskCompletionSource callback)
+ public Task NotifyMessageReceivedAsync(UiMessageType messageType, string message, string title, UiMessageOptions options, TaskCompletionSource callback = null)
{
MessageReceived?.Invoke(this, new UiMessageEventArgs(messageType, message, title, options, callback));
From 5884e4d85354009d0379ca5108db179070fb0ec4 Mon Sep 17 00:00:00 2001
From: Mladen Macanovic
Date: Wed, 7 Oct 2020 10:25:23 +0200
Subject: [PATCH 043/108] Removed project reference to Volo.Abp.BlazoriseUI
---
.../MyCompanyName.MyProjectName.Blazor.csproj | 1 -
1 file changed, 1 deletion(-)
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj
index ab574cea1d..cba18ad1bd 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj
@@ -15,7 +15,6 @@
-
From 5c6788575b22b3ebf7cf5b83448f982890315393 Mon Sep 17 00:00:00 2001
From: Yunus Emre Kalkan
Date: Wed, 7 Oct 2020 12:15:44 +0300
Subject: [PATCH 044/108] Tag helpers document revision & finalize
resolves https://github.com/volosoft/volo/issues/3187
---
docs/en/UI/AspNetCore/Tag-Helpers/Badges.md | 10 +++++-----
.../en/UI/AspNetCore/Tag-Helpers/Blockquote.md | 18 ++++++++++++++++++
docs/en/UI/AspNetCore/Tag-Helpers/Borders.md | 6 ++++--
.../UI/AspNetCore/Tag-Helpers/Breadcrumbs.md | 2 +-
.../UI/AspNetCore/Tag-Helpers/Button-groups.md | 2 +-
docs/en/UI/AspNetCore/Tag-Helpers/Carousel.md | 2 +-
docs/en/UI/AspNetCore/Tag-Helpers/Collapse.md | 2 +-
docs/en/UI/AspNetCore/Tag-Helpers/Figure.md | 14 ++++++++++++++
docs/en/UI/AspNetCore/Tag-Helpers/Index.md | 9 ++++++++-
docs/en/UI/AspNetCore/Tag-Helpers/Navs.md | 4 ++--
docs/en/UI/AspNetCore/Tag-Helpers/Paginator.md | 2 +-
docs/en/UI/AspNetCore/Tag-Helpers/Tables.md | 2 +-
12 files changed, 57 insertions(+), 16 deletions(-)
create mode 100644 docs/en/UI/AspNetCore/Tag-Helpers/Blockquote.md
create mode 100644 docs/en/UI/AspNetCore/Tag-Helpers/Figure.md
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Badges.md b/docs/en/UI/AspNetCore/Tag-Helpers/Badges.md
index 66727cc112..c627273062 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Badges.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Badges.md
@@ -2,11 +2,11 @@
## Introduction
-`abp-badge` and `abp-badge-pill` are abp tags for badges.
+`abp-badge` and `abp-badge-pill` are ABP Tag Helper attributes for `a` and `span` html tags.
Basic usage:
-````csharp
+````html
PrimaryInfoDanger
@@ -22,8 +22,7 @@ See the [badges demo page](https://bootstrap-taghelpers.abp.io/Components/Badges
* Indicates the type of the badge. Should be one of the following values:
- * `_` (default value)
- * `Default` (default value)
+ * `Default`
* `Primary`
* `Secondary`
* `Success`
@@ -35,6 +34,7 @@ See the [badges demo page](https://bootstrap-taghelpers.abp.io/Components/Badges
Example:
-````csharp
+````html
Danger
````
+
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Blockquote.md b/docs/en/UI/AspNetCore/Tag-Helpers/Blockquote.md
new file mode 100644
index 0000000000..a63187aeb3
--- /dev/null
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Blockquote.md
@@ -0,0 +1,18 @@
+# Blockquote
+
+`abp-blockquote` is the main container for blockquote items.
+
+Basic usages:
+
+````html
+
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
+
+
+
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
+
+
+````
+
+It adds `blockquote` class to main container, also adds `blockquote-footer` class to inner `footer` element and `mb-0` class to inner `p` element.
\ No newline at end of file
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Borders.md b/docs/en/UI/AspNetCore/Tag-Helpers/Borders.md
index 1dc070e8ad..e1d98ac7d8 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Borders.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Borders.md
@@ -2,11 +2,11 @@
## Introduction
-`abp-border` is a main element for border styling.
+`abp-border` is ABP Tag Helper attribute for border styling.
Basic usage:
-````csharp
+````html
@@ -124,3 +124,5 @@ A value indicates type, position and the color of the border. Should be one of t
* `Bottom_Light_0`
* `Bottom_Dark_0`
* `Bottom_White_0`
+
+(Values with `_0` at the end is for [Subtractive](https://getbootstrap.com/docs/4.0/utilities/borders/#subtractive) usages)
\ No newline at end of file
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Breadcrumbs.md b/docs/en/UI/AspNetCore/Tag-Helpers/Breadcrumbs.md
index 59332cf8de..b7082696c5 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Breadcrumbs.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Breadcrumbs.md
@@ -6,7 +6,7 @@
Basic usage:
-````csharp
+````html
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Button-groups.md b/docs/en/UI/AspNetCore/Tag-Helpers/Button-groups.md
index 93865e0d74..bfd558f89e 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Button-groups.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Button-groups.md
@@ -6,7 +6,7 @@
Basic usage:
-````csharp
+````html
LeftMiddle
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Carousel.md b/docs/en/UI/AspNetCore/Tag-Helpers/Carousel.md
index 6088977068..3b91087838 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Carousel.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Carousel.md
@@ -6,7 +6,7 @@
Basic usage:
-````csharp
+````html
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Collapse.md b/docs/en/UI/AspNetCore/Tag-Helpers/Collapse.md
index 38fab4d44b..dfbe8ea248 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Collapse.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Collapse.md
@@ -6,7 +6,7 @@
Basic usage:
-````xml
+````html
Link with href
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Figure.md b/docs/en/UI/AspNetCore/Tag-Helpers/Figure.md
new file mode 100644
index 0000000000..e3b0e0d0a4
--- /dev/null
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Figure.md
@@ -0,0 +1,14 @@
+# Figures
+
+`abp-figure` is the main container for bootstrap figure items.
+
+Basic usage:
+
+````html
+
+
+ A caption for the above image.
+
+````
+
+It adds `figure` class to main container, also adds `figure-img` class to inner `abp-image` element and `figure-caption` class to inner `abp-figcaption` element.
\ No newline at end of file
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Index.md b/docs/en/UI/AspNetCore/Tag-Helpers/Index.md
index 229460de92..54c37af688 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Index.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Index.md
@@ -13,19 +13,26 @@ ABP Framework also adds some **useful features** to the standard bootstrap compo
Here, the list of components those are wrapped by the ABP Framework:
* [Alerts](Alerts.md)
+* [Badges](Badges.md))
+* [Blockquote](Blockquote.md)
+* [Borders](Borders.md)
+* [Breadcrumb](Breadcrumb.md)
* [Buttons](Buttons.md)
* [Cards](Cards.md)
+* [Carousel](Carousel.md)
* [Collapse](Collapse.md)
* [Dropdowns](Dropdowns.md)
+* [Figures](Figure.md)
* [Grids](Grids.md)
* [List Groups](List-Groups.md)
* [Modals](Modals.md)
+* [Navigation](Navs.md)
* [Paginator](Paginator.md)
* [Popovers](Popovers.md)
* [Progress Bars](Progress-Bars.md)
+* [Tables](Tables.md)
* [Tabs](Tabs.md)
* [Tooltips](Tooltips.md)
-* ...
> Until all the tag helpers are documented, you can visit https://bootstrap-taghelpers.abp.io/ to see them with live samples.
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Navs.md b/docs/en/UI/AspNetCore/Tag-Helpers/Navs.md
index c7503fa51d..9c8347b831 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Navs.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Navs.md
@@ -6,7 +6,7 @@
Basic usage:
-````csharp
+````html
Active
@@ -78,7 +78,7 @@ See the [navs demo page](https://bootstrap-taghelpers.abp.io/Components/Navs) to
Example:
-````csharp
+````html
Navbar
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Paginator.md b/docs/en/UI/AspNetCore/Tag-Helpers/Paginator.md
index 9969bcf3cc..c30e68eed9 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Paginator.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Paginator.md
@@ -12,7 +12,7 @@ Basic usage:
Model:
-````xml
+````csharp
using Microsoft.AspNetCore.Mvc.RazorPages;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination;
diff --git a/docs/en/UI/AspNetCore/Tag-Helpers/Tables.md b/docs/en/UI/AspNetCore/Tag-Helpers/Tables.md
index 50e6c3baf9..db30db6a09 100644
--- a/docs/en/UI/AspNetCore/Tag-Helpers/Tables.md
+++ b/docs/en/UI/AspNetCore/Tag-Helpers/Tables.md
@@ -6,7 +6,7 @@
Basic usage:
-````csharp
+````html
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs
index 730da74983..7ac6682659 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Blazorise;
From 104244a05d21e632233f17c7d7387e9d437f55bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 14:27:41 +0300
Subject: [PATCH 047/108] Auto set antiforgery cookie
---
.../Themes/Basic/Layouts/Account.cshtml | 2 --
.../Themes/Basic/Layouts/Application.cshtml | 2 --
.../Themes/Basic/Layouts/Empty.cshtml | 2 --
.../AbpAntiForgeryAuthCookieNameProvider.cs | 2 +-
...pAntiForgeryManagerAspNetCoreExtensions.cs | 8 ++++--
.../Mvc/AntiForgery/AbpAntiForgeryOptions.cs | 26 +++++++++++++------
...dateAntiforgeryTokenAuthorizationFilter.cs | 3 ++-
.../AspNetCoreAbpAntiForgeryManager.cs | 8 ++++--
.../AbpApplicationConfigurationController.cs | 9 +++++--
...pplicationConfigurationScriptController.cs | 8 +++++-
10 files changed, 47 insertions(+), 23 deletions(-)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
index 5fcd5951cd..6ab5267b72 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
@@ -13,7 +13,6 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetStyles
@using Volo.Abp.MultiTenancy
@using Volo.Abp.Localization
-@inject IAbpAntiForgeryManager AbpAntiForgeryManager
@inject IBrandingProvider BrandingProvider
@inject IOptions MultiTenancyOptions
@inject ICurrentTenant CurrentTenant
@@ -22,7 +21,6 @@
@{
Layout = null;
- AbpAntiForgeryManager.SetCookie();
var containerClass = ViewBag.FluidLayout == true ? "container-fluid" : "container"; //TODO: Better and type-safe options
var rtl = CultureHelper.IsRtl ? "rtl" : string.Empty;
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml
index 7b06538510..d3ebd2f57f 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml
@@ -9,12 +9,10 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetScripts
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetStyles
@using Volo.Abp.Localization
-@inject IAbpAntiForgeryManager AbpAntiForgeryManager
@inject IBrandingProvider BrandingProvider
@inject IPageLayout PageLayout
@{
Layout = null;
- AbpAntiForgeryManager.SetCookie();
var containerClass = ViewBag.FluidLayout == true ? "container-fluid" : "container"; //TODO: Better and type-safe options
var pageTitle = ViewBag.Title == null ? BrandingProvider.AppName : ViewBag.Title; //TODO: Discard to get from Title
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml
index 9871bcbb25..2176782a70 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml
@@ -8,12 +8,10 @@
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetScripts
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetStyles
@using Volo.Abp.Localization
-@inject IAbpAntiForgeryManager AbpAntiForgeryManager
@inject IBrandingProvider BrandingProvider
@inject IPageLayout PageLayout
@{
Layout = null;
- AbpAntiForgeryManager.SetCookie();
var containerClass = ViewBag.FluidLayout == true ? "container-fluid" : "container"; //TODO: Better and type-safe options
var pageTitle = ViewBag.Title == null ? BrandingProvider.AppName : ViewBag.Title; //TODO: Discard to get from Title
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs
index 48b71e34ae..6cd18c82a4 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs
@@ -19,7 +19,7 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
public virtual string GetNameOrNull()
{
- return _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthCookieName)?.Cookie?.Name;
+ return _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthCookieSchemaName)?.Cookie?.Name;
}
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryManagerAspNetCoreExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryManagerAspNetCoreExtensions.cs
index c5c992b364..31ea869b06 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryManagerAspNetCoreExtensions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryManagerAspNetCoreExtensions.cs
@@ -4,7 +4,11 @@
{
public static void SetCookie(this IAbpAntiForgeryManager manager)
{
- manager.HttpContext.Response.Cookies.Append(manager.Options.TokenCookieName, manager.GenerateToken());
+ manager.HttpContext.Response.Cookies.Append(
+ manager.Options.TokenCookie.Name,
+ manager.GenerateToken(),
+ manager.Options.TokenCookie.Build(manager.HttpContext)
+ );
}
}
-}
\ No newline at end of file
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
index 5cfd1cf1e7..1e21482981 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
@@ -1,23 +1,33 @@
-namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
+using System;
+using Microsoft.AspNetCore.Http;
+
+namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
{
public class AbpAntiForgeryOptions
{
///
- /// Get/sets cookie name to transfer Anti Forgery token between server and client.
- /// Default value: "XSRF-TOKEN".
+ /// Use to set the cookie options to transfer Anti Forgery token between server and client.
+ /// Default name of the cookie: "XSRF-TOKEN".
///
- public string TokenCookieName { get; set; }
+ public CookieBuilder TokenCookie { get; }
///
/// Used to find auth cookie when validating Anti Forgery token.
- /// Default value: ".AspNetCore.Identity.Application".
+ /// Default value: "Identity.Application".
///
- public string AuthCookieName { get; set; }
+ public string AuthCookieSchemaName { get; set; }
public AbpAntiForgeryOptions()
{
- TokenCookieName = "XSRF-TOKEN";
- AuthCookieName = ".AspNetCore.Identity.Application";
+ TokenCookie = new CookieBuilder
+ {
+ Name = "XSRF-TOKEN",
+ HttpOnly = false,
+ IsEssential = true,
+ Expiration = TimeSpan.FromDays(3650) //10 years!
+ };
+
+ AuthCookieSchemaName = "Identity.Application";
}
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
index a544de4f17..2281899181 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -6,10 +6,11 @@ using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
+using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
{
- public class AbpValidateAntiforgeryTokenAuthorizationFilter : IAsyncAuthorizationFilter, IAntiforgeryPolicy
+ public class AbpValidateAntiforgeryTokenAuthorizationFilter : IAsyncAuthorizationFilter, IAntiforgeryPolicy, ITransientDependency
{
private IAntiforgery _antiforgery;
private readonly AntiforgeryOptions _antiforgeryOptions;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AspNetCoreAbpAntiForgeryManager.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AspNetCoreAbpAntiForgeryManager.cs
index f016c36671..ff1ec26d1c 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AspNetCoreAbpAntiForgeryManager.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AspNetCoreAbpAntiForgeryManager.cs
@@ -26,7 +26,11 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
public void SetCookie()
{
- HttpContext.Response.Cookies.Append(Options.TokenCookieName, GenerateToken());
+ HttpContext.Response.Cookies.Append(
+ Options.TokenCookie.Name,
+ GenerateToken(),
+ Options.TokenCookie.Build(HttpContext)
+ );
}
public string GenerateToken()
@@ -34,4 +38,4 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
return _antiforgery.GetAndStoreTokens(_httpContextAccessor.HttpContext).RequestToken;
}
}
-}
\ No newline at end of file
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs
index 67c373585e..89282110b9 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs
@@ -1,5 +1,6 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
+using Volo.Abp.AspNetCore.Mvc.AntiForgery;
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
{
@@ -9,17 +10,21 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
public class AbpApplicationConfigurationController : AbpController, IAbpApplicationConfigurationAppService
{
private readonly IAbpApplicationConfigurationAppService _applicationConfigurationAppService;
+ private readonly IAbpAntiForgeryManager _antiForgeryManager;
public AbpApplicationConfigurationController(
- IAbpApplicationConfigurationAppService applicationConfigurationAppService)
+ IAbpApplicationConfigurationAppService applicationConfigurationAppService,
+ IAbpAntiForgeryManager antiForgeryManager)
{
_applicationConfigurationAppService = applicationConfigurationAppService;
+ _antiForgeryManager = antiForgeryManager;
}
[HttpGet]
public async Task GetAsync()
{
+ _antiForgeryManager.SetCookie();
return await _applicationConfigurationAppService.GetAsync();
}
}
-}
\ No newline at end of file
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs
index d4ce99dc12..7a773d92eb 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs
@@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
+using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.Auditing;
using Volo.Abp.Http;
using Volo.Abp.Json;
@@ -20,17 +21,20 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
private readonly IJsonSerializer _jsonSerializer;
private readonly AbpAspNetCoreMvcOptions _options;
private readonly IJavascriptMinifier _javascriptMinifier;
+ private readonly IAbpAntiForgeryManager _antiForgeryManager;
public AbpApplicationConfigurationScriptController(
IAbpApplicationConfigurationAppService configurationAppService,
IJsonSerializer jsonSerializer,
IOptions options,
- IJavascriptMinifier javascriptMinifier)
+ IJavascriptMinifier javascriptMinifier,
+ IAbpAntiForgeryManager antiForgeryManager)
{
_configurationAppService = configurationAppService;
_jsonSerializer = jsonSerializer;
_options = options.Value;
_javascriptMinifier = javascriptMinifier;
+ _antiForgeryManager = antiForgeryManager;
}
[HttpGet]
@@ -39,6 +43,8 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
{
var script = CreateAbpExtendScript(await _configurationAppService.GetAsync());
+ _antiForgeryManager.SetCookie();
+
return Content(
_options.MinifyGeneratedScript == true
? _javascriptMinifier.Minify(script)
From e58842c8d6f4eaf7a8b613d0ebe238f2513b1fc4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 14:38:02 +0300
Subject: [PATCH 048/108] Check ABP's antiforgery cookie to determine the
validation logic.
---
...cs => AbpAntiForgeryCookieNameProvider.cs} | 11 +++++++---
...dateAntiforgeryTokenAuthorizationFilter.cs | 20 +++++++++----------
...dateAntiforgeryTokenAuthorizationFilter.cs | 17 ++++++++--------
3 files changed, 25 insertions(+), 23 deletions(-)
rename framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/{AbpAntiForgeryAuthCookieNameProvider.cs => AbpAntiForgeryCookieNameProvider.cs} (70%)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryCookieNameProvider.cs
similarity index 70%
rename from framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs
rename to framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryCookieNameProvider.cs
index 6cd18c82a4..fa51d168d6 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryAuthCookieNameProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryCookieNameProvider.cs
@@ -4,12 +4,12 @@ using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
{
- public class AbpAntiForgeryAuthCookieNameProvider : ITransientDependency
+ public class AbpAntiForgeryCookieNameProvider : ITransientDependency
{
private readonly IOptionsSnapshot _namedOptionsAccessor;
private readonly AbpAntiForgeryOptions _abpAntiForgeryOptions;
- public AbpAntiForgeryAuthCookieNameProvider(
+ public AbpAntiForgeryCookieNameProvider(
IOptionsSnapshot namedOptionsAccessor,
IOptions abpAntiForgeryOptions)
{
@@ -17,9 +17,14 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
_abpAntiForgeryOptions = abpAntiForgeryOptions.Value;
}
- public virtual string GetNameOrNull()
+ public virtual string GetAuthCookieNameOrNull()
{
return _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthCookieSchemaName)?.Cookie?.Name;
}
+
+ public virtual string GetAntiForgeryCookieNameOrNull()
+ {
+ return _abpAntiForgeryOptions.TokenCookie.Name;
+ }
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
index c0dbcd246a..8858058375 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -2,29 +2,24 @@ using System;
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
{
public class AbpAutoValidateAntiforgeryTokenAuthorizationFilter : AbpValidateAntiforgeryTokenAuthorizationFilter, ITransientDependency
{
- private readonly AntiforgeryOptions _antiforgeryOptions;
- private readonly AbpAntiForgeryAuthCookieNameProvider _antiForgeryAuthCookieNameProvider;
+ private readonly AbpAntiForgeryCookieNameProvider _antiForgeryCookieNameProvider;
public AbpAutoValidateAntiforgeryTokenAuthorizationFilter(
IAntiforgery antiforgery,
- IOptions antiforgeryOptions,
- AbpAntiForgeryAuthCookieNameProvider antiForgeryAuthCookieNameProvider,
+ AbpAntiForgeryCookieNameProvider antiForgeryCookieNameProvider,
ILogger logger)
: base(
antiforgery,
- antiforgeryOptions,
- antiForgeryAuthCookieNameProvider,
+ antiForgeryCookieNameProvider,
logger)
{
- _antiForgeryAuthCookieNameProvider = antiForgeryAuthCookieNameProvider;
- _antiforgeryOptions = antiforgeryOptions.Value;
+ _antiForgeryCookieNameProvider = antiForgeryCookieNameProvider;
}
protected override bool ShouldValidate(AuthorizationFilterContext context)
@@ -34,7 +29,7 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
return false;
}
- var authCookieName = _antiForgeryAuthCookieNameProvider.GetNameOrNull();
+ var authCookieName = _antiForgeryCookieNameProvider.GetAuthCookieNameOrNull();
//Always perform antiforgery validation when request contains authentication cookie
if (authCookieName != null &&
@@ -43,10 +38,13 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
return true;
}
+ var antiForgeryCookieName = _antiForgeryCookieNameProvider.GetAntiForgeryCookieNameOrNull();
+
//No need to validate if antiforgery cookie is not sent.
//That means the request is sent from a non-browser client.
//See https://github.com/aspnet/Antiforgery/issues/115
- if (!context.HttpContext.Request.Cookies.ContainsKey(_antiforgeryOptions.Cookie.Name))
+ if (antiForgeryCookieName != null &&
+ !context.HttpContext.Request.Cookies.ContainsKey(antiForgeryCookieName))
{
return false;
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
index 2281899181..abb7107bf9 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
@@ -13,20 +12,17 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
public class AbpValidateAntiforgeryTokenAuthorizationFilter : IAsyncAuthorizationFilter, IAntiforgeryPolicy, ITransientDependency
{
private IAntiforgery _antiforgery;
- private readonly AntiforgeryOptions _antiforgeryOptions;
- private readonly AbpAntiForgeryAuthCookieNameProvider _antiForgeryAuthCookieNameProvider;
+ private readonly AbpAntiForgeryCookieNameProvider _antiForgeryCookieNameProvider;
private readonly ILogger _logger;
public AbpValidateAntiforgeryTokenAuthorizationFilter(
IAntiforgery antiforgery,
- IOptions antiforgeryOptions,
- AbpAntiForgeryAuthCookieNameProvider antiForgeryAuthCookieNameProvider,
+ AbpAntiForgeryCookieNameProvider antiForgeryCookieNameProvider,
ILogger logger)
{
_antiforgery = antiforgery;
- _antiforgeryOptions = antiforgeryOptions.Value;
_logger = logger;
- _antiForgeryAuthCookieNameProvider = antiForgeryAuthCookieNameProvider;
+ _antiForgeryCookieNameProvider = antiForgeryCookieNameProvider;
}
public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
@@ -63,7 +59,7 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
return false;
}
- var authCookieName = _antiForgeryAuthCookieNameProvider.GetNameOrNull();
+ var authCookieName = _antiForgeryCookieNameProvider.GetAuthCookieNameOrNull();
//Always perform antiforgery validation when request contains authentication cookie
if (authCookieName != null &&
@@ -72,10 +68,13 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
return true;
}
+ var antiForgeryCookieName = _antiForgeryCookieNameProvider.GetAntiForgeryCookieNameOrNull();
+
//No need to validate if antiforgery cookie is not sent.
//That means the request is sent from a non-browser client.
//See https://github.com/aspnet/Antiforgery/issues/115
- if (!context.HttpContext.Request.Cookies.ContainsKey(_antiforgeryOptions.Cookie.Name))
+ if (antiForgeryCookieName != null &&
+ !context.HttpContext.Request.Cookies.ContainsKey(antiForgeryCookieName))
{
return false;
}
From 0cf934889855c87a5dfb5936118f54afdbbd14da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 14:45:55 +0300
Subject: [PATCH 049/108] Refactor
AbpAutoValidateAntiforgeryTokenAuthorizationFilter: Reduce duplication.
---
...dateAntiforgeryTokenAuthorizationFilter.cs | 50 +++----------------
...dateAntiforgeryTokenAuthorizationFilter.cs | 15 ------
2 files changed, 8 insertions(+), 57 deletions(-)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
index 8858058375..04142d680e 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -8,8 +8,6 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
{
public class AbpAutoValidateAntiforgeryTokenAuthorizationFilter : AbpValidateAntiforgeryTokenAuthorizationFilter, ITransientDependency
{
- private readonly AbpAntiForgeryCookieNameProvider _antiForgeryCookieNameProvider;
-
public AbpAutoValidateAntiforgeryTokenAuthorizationFilter(
IAntiforgery antiforgery,
AbpAntiForgeryCookieNameProvider antiForgeryCookieNameProvider,
@@ -19,58 +17,26 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
antiForgeryCookieNameProvider,
logger)
{
- _antiForgeryCookieNameProvider = antiForgeryCookieNameProvider;
+
}
protected override bool ShouldValidate(AuthorizationFilterContext context)
{
- if (!ShouldValidateInternal(context))
- {
- return false;
- }
-
- var authCookieName = _antiForgeryCookieNameProvider.GetAuthCookieNameOrNull();
-
- //Always perform antiforgery validation when request contains authentication cookie
- if (authCookieName != null &&
- context.HttpContext.Request.Cookies.ContainsKey(authCookieName))
- {
- return true;
- }
-
- var antiForgeryCookieName = _antiForgeryCookieNameProvider.GetAntiForgeryCookieNameOrNull();
-
- //No need to validate if antiforgery cookie is not sent.
- //That means the request is sent from a non-browser client.
- //See https://github.com/aspnet/Antiforgery/issues/115
- if (antiForgeryCookieName != null &&
- !context.HttpContext.Request.Cookies.ContainsKey(antiForgeryCookieName))
+ if (IsIgnoredHttpMethod(context))
{
return false;
}
- // Anything else requires a token.
- return true;
+ return base.ShouldValidate(context);
}
- private static bool ShouldValidateInternal(AuthorizationFilterContext context)
+ protected virtual bool IsIgnoredHttpMethod(AuthorizationFilterContext context)
{
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
var method = context.HttpContext.Request.Method;
- if (string.Equals("GET", method, StringComparison.OrdinalIgnoreCase) ||
- string.Equals("HEAD", method, StringComparison.OrdinalIgnoreCase) ||
- string.Equals("TRACE", method, StringComparison.OrdinalIgnoreCase) ||
- string.Equals("OPTIONS", method, StringComparison.OrdinalIgnoreCase))
- {
- return false;
- }
-
- // Anything else requires a token.
- return true;
+ return string.Equals("GET", method, StringComparison.OrdinalIgnoreCase) ||
+ string.Equals("HEAD", method, StringComparison.OrdinalIgnoreCase) ||
+ string.Equals("TRACE", method, StringComparison.OrdinalIgnoreCase) ||
+ string.Equals("OPTIONS", method, StringComparison.OrdinalIgnoreCase);
}
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
index abb7107bf9..fd0c5e6a01 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -54,11 +54,6 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
protected virtual bool ShouldValidate(AuthorizationFilterContext context)
{
- if (!ShouldValidateInternal(context))
- {
- return false;
- }
-
var authCookieName = _antiForgeryCookieNameProvider.GetAuthCookieNameOrNull();
//Always perform antiforgery validation when request contains authentication cookie
@@ -82,15 +77,5 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
// Anything else requires a token.
return true;
}
-
- private static bool ShouldValidateInternal(AuthorizationFilterContext context)
- {
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- return true;
- }
}
}
From 9e7a64415795751722caec6ecde7894b118c3f64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 14:51:40 +0300
Subject: [PATCH 050/108] Remove AbpAntiForgeryPreOptions
---
.../Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 7 +------
.../Mvc/AntiForgery/AbpAntiForgeryOptions.cs | 6 ++++++
.../Mvc/AntiForgery/AbpAntiForgeryPreOptions.cs | 10 ----------
...AutoValidateAntiforgeryTokenAuthorizationFilter.cs | 11 ++++++++++-
4 files changed, 17 insertions(+), 17 deletions(-)
delete mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryPreOptions.cs
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
index f1efac83ce..3097a3c725 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
@@ -95,14 +95,9 @@ namespace Volo.Abp.AspNetCore.Mvc
}
});
- var antiForgeryPreOptions = context.Services.ExecutePreConfiguredActions();
-
var mvcCoreBuilder = context.Services.AddMvcCore(options =>
{
- if (antiForgeryPreOptions.AutoValidate)
- {
- options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
- }
+ options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
});
context.Services.ExecutePreConfiguredActions(mvcCoreBuilder);
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
index 1e21482981..f46763ab0c 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
@@ -17,6 +18,11 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
///
public string AuthCookieSchemaName { get; set; }
+ ///
+ /// Default value: true.
+ ///
+ public bool AutoValidate { get; set; } = true;
+
public AbpAntiForgeryOptions()
{
TokenCookie = new CookieBuilder
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryPreOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryPreOptions.cs
deleted file mode 100644
index 887153fd1b..0000000000
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryPreOptions.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
-{
- public class AbpAntiForgeryPreOptions
- {
- ///
- /// Default value: true.
- ///
- public bool AutoValidate { get; set; } = true;
- }
-}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
index 04142d680e..40ed6fc509 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -2,26 +2,35 @@ using System;
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
{
public class AbpAutoValidateAntiforgeryTokenAuthorizationFilter : AbpValidateAntiforgeryTokenAuthorizationFilter, ITransientDependency
{
+ private readonly AbpAntiForgeryOptions _options;
+
public AbpAutoValidateAntiforgeryTokenAuthorizationFilter(
IAntiforgery antiforgery,
AbpAntiForgeryCookieNameProvider antiForgeryCookieNameProvider,
+ IOptions options,
ILogger logger)
: base(
antiforgery,
antiForgeryCookieNameProvider,
logger)
{
-
+ _options = options.Value;
}
protected override bool ShouldValidate(AuthorizationFilterContext context)
{
+ if (!_options.AutoValidate)
+ {
+ return false;
+ }
+
if (IsIgnoredHttpMethod(context))
{
return false;
From 71c97a0d8962175090e4a18633cff362fdfa2791 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 15:27:46 +0300
Subject: [PATCH 051/108] Added antiforgery options
---
.../AbpAntiForgeryCookieNameProvider.cs | 5 ++++
.../Mvc/AntiForgery/AbpAntiForgeryOptions.cs | 29 +++++++++++++++++++
...dateAntiforgeryTokenAuthorizationFilter.cs | 24 +++++++++++----
.../System/AbpObjectExtensions.cs | 14 ++++++++-
4 files changed, 66 insertions(+), 6 deletions(-)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryCookieNameProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryCookieNameProvider.cs
index fa51d168d6..66cd8701de 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryCookieNameProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryCookieNameProvider.cs
@@ -19,6 +19,11 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
public virtual string GetAuthCookieNameOrNull()
{
+ if (_abpAntiForgeryOptions.AuthCookieSchemaName == null)
+ {
+ return null;
+ }
+
return _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthCookieSchemaName)?.Cookie?.Name;
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
index f46763ab0c..44c35e9e0a 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using JetBrains.Annotations;
using Microsoft.AspNetCore.Http;
namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
@@ -23,8 +24,34 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
///
public bool AutoValidate { get; set; } = true;
+ ///
+ /// A predicate to filter types to auto-validate.
+ /// Return true to select the type to validate.
+ /// Default: returns true for all given types.
+ ///
+ [NotNull]
+ public Predicate AutoValidateFilter
+ {
+ get => _autoValidateFilter;
+ set => _autoValidateFilter = Check.NotNull(value, nameof(value));
+ }
+ private Predicate _autoValidateFilter;
+
+ ///
+ /// Default methods: "GET", "HEAD", "TRACE", "OPTIONS".
+ ///
+ [NotNull]
+ public HashSet AutoValidateIgnoredHttpMethods
+ {
+ get => _autoValidateIgnoredHttpMethods;
+ set => _autoValidateIgnoredHttpMethods = Check.NotNull(value, nameof(value));
+ }
+ private HashSet _autoValidateIgnoredHttpMethods;
+
public AbpAntiForgeryOptions()
{
+ AutoValidateFilter = type => true;
+
TokenCookie = new CookieBuilder
{
Name = "XSRF-TOKEN",
@@ -34,6 +61,8 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
};
AuthCookieSchemaName = "Identity.Application";
+
+ AutoValidateIgnoredHttpMethods = new HashSet {"GET", "HEAD", "TRACE", "OPTIONS"};
}
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
index 40ed6fc509..8affb3aa08 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAutoValidateAntiforgeryTokenAuthorizationFilter.cs
@@ -1,5 +1,6 @@
using System;
using Microsoft.AspNetCore.Antiforgery;
+using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@@ -31,6 +32,19 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
return false;
}
+ if(context.ActionDescriptor.IsControllerAction())
+ {
+ var controllerType = context.ActionDescriptor
+ .AsControllerActionDescriptor()
+ .ControllerTypeInfo
+ .AsType();
+
+ if (!_options.AutoValidateFilter(controllerType))
+ {
+ return false;
+ }
+ }
+
if (IsIgnoredHttpMethod(context))
{
return false;
@@ -41,11 +55,11 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
protected virtual bool IsIgnoredHttpMethod(AuthorizationFilterContext context)
{
- var method = context.HttpContext.Request.Method;
- return string.Equals("GET", method, StringComparison.OrdinalIgnoreCase) ||
- string.Equals("HEAD", method, StringComparison.OrdinalIgnoreCase) ||
- string.Equals("TRACE", method, StringComparison.OrdinalIgnoreCase) ||
- string.Equals("OPTIONS", method, StringComparison.OrdinalIgnoreCase);
+ return context.HttpContext
+ .Request
+ .Method
+ .ToUpperInvariant()
+ .IsIn(_options.AutoValidateIgnoredHttpMethods);
}
}
}
diff --git a/framework/src/Volo.Abp.Core/System/AbpObjectExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpObjectExtensions.cs
index d1067a383f..958398e0c5 100644
--- a/framework/src/Volo.Abp.Core/System/AbpObjectExtensions.cs
+++ b/framework/src/Volo.Abp.Core/System/AbpObjectExtensions.cs
@@ -1,4 +1,5 @@
-using System.ComponentModel;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.Globalization;
using System.Linq;
@@ -49,6 +50,17 @@ namespace System
return list.Contains(item);
}
+ ///
+ /// Check if an item is in the given enumerable.
+ ///
+ /// Item to check
+ /// Items
+ /// Type of the items
+ public static bool IsIn(this T item, IEnumerable items)
+ {
+ return items.Contains(item);
+ }
+
///
/// Can be used to conditionally perform a function
/// on an object and return the modified or the original object.
From e99380a3c1033315301cc21a8a6611c3ab52a7f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 15:51:26 +0300
Subject: [PATCH 052/108] Resolved #5729: Change
abp.security.antiForgery.tokenHeaderName to `RequestVerificationToken` on MVC
UI client script.
---
.../wwwroot/libs/abp/core/abp.js | 2 +-
.../wwwroot/libs/abp/core/abp.js | 2 +-
.../app/Volo.BloggingTestApp/wwwroot/libs/abp/core/abp.js | 2 +-
.../Volo.ClientSimulation.Demo/wwwroot/libs/abp/core/abp.js | 2 +-
.../Volo.CmsKit.IdentityServer/wwwroot/libs/abp/core/abp.js | 2 +-
.../host/Volo.CmsKit.Web.Host/wwwroot/libs/abp/core/abp.js | 2 +-
.../host/Volo.CmsKit.Web.Unified/wwwroot/libs/abp/core/abp.js | 2 +-
modules/docs/app/VoloDocs.Web/wwwroot/libs/abp/core/abp.js | 2 +-
.../wwwroot/libs/abp/core/abp.js | 2 +-
npm/packs/core/src/abp.js | 2 +-
.../wwwroot/libs/abp/core/abp.js | 2 +-
.../wwwroot/libs/abp/core/abp.js | 2 +-
.../wwwroot/libs/abp/core/abp.js | 2 +-
.../wwwroot/libs/abp/core/abp.js | 2 +-
.../wwwroot/libs/abp/core/abp.js | 2 +-
.../wwwroot/libs/abp/core/abp.js | 2 +-
.../wwwroot/libs/abp/core/abp.js | 2 +-
17 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/wwwroot/libs/abp/core/abp.js b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/wwwroot/libs/abp/core/abp.js
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/wwwroot/libs/abp/core/abp.js b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/wwwroot/libs/abp/core/abp.js
+++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/abp/core/abp.js b/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/abp/core/abp.js
+++ b/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/wwwroot/libs/abp/core/abp.js b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/wwwroot/libs/abp/core/abp.js
+++ b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/wwwroot/libs/abp/core/abp.js b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/wwwroot/libs/abp/core/abp.js
+++ b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Host/wwwroot/libs/abp/core/abp.js b/modules/cms-kit/host/Volo.CmsKit.Web.Host/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/modules/cms-kit/host/Volo.CmsKit.Web.Host/wwwroot/libs/abp/core/abp.js
+++ b/modules/cms-kit/host/Volo.CmsKit.Web.Host/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/abp/core/abp.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/abp/core/abp.js
+++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/modules/docs/app/VoloDocs.Web/wwwroot/libs/abp/core/abp.js b/modules/docs/app/VoloDocs.Web/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/modules/docs/app/VoloDocs.Web/wwwroot/libs/abp/core/abp.js
+++ b/modules/docs/app/VoloDocs.Web/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/modules/virtual-file-explorer/app/Volo.Abp.VirtualFileExplorer.DemoApp/wwwroot/libs/abp/core/abp.js b/modules/virtual-file-explorer/app/Volo.Abp.VirtualFileExplorer.DemoApp/wwwroot/libs/abp/core/abp.js
index 01df49a726..c0d26c7553 100644
--- a/modules/virtual-file-explorer/app/Volo.Abp.VirtualFileExplorer.DemoApp/wwwroot/libs/abp/core/abp.js
+++ b/modules/virtual-file-explorer/app/Volo.Abp.VirtualFileExplorer.DemoApp/wwwroot/libs/abp/core/abp.js
@@ -657,7 +657,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/npm/packs/core/src/abp.js b/npm/packs/core/src/abp.js
index 20bd92147a..72af4bd106 100644
--- a/npm/packs/core/src/abp.js
+++ b/npm/packs/core/src/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/wwwroot/libs/abp/core/abp.js b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/wwwroot/libs/abp/core/abp.js
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/wwwroot/libs/abp/core/abp.js b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/wwwroot/libs/abp/core/abp.js
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/wwwroot/libs/abp/core/abp.js b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/wwwroot/libs/abp/core/abp.js
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/wwwroot/libs/abp/core/abp.js b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/wwwroot/libs/abp/core/abp.js
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/wwwroot/libs/abp/core/abp.js b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/wwwroot/libs/abp/core/abp.js
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/wwwroot/libs/abp/core/abp.js b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/wwwroot/libs/abp/core/abp.js
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/wwwroot/libs/abp/core/abp.js b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/wwwroot/libs/abp/core/abp.js
index 20bd92147a..72af4bd106 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/wwwroot/libs/abp/core/abp.js
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/wwwroot/libs/abp/core/abp.js
@@ -689,7 +689,7 @@ var abp = abp || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
- abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
+ abp.security.antiForgery.tokenHeaderName = 'RequestVerificationToken';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
From e2a648e2506eedb5563ecf90b7691cc994fe5d94 Mon Sep 17 00:00:00 2001
From: Yunus Emre Kalkan
Date: Wed, 7 Oct 2020 16:44:01 +0300
Subject: [PATCH 053/108] Fix: Form button/icon alignment/spacing problem
resolves https://github.com/abpframework/abp/issues/5730
---
.../TagHelpers/Button/AbpButtonTagHelperServiceBase.cs | 3 ++-
.../TagHelpers/Modal/AbpModalFooterTagHelperService.cs | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpButtonTagHelperServiceBase.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpButtonTagHelperServiceBase.cs
index ab35dbe804..ff0b9dd34f 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpButtonTagHelperServiceBase.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpButtonTagHelperServiceBase.cs
@@ -47,6 +47,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Button
var icon = new TagBuilder("i");
icon.AddCssClass(GetIconClass(context, output));
output.Content.AppendHtml(icon);
+ output.Content.Append(" ");
}
protected virtual string GetIconClass(TagHelperContext context, TagHelperOutput output)
@@ -80,4 +81,4 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Button
}
}
}
-}
\ No newline at end of file
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Modal/AbpModalFooterTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Modal/AbpModalFooterTagHelperService.cs
index 1bc6ab2f3a..31cccf2428 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Modal/AbpModalFooterTagHelperService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Modal/AbpModalFooterTagHelperService.cs
@@ -45,12 +45,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
sb.AppendLine(GetSaveButton());
break;
case AbpModalButtons.Save | AbpModalButtons.Cancel:
- sb.AppendLine(GetSaveButton());
sb.AppendLine(GetCancelButton());
+ sb.AppendLine(GetSaveButton());
break;
case AbpModalButtons.Save | AbpModalButtons.Close:
- sb.AppendLine(GetSaveButton());
sb.AppendLine(GetCloseButton());
+ sb.AppendLine(GetSaveButton());
break;
}
@@ -72,6 +72,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
element.AddCssClass("btn-primary");
element.Attributes.Add("data-busy-text", _localizer["SavingWithThreeDot"]);
element.InnerHtml.AppendHtml(icon);
+ element.InnerHtml.AppendHtml(" ");
element.InnerHtml.AppendHtml(span);
return element.ToHtmlString();
From 9aec4f3ce35216731db05a4b462a57d64b2adf8b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 17:18:32 +0300
Subject: [PATCH 054/108] set SameSiteMode.None for the antiforgery token
cookie
---
.../Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
index 44c35e9e0a..197cab8ac6 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
@@ -57,6 +57,7 @@ namespace Volo.Abp.AspNetCore.Mvc.AntiForgery
Name = "XSRF-TOKEN",
HttpOnly = false,
IsEssential = true,
+ SameSite = SameSiteMode.None,
Expiration = TimeSpan.FromDays(3650) //10 years!
};
From 903136da5197d14e28fd0f2f95c61246c31a87a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 17:18:36 +0300
Subject: [PATCH 055/108] Update yarn.lock
---
templates/app/angular/yarn.lock | 348 ++++++++++++++++----------------
1 file changed, 174 insertions(+), 174 deletions(-)
diff --git a/templates/app/angular/yarn.lock b/templates/app/angular/yarn.lock
index 06f1ac1597..49c2064d0d 100644
--- a/templates/app/angular/yarn.lock
+++ b/templates/app/angular/yarn.lock
@@ -2,24 +2,24 @@
# yarn lockfile v1
-"@abp/ng.account@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.account/-/ng.account-3.1.2.tgz#42f95ad70f06586848737ad5e18461a193a51348"
- integrity sha512-sFJPvak4pGbX0dDtVjBhY0slRRI0oTz8reJqcFfpUywPMJj2VsCz97W70xB33Yr/mQZDg6BjhXkrl15GdyWt2w==
+"@abp/ng.account@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.account/-/ng.account-3.2.0.tgz#95323fe873a91ed96f5604d0791dbf78b4245f31"
+ integrity sha512-0OKVYJ1uB33VCa+IReyz0VSb9ku4OJYG+6b1hrqCJcJCzqzbltCxCVVJ31FvrYDoEah3E1TNQIzTxvbCuoG8YA==
dependencies:
- "@abp/ng.theme.shared" "~3.1.2"
+ "@abp/ng.theme.shared" "~3.2.0"
tslib "^2.0.0"
-"@abp/ng.core@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-3.1.2.tgz#edc2de8fa7332f4bd17ddeaee94c52aa8bb51fcc"
- integrity sha512-ura5fD4ZIJhLD97WrSNILoFfwFqJJJOygeZuGpfslCbeNM1JEf4Jk4XQzfnk7u+xW7IgtBZXtisheIuY2taawA==
+"@abp/ng.core@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-3.2.0.tgz#6970a9a483c3796af7b7db2af3d5c3c6cfd7410c"
+ integrity sha512-AYNrWi41hFpM6zOc2K/l13r6gmLu99QUbHr1dwsp+goGXo0UZ1dLJ3HtxNnwte4Wx2U2DmkLPvVovCHxcXbXAA==
dependencies:
- "@abp/utils" "^3.1.1"
+ "@abp/utils" "^3.2.0-rc.2"
"@angular/localize" "~10.0.10"
- "@ngxs/router-plugin" "^3.6.2"
- "@ngxs/storage-plugin" "^3.6.2"
- "@ngxs/store" "^3.6.2"
+ "@ngxs/router-plugin" "^3.7.0"
+ "@ngxs/storage-plugin" "^3.7.0"
+ "@ngxs/store" "^3.7.0"
angular-oauth2-oidc "^10.0.0"
just-clone "^3.1.0"
just-compare "^1.3.0"
@@ -27,35 +27,35 @@
ts-toolbelt "6.15.4"
tslib "^2.0.0"
-"@abp/ng.feature-management@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-3.1.2.tgz#91269097f925bc0772c443d688f46070fce5def9"
- integrity sha512-s59KNoOY2TWuume2iAzdKz9GBFVyj3q0BmhL7hW6IgyV96Zg9FP+UKYCXvPM8HtsLmXis3Zrv7TnJDAF+5VrHw==
+"@abp/ng.feature-management@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-3.2.0.tgz#0ebe620f84b206ea87d876b791359b9d97e46c92"
+ integrity sha512-Up7BuPmp24/zmwllHAe6AqnbgwtiV2YnMQApsEnh2Mv+d8LfvGQEeqSILIYebovHod6rkEvIWrpXQBAwOF8O6Q==
dependencies:
- "@abp/ng.theme.shared" "~3.1.2"
+ "@abp/ng.theme.shared" "~3.2.0"
tslib "^2.0.0"
-"@abp/ng.identity@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-3.1.2.tgz#6d039a6cbb431c61a8bf9d291c1e6bf2120e478e"
- integrity sha512-p+NGSuSd6OPxDZQr7iOhUIWTkpzyGUcphy6iloDgXX9YoTdIoh03ZMMJMpR6UBmPYLjPpP4U/eUFVxi2DjdCzA==
+"@abp/ng.identity@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-3.2.0.tgz#3ab2e8d1813c6ddbceb4e7edb1de5fe28d4b1e39"
+ integrity sha512-7dP6Hbkr6lML1R2hjGxzZI65cjTvKPdOR2/OCYw2UxoCshQLqj0aiMxzzul+sMX2EFQCb5dLDuSJouK0CveyJg==
dependencies:
- "@abp/ng.permission-management" "~3.1.2"
- "@abp/ng.theme.shared" "~3.1.2"
+ "@abp/ng.permission-management" "~3.2.0"
+ "@abp/ng.theme.shared" "~3.2.0"
tslib "^2.0.0"
-"@abp/ng.permission-management@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-3.1.2.tgz#bacc09d3e92262d111734e4ffc4344300b16f978"
- integrity sha512-nqLo3VFNFeouU33qQHK0abbKCjSlT9VXJk0WYzsiS2Z7lENYqtImRCxqpHlB32ACIdMMUWbmo8OMvYzpt++kRg==
+"@abp/ng.permission-management@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-3.2.0.tgz#43f7b3c2dca3c066c4ade8d137e3705a0480a55e"
+ integrity sha512-iPbAhYx8arAwMQ88hxTGSWFwv1UXxxrxSA0IefjCUAX2sdvIC/2WVcfo7UcS5DxM4TIu/+9TKsWC4gRR/8bHsQ==
dependencies:
- "@abp/ng.theme.shared" "~3.1.2"
+ "@abp/ng.theme.shared" "~3.2.0"
tslib "^2.0.0"
-"@abp/ng.schematics@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.schematics/-/ng.schematics-3.1.2.tgz#37a634ada068967468e68def9110ead6960bf8a4"
- integrity sha512-ULvkA/smLhErHLe6TdW0CzrortAf4Rjq/eshrMqS0A7EANzlw2TBpjZmn7kJSFawLTatDy9+GyQ8Cewc9H0VXA==
+"@abp/ng.schematics@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.schematics/-/ng.schematics-3.2.0.tgz#de45bddf14639b5cc2f39cd34f3b8250620aadaf"
+ integrity sha512-TV6jElMI4W7P/CmLkbhjzR9BsGdSx6C1SC4rlVvbKfwrpcTQ4jv4YJNOXHyk36EnwNMRu+TkUj+45MlOfEAQkw==
dependencies:
"@angular-devkit/core" "~10.0.3"
"@angular-devkit/schematics" "~10.0.3"
@@ -63,37 +63,37 @@
jsonc-parser "^2.3.0"
typescript "~3.9.2"
-"@abp/ng.setting-management@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-3.1.2.tgz#dda39e646e79e853b090c3f4af79181a65446af2"
- integrity sha512-o01Z7abV0kL4wwsOcRJZp8btev+X0qHCHfLf4u0zAwTjtXc4LzTtlU2hHLT19U42UYZlFUJvENnmTAhLnCLAVw==
+"@abp/ng.setting-management@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-3.2.0.tgz#f0e4cb4deba76cbe4b49f54977bf260b6f41f4d7"
+ integrity sha512-cEuVjljCE9N+lLZP3ZOhhnShvRCck0yeAXELzvG/GTsAlJkw99jWUQxG+UI7Dh7lBVhFg9oF4qyr0zzM8Wf/PA==
dependencies:
- "@abp/ng.theme.shared" "~3.1.2"
+ "@abp/ng.theme.shared" "~3.2.0"
tslib "^2.0.0"
-"@abp/ng.tenant-management@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-3.1.2.tgz#94fd626515575f8c0e361b36eb173a772ea3fc54"
- integrity sha512-vdPSBYYxWUSZxhDg2FMadndj+kZ3ddPkzgBaQldncIvhHsxLQCPwj4ZhqXJ7HHqvZ30JqGiJzk4Ejx0Rv5vu+Q==
+"@abp/ng.tenant-management@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-3.2.0.tgz#7402347ab45e11437838d4a1d5b4f52f908630f7"
+ integrity sha512-J0ma1fE/q/jDSoZpgV3eCZtd6NA9HrNHXkCi18QprfTAOCTqLipOvit60ed5rrPcZVbxdv8mnVTRtAaP/FnWLA==
dependencies:
- "@abp/ng.feature-management" "~3.1.2"
- "@abp/ng.theme.shared" "~3.1.2"
+ "@abp/ng.feature-management" "~3.2.0"
+ "@abp/ng.theme.shared" "~3.2.0"
tslib "^2.0.0"
-"@abp/ng.theme.basic@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-3.1.2.tgz#e60d15db641a13eebc76d7e793efdc5cf4a6a8f7"
- integrity sha512-gYS82euwyVU0D9GLXIqt8h1qtwqXtmu7KqIRyjb0IFi2iIvBGal6jMNKHk6wEI0A0/iNy6pra98bYPUZo+FKxQ==
+"@abp/ng.theme.basic@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-3.2.0.tgz#9a1a80050e37a2d029b0ec0b070f28c7afe06484"
+ integrity sha512-1z277I8mamzeSzYvJIwgwKXIPreH9CqQq0l+2tGu98HaivOxpkpWeWkviT3Xu6wGHILaTXtwBQMoae2AGEDL7A==
dependencies:
- "@abp/ng.theme.shared" "~3.1.2"
+ "@abp/ng.theme.shared" "~3.2.0"
tslib "^2.0.0"
-"@abp/ng.theme.shared@~3.1.2":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-3.1.2.tgz#b86940d569a992e72e279c34f50f4e4353b6ecc8"
- integrity sha512-/e0oB0azdms4QJTtw+7l95t/UmxU5CxQAB4RLIlbnuJFK4NXZObRjb2ujc6PqdaUCGh5djsWxNqVjkcsWcHX2Q==
+"@abp/ng.theme.shared@~3.2.0":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-3.2.0.tgz#0587daa9b88e274656ed7288c3280a80d90d17e0"
+ integrity sha512-DazYqnJGy5dfDZHQY0kfZF5hANHX+xSc25EFAkteEO4e9Y0XAM5Z3YPn/pdIkxmfBoXAeTiMOjkVeuhyHlgDew==
dependencies:
- "@abp/ng.core" "~3.1.2"
+ "@abp/ng.core" "~3.2.0"
"@fortawesome/fontawesome-free" "^5.14.0"
"@ng-bootstrap/ng-bootstrap" "^7.0.0"
"@ngx-validate/core" "^0.0.11"
@@ -102,30 +102,30 @@
chart.js "^2.9.3"
tslib "^2.0.0"
-"@abp/utils@^3.1.1":
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-3.1.2.tgz#e9bca8f6133dc2af587c45825e734d2accabcd96"
- integrity sha512-wnbHGQDGkQYazez1YSXAZ0ZDbsIZZr2ZN8V4LtOSAfzmYhPhFZ5qftoM0xoxlbmsuLLX6QtiPvxU35kEmlZPyg==
+"@abp/utils@^3.2.0-rc.2":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-3.2.0.tgz#084918379f2c5e43c1e52291ba6667f3ea3c1f33"
+ integrity sha512-DZsvF/I5o3r0D1+2B61KvJX78/tJ5uj9MaPq00Z/sxXdqsP2SQQmjhMm+Lb0FgGMK06XIoF9eDgM3Hu0y0H3cQ==
dependencies:
just-compare "^1.3.0"
-"@angular-devkit/architect@0.1001.1":
- version "0.1001.1"
- resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1001.1.tgz#ec17baf535160199dd7497a931ea60b185d82bfc"
- integrity sha512-2jRO7L/k9gNxHVJxPoUMVvtf/KzsSXNT7akbAbb8CkBJxjx3NC3Y9NssPD9E78kyiXogO6IvkwyalBGrWvOPBQ==
+"@angular-devkit/architect@0.1001.4":
+ version "0.1001.4"
+ resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1001.4.tgz#a10f11ab34cd76ecb469cbc5b06a95e82c9171da"
+ integrity sha512-0U/w+61vWxnEe9Ln/hNOH6O27FVcU+s/sbJAuPREbP875R4bQzK2PX0eYRlISzkDtQyw16GzlsikLWOoJ3vjTA==
dependencies:
- "@angular-devkit/core" "10.1.1"
+ "@angular-devkit/core" "10.1.4"
rxjs "6.6.2"
-"@angular-devkit/build-angular@~0.1001.1":
- version "0.1001.1"
- resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-0.1001.1.tgz#b896f5f32defa2750ca166c39ce28c700a21ef73"
- integrity sha512-61Ix8oXAdWfu2GSoD76n2vR2HxRYBoh5QrAqmxyMi9++0VrHw6myoVBXfeJ3PzdVkWy7oNMgFPCb3XQGTD73Ow==
+"@angular-devkit/build-angular@~0.1001.2":
+ version "0.1001.4"
+ resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-0.1001.4.tgz#b942d0299121783502da962015c010e27ffbd971"
+ integrity sha512-R2E9AJ3e7OwFEzStShW5W9F/tGz/JxYCzBdf8e7GkfujZjCVPRE3twRooFGfMlGEruUm/nC+Y0iFRnV0BLRKfw==
dependencies:
- "@angular-devkit/architect" "0.1001.1"
- "@angular-devkit/build-optimizer" "0.1001.1"
- "@angular-devkit/build-webpack" "0.1001.1"
- "@angular-devkit/core" "10.1.1"
+ "@angular-devkit/architect" "0.1001.4"
+ "@angular-devkit/build-optimizer" "0.1001.4"
+ "@angular-devkit/build-webpack" "0.1001.4"
+ "@angular-devkit/core" "10.1.4"
"@babel/core" "7.11.1"
"@babel/generator" "7.11.0"
"@babel/plugin-transform-runtime" "7.11.0"
@@ -133,7 +133,7 @@
"@babel/runtime" "7.11.2"
"@babel/template" "7.10.4"
"@jsdevtools/coverage-istanbul-loader" "3.0.5"
- "@ngtools/webpack" "10.1.1"
+ "@ngtools/webpack" "10.1.4"
autoprefixer "9.8.6"
babel-loader "8.1.0"
browserslist "^4.9.1"
@@ -188,18 +188,18 @@
webpack-subresource-integrity "1.4.1"
worker-plugin "5.0.0"
-"@angular-devkit/build-ng-packagr@~0.1001.1":
- version "0.1001.1"
- resolved "https://registry.yarnpkg.com/@angular-devkit/build-ng-packagr/-/build-ng-packagr-0.1001.1.tgz#c200d780e8071ae42c481f525c4a5540bff845b5"
- integrity sha512-KX5GuQvQypUpR+qF9qHzNC49GrHx6wsu+AoIily72xTU7+gri0pO2KxQ6aSQiGRENHtvfKYOxMUoeZUvlD2sBA==
+"@angular-devkit/build-ng-packagr@~0.1001.2":
+ version "0.1001.4"
+ resolved "https://registry.yarnpkg.com/@angular-devkit/build-ng-packagr/-/build-ng-packagr-0.1001.4.tgz#f6559a4dfe93b808e1c48165e95f118a25f0eab3"
+ integrity sha512-Ml8FF8q0obsxVzFttDgqzku0sZoJ8i7AYvaOM20L7gFD0JYPfdLBct7TKXVgr0kCO4WO83OJ0v0dk09ywMfCpA==
dependencies:
- "@angular-devkit/architect" "0.1001.1"
+ "@angular-devkit/architect" "0.1001.4"
rxjs "6.6.2"
-"@angular-devkit/build-optimizer@0.1001.1":
- version "0.1001.1"
- resolved "https://registry.yarnpkg.com/@angular-devkit/build-optimizer/-/build-optimizer-0.1001.1.tgz#9c765189c3ce62e361be5f77f03bb6648a9597e3"
- integrity sha512-ZjIK0YuE1lQ5X1YM+WAxuuJ5g/g7F97YXlDXEo8wsfIia6dAW4gI7Q8f+lgoqxBwgmxuYEyd4DFHNZZqnH3smQ==
+"@angular-devkit/build-optimizer@0.1001.4":
+ version "0.1001.4"
+ resolved "https://registry.yarnpkg.com/@angular-devkit/build-optimizer/-/build-optimizer-0.1001.4.tgz#566dea3bfd15d851ac70ecc7ecf3e98fee40e98c"
+ integrity sha512-ZBJF87QFOBq1zQOXDQOEHxCGSZeIgzyddQKNVuVqlPklJHBHYSaUiCKU4Dd+ZdAHQ5FqFlgO3gnYuyy6zaJU6Q==
dependencies:
loader-utils "2.0.0"
source-map "0.7.3"
@@ -207,13 +207,13 @@
typescript "4.0.2"
webpack-sources "1.4.3"
-"@angular-devkit/build-webpack@0.1001.1":
- version "0.1001.1"
- resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1001.1.tgz#606e30fe170e3af29e2721b2d33c66956ec5f7b8"
- integrity sha512-Qm8xhv/1WtAAwX10x6plji4cCnwX0jSmjAQUAkOlpz8iRxygqqKMHWn8BgeF3QxUuerA4kpnT0ym3c+biQIQCg==
+"@angular-devkit/build-webpack@0.1001.4":
+ version "0.1001.4"
+ resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1001.4.tgz#cbdf5a97a2bbe099abeb294d20546b2c475a3d9c"
+ integrity sha512-4n9pcBD7JE2Cpg3zFBPEOr2r//c3EwnAqFOcDLA3rXt0AUsbnm9H8xPTwb6MHOEMyWS/fscNqYLFGHnVZiunEg==
dependencies:
- "@angular-devkit/architect" "0.1001.1"
- "@angular-devkit/core" "10.1.1"
+ "@angular-devkit/architect" "0.1001.4"
+ "@angular-devkit/core" "10.1.4"
rxjs "6.6.2"
"@angular-devkit/core@10.0.8", "@angular-devkit/core@~10.0.3":
@@ -227,10 +227,10 @@
rxjs "6.5.5"
source-map "0.7.3"
-"@angular-devkit/core@10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-10.1.1.tgz#96e4f7af4ef17810f6ff87786c83841f466b4122"
- integrity sha512-0ZmknL5I177JO+iOz2gDSqHtPK3zGGwyz4ix9IIu172eFRX53sdbl1vDiMikovyvZWx5fXqU3Vazf7CUeGA28w==
+"@angular-devkit/core@10.1.4":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-10.1.4.tgz#5db3fa603f2cff3303e687b9e7cc5346db538644"
+ integrity sha512-B1cwVcfChBvmEacydE2uqZ1UC2ez1G+KY0GyVnCQKpAb/DdfDgtaYjTx9JLvGQjE/BlVklEj8YCKDjVV0WPE5g==
dependencies:
ajv "6.12.4"
fast-json-stable-stringify "2.1.0"
@@ -238,12 +238,12 @@
rxjs "6.6.2"
source-map "0.7.3"
-"@angular-devkit/schematics@10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-10.1.1.tgz#70e3ff6c25047f4d97d3eb61912e5d1e245b022a"
- integrity sha512-4UrBbDkuzGmBN1YDG3+GBJ21C+X29vxO0k2EDGrFFjQROsDeogeyWJoUP789v4JCCz9DHF2TRmdhQiEBctZXMg==
+"@angular-devkit/schematics@10.1.4":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-10.1.4.tgz#0966e0cbbdaccc294718db9b84b46ab54c03631b"
+ integrity sha512-NIueJQYZ8OY3Yr3TGfxcGgP9ZGGsbtM7sa7sf9hSqxEAXdiGQdDJk5nChhtGtoGxUImterwqR8OiGmLcK5lg5g==
dependencies:
- "@angular-devkit/core" "10.1.1"
+ "@angular-devkit/core" "10.1.4"
ora "5.0.0"
rxjs "6.6.2"
@@ -256,23 +256,23 @@
ora "4.0.4"
rxjs "6.5.5"
-"@angular/animations@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-10.1.1.tgz#5a2baa8fbf2d647f6c61d0547dd9ac266cb52ae0"
- integrity sha512-acVxTTGzA5JEspFNyhZKyr/wgCTCDL13fzz9CxMdMY3vgqgy/PiqmMp54MBI37EqgEOCo+PBJSX9uXxF0HqHTw==
+"@angular/animations@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-10.1.4.tgz#32cff0e0c73898e69c51cbdc1974d136a8ba6061"
+ integrity sha512-l6lSMUljph8orqZVB8Ej6qU1rk0vVCHqJBF7zobGuL47JMuY9+QaEWZ1CIgCishPo9PWq5Wvw/4QqPy9FE/gaw==
dependencies:
tslib "^2.0.0"
-"@angular/cli@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-10.1.1.tgz#3d11ab26383b46af164afb05bb5c5cf0aa0df392"
- integrity sha512-u1Dd2Qe4ShFFef8cehaHoEKOrWo6QONj7yJrlvIIyzcnXWUb3jQmyZoILTv759lRdYF0GrgBx5jCKxzok0jTww==
+"@angular/cli@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-10.1.4.tgz#8aa6b677da3d7ef9661e341893d5b53a5256645d"
+ integrity sha512-Q61cqx3qMAtMugE28aWAtAaj+c31pRjGlq7xSH2LhQSmaGyoAq7v6qah6gqH1Ik8nlpF9T7jBIozKyqX9aXysg==
dependencies:
- "@angular-devkit/architect" "0.1001.1"
- "@angular-devkit/core" "10.1.1"
- "@angular-devkit/schematics" "10.1.1"
- "@schematics/angular" "10.1.1"
- "@schematics/update" "0.1001.1"
+ "@angular-devkit/architect" "0.1001.4"
+ "@angular-devkit/core" "10.1.4"
+ "@angular-devkit/schematics" "10.1.4"
+ "@schematics/angular" "10.1.4"
+ "@schematics/update" "0.1001.4"
"@yarnpkg/lockfile" "1.1.0"
ansi-colors "4.1.1"
debug "4.1.1"
@@ -289,17 +289,17 @@
universal-analytics "0.4.23"
uuid "8.3.0"
-"@angular/common@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/common/-/common-10.1.1.tgz#4f0cdd97af623f58385598cb9eb0fdaa4a964a02"
- integrity sha512-RqFUdDU5x6KgFfT2o1fEn2GmxehtqCt9wYfKIaXMtAEPj0LGmc5A/YllxedASnIwlDHxsKL12b0Mc+g3r00zVg==
+"@angular/common@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/common/-/common-10.1.4.tgz#ca52c5ea3aca1533898c3363adc1089f18c94518"
+ integrity sha512-TWVv2gdbMIHQhdPdCFvBmQKI640LFGnntAceba7MLm2jNrmVglYGY+rWYiKa/+802lroZ8674qVVDqa+QASkyQ==
dependencies:
tslib "^2.0.0"
-"@angular/compiler-cli@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-10.1.1.tgz#369a512553b9e0912e30b523028a40d18b18113a"
- integrity sha512-xpXIt1l6i2QHIkxezkMt87caRZeAs1ls+MgW4EVx62SGzWLB164BFmJ3nshZX53aX68y0x83RS5JENxlANasPA==
+"@angular/compiler-cli@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-10.1.4.tgz#b5aaa7de6173b83ce3ba066232b8c088f2428642"
+ integrity sha512-5jRL9TKSGQLlP+C3gdJmSjYv7BfzN69SuYir/o0OtBblqzsGeaA21ClPMXl/HOxjFSjnIyGgjN7Caf7VjeMJww==
dependencies:
canonical-path "1.0.0"
chokidar "^3.0.0"
@@ -320,10 +320,10 @@
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-9.0.0.tgz#87e0bef4c369b6cadae07e3a4295778fc93799d5"
integrity sha512-ctjwuntPfZZT2mNj2NDIVu51t9cvbhl/16epc5xEwyzyDt76pX9UgwvY+MbXrf/C/FWwdtmNtfP698BKI+9leQ==
-"@angular/compiler@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-10.1.1.tgz#0cdb32c279993edbff85792cac7e98226d894de2"
- integrity sha512-VJ5eeYBsHR6WzCIKhBsGPYd6zfPNXqD0hD2SAjHqTb/LPnhSPsHGKBzuck+CxvXwChbjKNWzdMPuMAKGahR2ow==
+"@angular/compiler@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-10.1.4.tgz#76268332edb289b282296560e41478a2e323a39c"
+ integrity sha512-3vkaLE1kfyfkNoU/sf982UBMtB1bvFgBKHdP+YG7qlxVL1nLlQQvzIHKV8YGgtWnK2PMoJMI51In/64M71T0hg==
dependencies:
tslib "^2.0.0"
@@ -332,24 +332,24 @@
resolved "https://registry.yarnpkg.com/@angular/core/-/core-9.0.0.tgz#227dc53e1ac81824f998c6e76000b7efc522641e"
integrity sha512-6Pxgsrf0qF9iFFqmIcWmjJGkkCaCm6V5QNnxMy2KloO3SDq6QuMVRbN9RtC8Urmo25LP+eZ6ZgYqFYpdD8Hd9w==
-"@angular/core@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/core/-/core-10.1.1.tgz#833fbfc303419e9e635ed7fe4cb21f3bc76b708e"
- integrity sha512-3mvsaZJPg5Z8sGBT0OW3ak0T/UmHmlQ0nkWjwnIdPrMbyv5GoAjTR3Zh3cRK57nGV7ScLk4m4B4INzAjoCDqeA==
+"@angular/core@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/core/-/core-10.1.4.tgz#1180370e335371a0c36f05c2e8142c926a362836"
+ integrity sha512-GEJkwHG0TPylEkcPj55Ps7f9ryXAwxCDZlv+djSHnOOPjjW8jovgUSg88SRNOJ8pKSjMd8x9yeTQz5fCWaeniw==
dependencies:
tslib "^2.0.0"
-"@angular/forms@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-10.1.1.tgz#0ba182e1bddd28831a2a8b21f656612bac3691a8"
- integrity sha512-p6bsRNG2ctpo6tTDKCZZcbH/lFy1+0OlS8flFoEpMVwVrCg2PtjdlP76mMcmJjvUWdC/c3ySyrODm2bu2H59FQ==
+"@angular/forms@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-10.1.4.tgz#db81ecd854ebcfd53ee8b4ebc94ae1b4d6e5a3e6"
+ integrity sha512-pupOvPZAUZymjOViB25+gUp3/vK5T5XORNMASHubBZAdZ59nhFU3XMHGDl/uRfuy/CiWOOKaB4aS4MqUo+kK2w==
dependencies:
tslib "^2.0.0"
-"@angular/language-service@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-10.1.1.tgz#7c027904507a875325fc0db870c809a495eb713e"
- integrity sha512-Mg+GUNVPtzSupmjkzIrxzvylM7TGtVP36h61Yd0ixyo7vBcNV+NQ7PTdwfKGVWN0N6PiMuk2/4PA0hW2EokSZg==
+"@angular/language-service@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-10.1.4.tgz#3d428a6bbf0a8ced58c7d3de226fd74123a05389"
+ integrity sha512-+CsL/HWlja9mxqyvTTqP/rpxjVeuICmTHyfAKxqpq0488N7KTRRLvWXDoL5uwc+lzqhMsaXDasReMO+ATUAUrg==
"@angular/localize@~10.0.10":
version "10.0.14"
@@ -360,24 +360,24 @@
glob "7.1.2"
yargs "15.3.0"
-"@angular/platform-browser-dynamic@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-10.1.1.tgz#b08d329b1b1c072420977776c206ff0adf04039b"
- integrity sha512-mYd5ulQ0HYRwbgALegL6W7OlkDLNOlXp3gLLAoNjRfsb4+EocDiR8A4uf1LajL3Qunq3k7XBrcdT1SEQmqu4BQ==
+"@angular/platform-browser-dynamic@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-10.1.4.tgz#9e25c3c8fdc11d9efb610bd051f701581e1af512"
+ integrity sha512-RSG3d+rZpdLDQ5HS2QdwecVm0S1ILm42o7cdkghINoaQJocdqi/HHN/3Ow0jr3tk9YOES+Gaoa/rr74izVuysg==
dependencies:
tslib "^2.0.0"
-"@angular/platform-browser@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-10.1.1.tgz#db04b3cbdfa12229da58588f7f2732ddb787eac5"
- integrity sha512-rbI4fu6HRj7b+6MB8HWOdaYmV3CSjOyyrVqWAcNuXfNwZk/KE/OHvLSvQf7dMKnatJARa9bMrZdSQZqPuig1hA==
+"@angular/platform-browser@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-10.1.4.tgz#e65e120905d9f468b39551573d15ef6832063598"
+ integrity sha512-iEJQCfOrGXSgf0qTdfCMiAzrdecmAzBnF/WzD5Kpy+/NBL+K574KeiV2hTadxdKLJzJojEy2kKZKbb7mnWI9bQ==
dependencies:
tslib "^2.0.0"
-"@angular/router@~10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@angular/router/-/router-10.1.1.tgz#a9bed93b4d6fac602c5a7fa618be2653cbc7af03"
- integrity sha512-f9OI9k6OKzraBsh5/HeG8H7ubi3r+Sveu7sRIBvvzeoUj0uFHRkB2IDIxQHJWBBWUPyPmyvWCJVigUvcJyyarw==
+"@angular/router@~10.1.2":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@angular/router/-/router-10.1.4.tgz#66fd12c01353155c4f66be4972907bd2d0bd4829"
+ integrity sha512-WuwMAkyCz84xQDxHtTwaZUbr749VsQ5DqIIBZOgodc1hkPpIv7LUg6M5meQriDsASLNkkJWV8cq0EKHIQiBuTA==
dependencies:
tslib "^2.0.0"
@@ -1297,12 +1297,12 @@
dependencies:
tslib "^2.0.0"
-"@ngtools/webpack@10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-10.1.1.tgz#28c907f58ec352bc983eeca97205757c8660ed65"
- integrity sha512-OByWcvyJy4S4bxVcRCNVMRIyK4+j6XZPDI2K2vS6DZ6Bg/GUnabHMTCS+50RSAYvoaF2Gh0qCCXCA6QbGrSSDw==
+"@ngtools/webpack@10.1.4":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-10.1.4.tgz#84ed4bb7fabbe36d6e0f2b5c82bf04a8ab328a4a"
+ integrity sha512-t1KFgA6XSOtp0KuE81fWgTYksjJnMcFeKSIuaUPeG3XQQj8ghlMTIsrUx+5/TfGaDO2U/bobsAsvx9qbtyuzNA==
dependencies:
- "@angular-devkit/core" "10.1.1"
+ "@angular-devkit/core" "10.1.4"
enhanced-resolve "4.3.0"
webpack-sources "1.4.3"
@@ -1313,24 +1313,24 @@
dependencies:
tslib "^1.9.0"
-"@ngxs/router-plugin@^3.6.2":
- version "3.6.2"
- resolved "https://registry.yarnpkg.com/@ngxs/router-plugin/-/router-plugin-3.6.2.tgz#058b09565011203bbf52294f16f29f9337aeaa27"
- integrity sha512-5J3G9+Qsy/s7iqFivzAN1S6EmaZYTb9hqz7Xjn3c0u3Y44VMP5VWiz77jZ/eowXX0slJywcMxk6oCEFPwz4lXQ==
+"@ngxs/router-plugin@^3.7.0":
+ version "3.7.0"
+ resolved "https://registry.yarnpkg.com/@ngxs/router-plugin/-/router-plugin-3.7.0.tgz#9d0595d8ec12e6143eb9f2f726fcc7cdec8cd635"
+ integrity sha512-nmArryNIBLWqIKLWelOQhgxEC3evLPDNDkE+PEYvwoASC4NP5rHIqJv0borJAWBCwo10t5wPeT1417vBQex5aQ==
dependencies:
tslib "^1.9.0"
-"@ngxs/storage-plugin@^3.6.2":
- version "3.6.2"
- resolved "https://registry.yarnpkg.com/@ngxs/storage-plugin/-/storage-plugin-3.6.2.tgz#6fe2168891382c635406df02308f67b585efc60a"
- integrity sha512-x9CATYmXDH9bWmKW4uQxt5xxb51naSAmMkhvv1QHIrE9hG4uYNqiV3ERAM1wZvZbu2MJB9iXEN0cBziTgrwe2Q==
+"@ngxs/storage-plugin@^3.7.0":
+ version "3.7.0"
+ resolved "https://registry.yarnpkg.com/@ngxs/storage-plugin/-/storage-plugin-3.7.0.tgz#3a0bc75f5dbba17a18e37b69cfde5d470cfceb45"
+ integrity sha512-j5rGYfhi1S+sAky956DIs+6AYP9FMBWL2Uz+omKBS/i42mjhyD26UfApORjwCOyW5PCb4Tq3B14ZPxyAaSi/OA==
dependencies:
tslib "^1.9.0"
-"@ngxs/store@^3.6.2":
- version "3.6.2"
- resolved "https://registry.yarnpkg.com/@ngxs/store/-/store-3.6.2.tgz#cfba63dc1e5bd422e89e54b3332cd69818510624"
- integrity sha512-al7GU618SAuz2Ul4rFYVDgS1DM0gHReGOGvbnE7LBt4Etz3gsJERNYXPp2bSA7lZGaRPRaFfIHJN+Lm/GikFJw==
+"@ngxs/store@^3.7.0":
+ version "3.7.0"
+ resolved "https://registry.yarnpkg.com/@ngxs/store/-/store-3.7.0.tgz#e46387219dae610c685accc119ae42e351afcaa4"
+ integrity sha512-w9fG/DhKBgH1VJMKSoeNW9x9ycD9/Dzy+VkpFD8Jv0JBNX0MRgP+5KQQe3ZKwnJ+7S0UV/99JvJaWgxc/WOvPw==
dependencies:
tslib "^1.9.0"
@@ -1403,22 +1403,22 @@
estree-walker "^1.0.1"
picomatch "^2.2.2"
-"@schematics/angular@10.1.1":
- version "10.1.1"
- resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-10.1.1.tgz#96c9aefa12273795688e60f5e420b7397967620e"
- integrity sha512-U+5CfLlMqgkfRWZpmA3yzr+Axj1D42k0+tkfuaBrJTJUf5j7+JyULONPvzUh4Pi1c4EZJt+RuCE+AxtUZO/hug==
+"@schematics/angular@10.1.4":
+ version "10.1.4"
+ resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-10.1.4.tgz#6143425e365afe95cbc94290d95ee852ba2d2dd0"
+ integrity sha512-MWxyrKEiXqNCZ0Uh3zM/iWouQTOWalGy2gFn6Fx6UBgm7nPYgeXoX7wYiCAKIryoehaOFfs/Pw3zfCGgp/gUOw==
dependencies:
- "@angular-devkit/core" "10.1.1"
- "@angular-devkit/schematics" "10.1.1"
+ "@angular-devkit/core" "10.1.4"
+ "@angular-devkit/schematics" "10.1.4"
jsonc-parser "2.3.0"
-"@schematics/update@0.1001.1":
- version "0.1001.1"
- resolved "https://registry.yarnpkg.com/@schematics/update/-/update-0.1001.1.tgz#2cb2c539827b550cc9dbd36098a3ecee8c8a9d95"
- integrity sha512-71PyE0pTW2u3PPkNBdCXO0gH9pwTgZCfsHNNOWsIsslDDHYHGknJagN0JM/X1YAJ0nVZPgvMC0GSJ/xtIoCZmA==
+"@schematics/update@0.1001.4":
+ version "0.1001.4"
+ resolved "https://registry.yarnpkg.com/@schematics/update/-/update-0.1001.4.tgz#5c33c1a8579c72add1fe44ed3f4d6921c4dd9ac0"
+ integrity sha512-E2xIPWQoHgv+CRAYWV0LSNoa8JmOcgyxlrQvn44f6A80ySNDyrfcRP8VNzpk1UnGkBcjwEVhYeLuY+F0aguC3g==
dependencies:
- "@angular-devkit/core" "10.1.1"
- "@angular-devkit/schematics" "10.1.1"
+ "@angular-devkit/core" "10.1.4"
+ "@angular-devkit/schematics" "10.1.4"
"@yarnpkg/lockfile" "1.1.0"
ini "1.3.5"
npm-package-arg "^8.0.0"
From 50fe577a8a66184860ab62527bf568b061a09b99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 17:39:37 +0300
Subject: [PATCH 056/108] Change EF Core log level to warning on the startup
templates
---
.../src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs | 1 +
.../MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs | 1 +
.../src/MyCompanyName.MyProjectName.IdentityServer/Program.cs | 1 +
3 files changed, 3 insertions(+)
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs
index c8dc3d4740..94c39716dd 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs
@@ -17,6 +17,7 @@ namespace MyCompanyName.MyProjectName
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
+ .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
#if DEBUG
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs
index c8dc3d4740..94c39716dd 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs
@@ -17,6 +17,7 @@ namespace MyCompanyName.MyProjectName
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
+ .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
#if DEBUG
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Program.cs
index a159ca7aed..ec99b96d37 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Program.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Program.cs
@@ -17,6 +17,7 @@ namespace MyCompanyName.MyProjectName
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
+ .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
#if DEBUG
From ef62af5831b193f935eb62adb8047037f828f305 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 17:39:47 +0300
Subject: [PATCH 057/108] sort modifiers.
---
.../Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs | 2 +-
...ProviderIdentityModelRemoteServiceHttpClientAuthenticator.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs
index 7d59042806..1b5c5893d5 100644
--- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs
@@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly
_jsRuntime = jsRuntime;
}
- protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
+ protected async override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
await SetLanguageAsync(request, cancellationToken);
diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/AccessTokenProviderIdentityModelRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/AccessTokenProviderIdentityModelRemoteServiceHttpClientAuthenticator.cs
index c86fc095c7..0e0b659ef1 100644
--- a/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/AccessTokenProviderIdentityModelRemoteServiceHttpClientAuthenticator.cs
+++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/AccessTokenProviderIdentityModelRemoteServiceHttpClientAuthenticator.cs
@@ -20,7 +20,7 @@ namespace Volo.Abp.Http.Client.IdentityModel.WebAssembly
AccessTokenProvider = accessTokenProvider;
}
- public override async Task Authenticate(RemoteServiceHttpClientAuthenticateContext context)
+ public async override Task Authenticate(RemoteServiceHttpClientAuthenticateContext context)
{
if (context.RemoteService.GetUseCurrentAccessToken() != false)
{
From 51a9590ae06ebc9bc0fdd8ef4546a6d1a3e055df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Wed, 7 Oct 2020 18:11:28 +0300
Subject: [PATCH 058/108] Added empty CSRF/XSRF & Anti Forgery document
---
docs/en/CSRF-Anti-Forgery.md | 3 +++
docs/en/docs-nav.json | 6 +++++-
2 files changed, 8 insertions(+), 1 deletion(-)
create mode 100644 docs/en/CSRF-Anti-Forgery.md
diff --git a/docs/en/CSRF-Anti-Forgery.md b/docs/en/CSRF-Anti-Forgery.md
new file mode 100644
index 0000000000..da104b856e
--- /dev/null
+++ b/docs/en/CSRF-Anti-Forgery.md
@@ -0,0 +1,3 @@
+# CSRF/XSRF & Anti Forgery System
+
+TODO
\ No newline at end of file
diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json
index 7531d4e9f1..0cba16382e 100644
--- a/docs/en/docs-nav.json
+++ b/docs/en/docs-nav.json
@@ -99,11 +99,15 @@
"path": "CLI.md"
},
{
- "text": "Authentication",
+ "text": "Authentication & Security",
"items": [
{
"text": "Social/External Logins",
"path": "Authentication/Social-External-Logins.md"
+ },
+ {
+ "text": "CSRF/XSRF & Anti Forgery",
+ "path": "CSRF-Anti-Forgery.md"
}
]
},
From 7b9966fa4ddfc4033e1108022bb8a47ea1cafadd Mon Sep 17 00:00:00 2001
From: Alexandru Bagu
Date: Wed, 7 Oct 2020 18:14:30 +0300
Subject: [PATCH 059/108] added streaming support
---
.../AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 3 ++
.../AspNetCoreApiDescriptionModelProvider.cs | 26 ++++++++++++++---
.../Content/InternalRemoteStreamContent.cs | 25 ++++++++++++++++
.../RemoteStreamContentInputFormatter.cs | 27 +++++++++++++++++
.../RemoteStreamContentOutputFormatter.cs | 29 +++++++++++++++++++
.../Volo/Abp/Content/IRemoteStreamContent.cs | 12 ++++++++
.../Volo/Abp/Content/RemoteStreamContent.cs | 24 +++++++++++++++
.../Content/ReferencedRemoteStreamContent.cs | 15 ++++++++++
.../DynamicHttpProxyInterceptor.cs | 28 +++++++++++++-----
.../DynamicProxying/RequestPayloadBuilder.cs | 26 ++++++++++++-----
10 files changed, 197 insertions(+), 18 deletions(-)
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs
create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs
create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/Content/IRemoteStreamContent.cs
create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/Content/RemoteStreamContent.cs
create mode 100644 framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Content/ReferencedRemoteStreamContent.cs
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
index 88a81fa1ec..1ceb0bc837 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
@@ -37,6 +37,7 @@ using Volo.Abp.Http.Modeling;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.UI;
+using Volo.Abp.AspNetCore.Mvc.Content;
namespace Volo.Abp.AspNetCore.Mvc
{
@@ -172,6 +173,8 @@ namespace Volo.Abp.AspNetCore.Mvc
Configure(mvcOptions =>
{
mvcOptions.AddAbp(context.Services);
+ mvcOptions.InputFormatters.Insert(0, new RemoteStreamContentInputFormatter());
+ mvcOptions.OutputFormatters.Insert(0, new RemoteStreamContentOutputFormatter());
});
Configure(options =>
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
index 617650d0e2..9d9ab9075d 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -282,10 +283,21 @@ namespace Volo.Abp.AspNetCore.Mvc
return;
}
- var matchedMethodParamNames = ArrayMatcher.Match(
- apiDescription.ParameterDescriptions.Select(p => p.Name).ToArray(),
- method.GetParameters().Select(GetMethodParamName).ToArray()
- );
+ /*
+ * --- bug report ---
+ ArrayMatcher.Match has the following bug:
+ sourceArray: [ "test1", "test2", "test3" ],
+ destinationArray: [ "test2", "test3" ],
+ expectedResult: [ "test2", "test3" ],
+ result: [ "test1", "test1" ]
+ */
+ /*Because of ArrayMatcher.Match bug parameters that are
+ * service provided by FromServicesAttribute must be excluded
+ * because Microsoft's API Explorer does not include them
+ */
+ var parameterDescriptionNames = apiDescription.ParameterDescriptions.Select(p => p.Name).ToArray();
+ var methodParameterNames = method.GetParameters().Where(NotServiceProvidedParam).Select(GetMethodParamName).ToArray();
+ var matchedMethodParamNames = ArrayMatcher.Match(parameterDescriptionNames, methodParameterNames);
for (var i = 0; i < apiDescription.ParameterDescriptions.Count; i++)
{
@@ -310,6 +322,12 @@ namespace Volo.Abp.AspNetCore.Mvc
}
}
+ private bool NotServiceProvidedParam(ParameterInfo parameterInfo)
+ {
+ var fromServicesAttribute = parameterInfo.GetCustomAttribute();
+ return fromServicesAttribute == null;
+ }
+
public string GetMethodParamName(ParameterInfo parameterInfo)
{
var modelNameProvider = parameterInfo.GetCustomAttributes()
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs
new file mode 100644
index 0000000000..aaaa849f4f
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs
@@ -0,0 +1,25 @@
+using System.IO;
+using Microsoft.AspNetCore.Http;
+using Volo.Abp.Content;
+
+namespace Volo.Abp.AspNetCore.Mvc.Content
+{
+ internal class InternalRemoteStreamContent : IRemoteStreamContent
+ {
+ private readonly HttpContext _httpContext;
+
+ public InternalRemoteStreamContent(HttpContext httpContext)
+ {
+ _httpContext = httpContext;
+ }
+
+ public string ContentType => _httpContext.Request.ContentType;
+
+ public long? ContentLength => _httpContext.Request.ContentLength;
+
+ public Stream GetStream()
+ {
+ return _httpContext.Request.Body;
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs
new file mode 100644
index 0000000000..c135864bf8
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Threading.Tasks;
+using Microsoft.Net.Http.Headers;
+using Microsoft.AspNetCore.Mvc.Formatters;
+using Volo.Abp.Content;
+
+namespace Volo.Abp.AspNetCore.Mvc.Content
+{
+ public class RemoteStreamContentInputFormatter : InputFormatter
+ {
+ public RemoteStreamContentInputFormatter()
+ {
+ SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("*/*"));
+ }
+
+ protected override bool CanReadType(Type type)
+ {
+ return typeof(IRemoteStreamContent) == type;
+ }
+
+ public override Task ReadRequestBodyAsync(InputFormatterContext context)
+ {
+ var stream = new InternalRemoteStreamContent(context.HttpContext);
+ return InputFormatterResult.SuccessAsync(stream);
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs
new file mode 100644
index 0000000000..b3baee3bc9
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc.Formatters;
+using Microsoft.Net.Http.Headers;
+using Volo.Abp.Content;
+
+namespace Volo.Abp.AspNetCore.Mvc.Content
+{
+ public class RemoteStreamContentOutputFormatter : OutputFormatter
+ {
+ public RemoteStreamContentOutputFormatter()
+ {
+ SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("*/*"));
+ }
+
+ protected override bool CanWriteType(Type type)
+ {
+ return typeof(IRemoteStreamContent).IsAssignableFrom(type);
+ }
+
+ public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
+ {
+ var httpContext = context.HttpContext;
+ var remoteStream = context.Object as IRemoteStreamContent;
+ using (var stream = remoteStream.GetStream())
+ await stream.CopyToAsync(httpContext.Response.Body);
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Content/IRemoteStreamContent.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Content/IRemoteStreamContent.cs
new file mode 100644
index 0000000000..d8ecd8b9bf
--- /dev/null
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/Content/IRemoteStreamContent.cs
@@ -0,0 +1,12 @@
+using System;
+using System.IO;
+
+namespace Volo.Abp.Content
+{
+ public interface IRemoteStreamContent
+ {
+ string ContentType { get; }
+ long? ContentLength { get; }
+ Stream GetStream();
+ }
+}
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Content/RemoteStreamContent.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Content/RemoteStreamContent.cs
new file mode 100644
index 0000000000..67a4f8eb2e
--- /dev/null
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/Content/RemoteStreamContent.cs
@@ -0,0 +1,24 @@
+using System;
+using System.IO;
+
+namespace Volo.Abp.Content
+{
+ public class RemoteStreamContent : IRemoteStreamContent
+ {
+ private readonly Stream _stream;
+
+ public RemoteStreamContent(Stream stream)
+ {
+ _stream = stream;
+ }
+
+ public virtual string ContentType { get; set; }
+
+ public virtual long? ContentLength => _stream.Length;
+
+ public virtual Stream GetStream()
+ {
+ return _stream;
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Content/ReferencedRemoteStreamContent.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Content/ReferencedRemoteStreamContent.cs
new file mode 100644
index 0000000000..80e4176e74
--- /dev/null
+++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Content/ReferencedRemoteStreamContent.cs
@@ -0,0 +1,15 @@
+using System.IO;
+using Volo.Abp.Content;
+
+namespace Volo.Abp.Http.Client.Content
+{
+ internal class ReferencedRemoteStreamContent : RemoteStreamContent
+ {
+ private readonly object[] references;
+
+ public ReferencedRemoteStreamContent(Stream stream, params object[] references) : base(stream)
+ {
+ this.references = references;
+ }
+ }
+}
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 5313457ba7..c0dde47603 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
@@ -10,9 +10,11 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
+using Volo.Abp.Content;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DynamicProxy;
using Volo.Abp.Http.Client.Authentication;
+using Volo.Abp.Http.Client.Content;
using Volo.Abp.Http.Modeling;
using Volo.Abp.Http.ProxyScripting.Generators;
using Volo.Abp.Json;
@@ -103,17 +105,27 @@ namespace Volo.Abp.Http.Client.DynamicProxying
private async Task MakeRequestAndGetResultAsync(IAbpMethodInvocation invocation)
{
- var responseAsString = await MakeRequestAsync(invocation);
+ var responseContent = await MakeRequestAsync(invocation);
- if (typeof(T) == typeof(string))
+ if (typeof(T) == typeof(IRemoteStreamContent))
{
- return (T)Convert.ChangeType(responseAsString, typeof(T));
+ /*returning a class that holds a reference to response
+ * content just to be sure that GC does not dispose of
+ * it before we finish doing our work with the stream*/
+ return (T)((object)new ReferencedRemoteStreamContent(await responseContent.ReadAsStreamAsync(), responseContent));
+ }
+ else
+ {
+ var stringContent = await responseContent.ReadAsStringAsync();
+
+ if (typeof(T) == typeof(string))
+ return (T)((object)stringContent);
+ return JsonSerializer.Deserialize(await responseContent.ReadAsStringAsync());
}
- return JsonSerializer.Deserialize(responseAsString);
}
- private async Task MakeRequestAsync(IAbpMethodInvocation invocation)
+ private async Task MakeRequestAsync(IAbpMethodInvocation invocation)
{
var clientConfig = ClientOptions.HttpClientProxies.GetOrDefault(typeof(TService)) ?? throw new AbpException($"Could not get DynamicHttpClientProxyConfig for {typeof(TService).FullName}.");
var remoteServiceConfig = AbpRemoteServiceOptions.RemoteServices.GetConfigurationOrDefault(clientConfig.RemoteServiceName);
@@ -140,14 +152,16 @@ namespace Volo.Abp.Http.Client.DynamicProxying
)
);
- var response = await client.SendAsync(requestMessage, GetCancellationToken());
+ var response = await client.SendAsync(requestMessage,
+ HttpCompletionOption.ResponseHeadersRead /*this will buffer only the headers, the content will be used as a stream*/,
+ GetCancellationToken());
if (!response.IsSuccessStatusCode)
{
await ThrowExceptionForResponseAsync(response);
}
- return await response.Content.ReadAsStringAsync();
+ return response.Content;
}
private ApiVersionInfo GetApiVersionInfo(ActionApiDescriptionModel action)
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 afc5f9e4f0..372d6f2921 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
@@ -3,33 +3,35 @@ using System.Linq;
using System.Net.Http;
using System.Text;
using JetBrains.Annotations;
+using Volo.Abp.Content;
using Volo.Abp.Http.Modeling;
using Volo.Abp.Http.ProxyScripting.Generators;
using Volo.Abp.Json;
+using Volo.Abp.Reflection;
namespace Volo.Abp.Http.Client.DynamicProxying
{
public static class RequestPayloadBuilder
{
[CanBeNull]
- public static HttpContent BuildContent(ActionApiDescriptionModel action,IReadOnlyDictionary methodArguments, IJsonSerializer jsonSerializer, ApiVersionInfo apiVersion)
+ public static HttpContent BuildContent(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments, IJsonSerializer jsonSerializer, ApiVersionInfo apiVersion)
{
var body = GenerateBody(action, methodArguments, jsonSerializer);
if (body != null)
{
- return new StringContent(body, Encoding.UTF8, MimeTypes.Application.Json);
+ return body;
}
body = GenerateFormPostData(action, methodArguments);
if (body != null)
{
- return new StringContent(body, Encoding.UTF8, MimeTypes.Application.XWwwFormUrlencoded);
+ return body;
}
return null;
}
- private static string GenerateBody(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments, IJsonSerializer jsonSerializer)
+ private static HttpContent GenerateBody(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments, IJsonSerializer jsonSerializer)
{
var parameters = action
.Parameters
@@ -54,10 +56,20 @@ namespace Volo.Abp.Http.Client.DynamicProxying
return null;
}
- return jsonSerializer.Serialize(value);
+ if (value is IRemoteStreamContent remoteStreamContent)
+ {
+ var content = new StreamContent(remoteStreamContent.GetStream());
+ content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(remoteStreamContent.ContentType);
+ content.Headers.ContentLength = remoteStreamContent.ContentLength;
+ return content;
+ }
+ else
+ {
+ return new StringContent(jsonSerializer.Serialize(value), Encoding.UTF8, MimeTypes.Application.Json);
+ }
}
- private static string GenerateFormPostData(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments)
+ private static HttpContent GenerateFormPostData(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments)
{
var parameters = action
.Parameters
@@ -86,7 +98,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
isFirstParam = false;
}
- return postDataBuilder.ToString();
+ return new StringContent(postDataBuilder.ToString(), Encoding.UTF8, MimeTypes.Application.XWwwFormUrlencoded);
}
}
}
From c61f2110f62b73730fefd7b8e6a40cde94c4b54a Mon Sep 17 00:00:00 2001
From: berkansasmaz
Date: Wed, 7 Oct 2020 20:02:17 +0300
Subject: [PATCH 060/108] Docs: first draft of how to add custom property to
the user entity blogpost.
---
...-Add-Custom-Property-To-The-User-Entity.md | 170 ++++++++++++++++++
.../custom-identity-user-list.png | Bin 0 -> 193711 bytes
.../edit-user.png | Bin 0 -> 29515 bytes
.../initial-project.png | Bin 0 -> 105741 bytes
.../new-user.png | Bin 0 -> 26770 bytes
.../user-table.png | Bin 0 -> 47970 bytes
6 files changed, 170 insertions(+)
create mode 100644 docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/How-To-Add-Custom-Property-To-The-User-Entity.md
create mode 100644 docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/custom-identity-user-list.png
create mode 100644 docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/edit-user.png
create mode 100644 docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/initial-project.png
create mode 100644 docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/new-user.png
create mode 100644 docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/user-table.png
diff --git a/docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/How-To-Add-Custom-Property-To-The-User-Entity.md b/docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/How-To-Add-Custom-Property-To-The-User-Entity.md
new file mode 100644
index 0000000000..59ed8f8317
--- /dev/null
+++ b/docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/How-To-Add-Custom-Property-To-The-User-Entity.md
@@ -0,0 +1,170 @@
+# How to add custom property to the user entity
+
+
+
+## Introduction
+
+In this step-by-step article, I will explain how you can customize the user entity class, which is available in every web application you create using the ABP framework, according to your needs. When you read this article, you will learn how to override the services of built-in modules, extend the entities, extend data transfer objects and customize the user interface in the applications you develop using the ABP framework. In short, we will ask ourselves some questions throughout this article and we will find the answers together;
+
+- How to add
+- How to map to a table field via EF Core
+- How to write custom business logic for the new property
+- How to add standard and custom validation logics
+- How to relate it with the `AppUser` entity in the startup template
+- ...
+
+
+You can see the screenshots below which we will reach at the end of the article.
+
+
+
+
+
+
+## Preparing the Project
+
+### Startup template and the initial run
+
+Abp Framework offers startup templates to get into the work faster. We can create a new startup template using Abp CLI:
+
+`abp new CustomizeUserDemo -m none`
+
+After the download is finished, we can run **CustomizeUserDemo.DbMigrator** project to create the database migrations and seed the initial data (admin user, role, etc). Then we can run `CustomizeUserDemo.Web` to see that our application is working.
+
+> Default admin username is **admin** and password is **1q2w3E\***
+
+
+
+
+
+
+In this article, we will go through a scenario together and find the solutions to our questions through this scenario. However, since the scenario is not a real-life scenario, it may be strange, please don't get too about this issue :)
+
+## Step-1
+
+Add two new properties to the `AppUser` in the Users folder of the **CustomizeUserDemo.Domain** project as follows:
+
+```csharp
+public string Title { get; protected set; }
+
+public int Reputation { get; protected set; }
+```
+
+## Step-2
+
+Create the Users folder in the **CustomizeUserDemo.DomainShared** project, create the class `UserConsts` inside the folder and update the class you created as below:
+
+```csharp
+public class UserConst
+{
+ public const string TitlePropertyName = "Title";
+
+ public const string ReputationPropertyName = "Reputation";
+
+ public const int MaxTitleLength = 64;
+
+ public const double MaxReputationValue = 1_000;
+
+ public const double MinReputationValue = 1;
+}
+```
+
+## Step-3
+
+Update the `CustomizeUserDemoEfCoreEntityExtensionMappings` class in the **CustomizeUserDemo.EntityFramework** project in the EntityFrameworkCore folder as below:
+
+```csharp
+public static class CustomizeUserDemoEfCoreEntityExtensionMappings
+{
+ private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
+
+ public static void Configure()
+ {
+ CustomizeUserDemoGlobalFeatureConfigurator.Configure();
+ CustomizeUserDemoModuleExtensionConfigurator.Configure();
+
+ OneTimeRunner.Run(() =>
+ {
+ ObjectExtensionManager.Instance
+ .MapEfCoreProperty(
+ nameof(AppUser.Title),
+ (entityBuilder, propertyBuilder) =>
+ {
+ propertyBuilder.IsRequired();
+ propertyBuilder.HasMaxLength(UserConst.MaxTitleLength);
+ }
+ ).MapEfCoreProperty(
+ nameof(AppUser.Reputation),
+ (entityBuilder, propertyBuilder) =>
+ {
+ propertyBuilder.HasDefaultValue(UserConst.MinReputationValue);
+ }
+ );
+ });
+ }
+}
+```
+
+This class can be used to map these extra properties to table fields in the database. Please read [this](https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities) article to improve your understanding of what we are doing.
+
+So far, we have added our extra features to the `User` entity and matched these features with the `ef core`.
+
+Now we need to [add](https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=MVC&DB=EF#add-database-migration) migration to see what has changed in our database and then run the **CustomizeUserDemo.DbMigrator** project as we did in [this](#startup-template-and-the-initial-run) step.
+
+When we updated the database, you can see that the `Title` and `Reputation` columns are added to the user table.
+
+
+
+## Step-4
+Open the `CustomizeUserDemoModuleExtensionConfigurator` in the **CustomizeUserDemo.Domain.Shared** project, and change the contents of the `ConfigureExtraProperties` method as shown below:
+```csharp
+private static void ConfigureExtraProperties()
+{
+ ObjectExtensionManager.Instance.Modules().ConfigureIdentity(identity =>
+ {
+ identity.ConfigureUser(user =>
+ {
+ user.AddOrUpdateProperty(
+ UserConst.TitlePropertyName,
+ options =>
+ {
+ options.Attributes.Add(new RequiredAttribute());
+ options.Attributes.Add(
+ new StringLengthAttribute(UserConst.MaxTitleLength)
+ );
+ options.Validators.Add(context =>
+ {
+ var title = context.Value as string;
+
+ if (title == null || title.ToLower().Contains("title"))
+ {
+ context.ValidationErrors.Add(
+ new ValidationResult(
+ "The word 'title' cannot be contain in the Title input.",
+ new[] {"Title"}
+ )
+ );
+ }
+ });
+ }
+ );
+ user.AddOrUpdateProperty(
+ UserConst.ReputationPropertyName,
+ options =>
+ {
+ options.DefaultValue = UserConst.MinReputationValue;
+ options.Attributes.Add(
+ new RangeAttribute(UserConst.MinReputationValue, UserConst.MaxReputationValue)
+ );
+ }
+ );
+ });
+ });
+}
+```
+
+That's it. Now let's run the application and look at the Identity user page. You can also try to edit and recreate a record if you want, it will work even though we haven't done anything extra. Here is the magic code behind ABP framework.
+
+If there is a situation you want to add, you can click the contribute button or make a comment. Also, if you like the article, don't forget to share it :)
+
+Stay with the code :)
diff --git a/docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/custom-identity-user-list.png b/docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/custom-identity-user-list.png
new file mode 100644
index 0000000000000000000000000000000000000000..15fbddc8c7abb34eac0671bd047de2acfc4e696e
GIT binary patch
literal 193711
zcmeFZbyQSs*D#JCqM#s3NTUb{Lr8b1ARW>TN_R6fB4W@Xok~dz2n<7)(%m_9cQ?#@
zXT0y{eV^aEz8iek`u+2*^$cqkXU@4|U;EnE?tMNh%1hkACdEcWL%Sm-DW-&mb~7Ih
z?K;}c8^E2P(SCGjXtzzwU%XJ1dhvo<(ZSZl+{zdYP4aV843>s+E79AfXq9_f)aXjj
zZNEw0p{9LLBr2Li&G_)v<1Y{HzYCzyRjV%ve4^&0D%Lwl7*;|(t3}+nsYQgt2wIzE
zi5*pu_9mF|kSLA3h|iV;@0OSJmL&RrP3;GhR!%K$bkf7RSDZCP_DM_4T>p&2mh%Di!KT
z;%lO}{T#;4#n}l1ACk3x^$Ro2=2idIu9^s$*|12O7h{>HLu=s_)=$QHYeV*>H~_P}
zCuEbRWmD;^81~y_{CR5MSl0K6x81~E&kzuH`>kI;Fb)GhGcomf&2eOVSp0E)@1*=i
z-e(!zme=?E^WKWgA!R#}EdH2n^?c+88J`zkea<<4jcdE8@c9+n9fwd(0T#U|%NASO
z=W>(RM6=%*s|38H;v#-h_SEO?tx??;yg*+oT)yX8cZqYOOqV1dxrWVHJj;>^aBUqc
z3=|94ehlfnv&-;#$1jm)$pLD(cH(eQ#dyJO?2Rp9iOke!AcG=v#1a#4#9^boWR6a6
zdN$;5mENKd(7SBFP5Z_Mo*JSP_kDK?mtFgD@a@5oW_HJU{LflmnqS{M)ytD*nrSpI
z&yh?d&uGPiY1gTr*`k*}d%Tc-dkmkUsTsHF5rMzI<(uX)@je3Usu3a0S7zT_tP1j|
zpXG)|ierW|mftbr5VwzTVG_=~$s!-@C8(zMB`j~}es|lP1ijgLec&^u>32`-(4{qs
z>j}cJ9&ZQ*3vI__(xY$tlFy^#+x1J|kVwz=NZ*dTE?q|zCML?p$)Yj=LT^+=*h}WP
zRrr!S+ZMWu3A^4dzuWK@{a8Djl9nQ#nNaZEy;czuVo`k@1J#2I-={-a*Nau8y@@_sp|E*Fw8R-T66Lun}
z=V$n1pNeaP9)RC+SMMka-qrdTZBJ)&18&F4i-(2xfy3hkgZf%2qsvh3XU8Y+SRL{Q
z)5??;+n!3_Y+P9juVAT|e4(a7a=|V_s$cxEsEuOv#NB(7*p28X_oAho6~4<|f#9UN
zt~U}tUe^5#F_as@T>l>Maj1vpfRr?m`PGJkFqGz`+0%0)F-MjWz6P(H5HULw4L5TS
zxA3#iYB6b{EuVcvgyoGX#+0n`)Zu#juZdq2XoEcBd-3kADn6jQi{;%#m?db}DJdU3
zI9@4cI=zP`VpMPKyPzO+9u<)1#no5nyF
zy?GO>mzwgipVQM@i<-BGi^*j%it9WTZ!p$5{J4>al~B+917{r*OO%EeUH)xKy_?-F
z9gNbM(-rh?QC8PGr})<&K6HBT8~aG@lhAB{E49_*o3|w1go{0k9
ziqo56MyTbt`HZaR{<7OX>DXuC7iUl3t{BL6kUIVvc|aW4%>IL1Hl(w@tx!7eMs9Qb
zjEEQJT7&x!FfYF8G!y(z{>&3WOyX(f9lqmxov-f6S&I-T5DfBxI8S%L9URQOQ%VOU5cOJs$lZ7aVKs0fSiUE;Io2$|NX`H6YM`SyAGdG7$>
z#^hOr&sjGaIG(gW8E5GH68MEhT4eC;s^pz?I_16Zd)cZ3?yC%|6ss~66cl6>B1!iA
z_mbTBRr$}HyO!a@ZW0{n2lN_?
zaXN6$k}Qy@KG@*0;92G3<~(GV=SsHGvGyD&i~P(+5i4kN&5>jeZI6HN;%VUP#Mj?m
z2YwvHs}x)hZncZNdp}&Nyj3{Tl5R^*Gjk^MBoib{CbtzoW5QxG*O3`#%`RX(!~r*R
zt+T7&-krhvfV2pSuZ*RS@8+B`@vg7x{@M4a@3~1~*KE3YC~ZG`1ADha$pTxu4d{bv
zSX6^W$)J7ilx7nXZth#vMhn9OtpsfeO%SA1t5o}FoOdjJiwo_CjAhJ1~Di?=uFT~a3h
zAg``79e;7sUJ?(#zQZ%!D%}Q_K^9`&SL#&ipVwXvhv2`*_ohjwv3Lo$ODngB2TZKO
zH$#m=f+#fki|pt3Ub&>Pzl1z+b|0Vz+a94GZETiGkcEU$>hf2(?dwyrP@;!ggytqY
zb>HkRPnJt&thc+xNT<;+ym=FEuZf`B_r^
zQ2qII{4~}>*u$S;6b}`6yAlPvD7*F)j}+aOzxMFx_-tC)$UGn-B2l9pqO^ICe6L3M
zT<^V{n2ngOm~A?EzN01j$#WIifq?I1f;h=<)!WyC4}+5_CWu}HN(E?A?NJZWs!@&$
z5>b!|xeSg7*dN;Wl{LBE?GDr@^x>&zdu{PkVeZr1y(ZOAk3?R6d$rk>$1nTl(I+7PoJD*#GP%>*W2nIc@l|df?w2E@`}oerL2AJ>LK_
z9rskMOlyQ0n*c%})OxE!Gj5NQ=P6j#rj%Dhhha0^j&_Zfb@$sY_fmChX!lf{h+>%9
zkAg6rSXEaIizl5iFuB4+b}#9V9ja<{Yl*8O&Yc5#Zb6vZb~Qy)8)l;TA8zTBYKg^T7R+Fs^4MOVP$s>^iF+U
z%lt=?(ZVlPLv^k^69|j`g+=E)mno>4k*6RdUp0RtF92epWm;-;Qh~SDxK^P0QEhA7
zpyu_?2OctiGFDscQI*=!H;#>qN7|3IZES+!V~TT%%H_dj5ZCd!jqGs+pKe5r%g51>
z017IwG}vWR8a}ADrmbB$?s-(i50%#(uBLbF&ZvIvk+3?kTDobtnLC1a2s%O{UJT(4
z<28_*3AG4oAk!{F$#B_lqj;$AaFDu_H3lcit;kV)Ov5YX#^R(pHJ?`y2-Tp<7Pjzo
z8f9B8^l!cq5<|Xa8D6rV*dny^!`WeNBXUkb&zfv_$eVF-ATEW*Ti7k$@$@*ZjzgmB
zG)2fW#4CTNs{7;v&LlDJ#q34?E9XyDg}bHgWo|F_Yh#w`ook(2A~)Q?H^FUNt5c9FQ}2RBo~5Zn=Tj%jYAP4x
zPrr1mQYvgpVUKjz{jZiYhNp9F^lAzgDei(oeH6W3D@V6#!9tNjYg-IwzotX)bSEVv
zk4;-rh~1lyT&lxr9~@h@%Jjzw=(|;0Y{)EE9#w2RBNKK@Gi|}uhP470!W$Qn2y-e)
zsvKc{A1egG-b$C~Ox@cc)}`D~^apun^0;U|8`s|^4uV3QFthEZ7p?+NxBJl1
zlsM3+7BDaXhIvEyrvRf1&fDnh_{z+jyE798fiVFr9JF%Nx!=k^dgIRxGb_5KQX)zZ
z^;Mq+aGMO-_5y}Sw6TViiJTl7BXE5a4fEPPGz{SC8t{j9jT8;@_ca=t^fj{ox>maO
z&)BtE`
z&y-(CNdf?AcE(a?x!QQvD)N{_eE(9kE$RWzJ5qcX!~I&?7S^Cp&&tRxlXM0_I?`bueXR
zUvN5^oBa1oHjaNU3s@j4>Io|w%Tw0>TQ_4@^MB}udh%Dd-|PBoIziN6{2EHe
zj<#0LD6oXtI5}C_1bSZq>xEh)zoNOTv6ZHnxivsIzgP5>ol}tY|N7{Ec2#vWc6ecH4fJ#p
z{%_LzyYs(4{GT0vCd>bFu@Uf1mT;9{t@_kQGG$|3(mhQQPmk0J#Zc3$p$f=?Y^D
zTg1$up^2hNi9J(sy|z99PSjDIz?z%8IUN&Li}`z)wnIdf{}c
z*9lfs37*}(zVbx!l_>to&973ogs$B~my+zRIqG09<`AfCrL!v9;7jQ?+7vqKC|?o;
zgO3es6P0%s6Ksd}*M?d7omUC4uc2SRd6!!BE!rg)zKi!_g}vN^s6>Q^b+?4Q(j1q%
zUcGu1?vc^fwmDIW1L2H;d0#mSFab6?!}mUjb}9S>nyp-P6#qRt+Y1MZAPI
zHckFybhm5uQC083f3O|C{*2URMT+GUL04m?rx()#8|@tk6C3MKfWT2mrMs?9lnfKV
zzk;j*6!KSz%1yij5J-W@0_5P8kf-`z&nxSDzHK9OHTss9(SdO<=>idaXykp9H+U0-fm#VBSu_8$rj@iO98
z#aiM)58#;}rj`vrnX++8{mZJvS1}Y((7ofq2`>9_Wr&&Rhv&f7xM*?AE^jbuEpP65
zkFyyz%?l4?+17sl{{2&1Tibe6b+?DQ@Rf8=R8!YGd<(+l=?u1lpfl7(dDD-%;c_{uoX~t6xM7M&-|n(+DGELy4E&UGvsoJMGZF5
z6@rsJ$e3?B8TrD_1s;|4h5I;kCS86MtVO3U6vpbP?}UruU_%$C@av<9&g<T2VpN
zE`#!u@)fv6EyvfN24Jdoi4*>pZ{Ke&nwl)?T=MlXRkf?dnJ0SJ&qncH4we6Z74)o`6cVmaL$m>0&h(02S
z10#-&;#_lRXdr93V6yk&sO!NXlFKzsj(hS+h~O+%A-t%a+qK$zq0D}6Hd@;@)DmIm
zm5v}|9JeWUUavW`DO@C_A*)EtmAMw#2^-0rKcyv3q5_3#FnA*Zi|3L(wm>>$!k*=2
z2a9AlODBHB`tE%BryEl?VBbUPo?LBl
z^1WdB-jl%EZ&?TE+$66Ew}Ns%<7~$DQf8XrUf0SHo#-QnIJh#4d|yJGd9IhW+t~j~
zv9aKUM!Y-;{YV*-ROG_Iq@>KT1fB4q^m$ZMb0Kd(iAl^wswL%xSV;CT-15TvRP5ts
zlOCl>$_Rvmm~!Qv>61LQq|7q%dWi{nrW`Ci*Ty~O$GC~Kq~r?94=YCO<~rv>1h#DQ
zKnItLT(e^Ic9vJKZbAqY-elAx^7PhcVgVIR!`>M88w0OH2lB!Rm${8q7kqJtE!79f
zYk>4>XEov4>tEU`IC)WZH0fbKSza3y5D;+Vj5%KxRGv=V32!4YO(q;h7J6bv^LcG%
zHK#oAE86f|gkpCj3U85KPA)ga)?qfz{nN(0_5w2Bkxa|4
z3u>ma!3rWNd+0d+O}ICq?10kplCotWTX}9?S)R3$-*r26#QdXe!;g#)jZ2aA&DB1Y
zB9s?LhO`@9LR;@NJT?lN7(oR(O32BxEgsVMnieBJG|U?b-~7x;F2RV#
zoMV!tPpy{I8NNonVyzi4Ff&dn84d{MhEqrDIDCE}aQLfiGnD6xHI>uy>yOPZ@DR)u
z&TB(G8-rJ