Browse Source

Merge branch 'dev' into auth-localization-fix

pull/14557/head
braim23 3 years ago
parent
commit
fba31a6662
  1. 77
      framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor
  2. 2
      modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo/Abp/FeatureManagement/IFeatureAppService.cs
  3. 2
      modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs
  4. 2
      modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor
  5. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor.cs
  6. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureSettingGroup/FeatureSettingManagementComponent.razor.cs
  7. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/ClientProxies/FeaturesClientProxy.Generated.cs
  8. 8
      modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/ClientProxies/featureManagement-generate-proxy.json
  9. 6
      modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo/Abp/FeatureManagement/FeaturesController.cs
  10. 2
      modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.js
  11. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.Web/wwwroot/client-proxies/featureManagement-proxy.js
  12. 2
      modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs
  13. 177
      modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20221101043137_Initial.Designer.cs
  14. 119
      modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20221101043137_Initial.cs
  15. 174
      modules/openiddict/app/OpenIddict.Demo.Server/Migrations/ServerDbContextModelSnapshot.cs
  16. 18
      modules/openiddict/app/OpenIddict.Demo.Server/OpenIddictServerModule.cs
  17. 2
      modules/openiddict/app/angular/README.md
  18. 55
      modules/openiddict/app/angular/angular.json
  19. 2
      modules/openiddict/app/angular/karma.conf.js
  20. 55
      modules/openiddict/app/angular/package.json
  21. 6
      modules/openiddict/app/angular/src/app/app.module.ts
  22. 1
      modules/openiddict/app/angular/src/app/home/home-routing.module.ts
  23. 43
      modules/openiddict/app/angular/src/app/home/home.component.html
  24. 100
      modules/openiddict/app/angular/src/app/home/home.component.spec.ts
  25. BIN
      modules/openiddict/app/angular/src/assets/images/logo/logo-light-thumbnail.png
  26. BIN
      modules/openiddict/app/angular/src/assets/images/logo/logo-light.png
  27. 6
      modules/openiddict/app/angular/src/environments/environment.prod.ts
  28. 6
      modules/openiddict/app/angular/src/environments/environment.ts
  29. 2
      modules/openiddict/app/angular/src/index.html
  30. 5
      modules/openiddict/app/angular/src/styles.scss
  31. 4
      modules/openiddict/app/angular/src/test.ts
  32. 7
      modules/openiddict/app/angular/tsconfig.json
  33. 6560
      modules/openiddict/app/angular/yarn.lock
  34. 6
      modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo.Abp.OpenIddict.AspNetCore.csproj
  35. 8
      modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.ClientCredentials.cs
  36. 12
      modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Handlers/AttachAbpCustomChallengeErrors.cs
  37. 2
      modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/OpenIddictClaimsPrincipalContributor.cs
  38. 2
      modules/openiddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo.Abp.OpenIddict.Domain.Shared.csproj
  39. 2
      modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo.Abp.OpenIddict.Domain.csproj

77
framework/src/Volo.Abp.BlazoriseUI/Components/UiMessageAlert.razor

@ -1,49 +1,52 @@
<Modal @ref="@ModalRef" Closing="@OnModalClosing">
<ModalContent Centered="@CenterMessage">
<ModalHeader>
<ModalTitle>
@Title
</ModalTitle>
</ModalHeader>
@if (!Title.IsNullOrEmpty())
{
<ModalHeader>
<ModalTitle>
@Title
</ModalTitle>
</ModalHeader>
}
<ModalBody>
@if ( ShowMessageIcon )
{
<DisplayHeading Size="DisplayHeadingSize.Is2" Alignment="TextAlignment.Center">
<Icon Name="@MessageIcon" Style="@MessageIconStyle" />
<DisplayHeading Size="DisplayHeadingSize.Is2" TextAlignment="TextAlignment.Center">
<Icon Name="@MessageIcon" Style="@MessageIconStyle" />
</DisplayHeading>
}
<Text Alignment="TextAlignment.Center">
<Paragraph TextAlignment="TextAlignment.Center" Margin="Margin.Is0.FromBottom">
@Message
</Text>
</Paragraph>
</ModalBody>
<ModalFooter>
@if ( IsConfirmation )
{
<Button Color="Color.Danger" Padding="Padding.Is2.OnX" Clicked="@OnCancelClicked">
@if ( Options?.CancelButtonIcon != null )
{
<Icon Name="@Options.CancelButtonIcon" Margin="Margin.Is2.FromEnd" />
}
@CancelButtonText
</Button>
<Button Color="Color.Primary" Padding="Padding.Is2.OnX" Clicked="@OnConfirmClicked">
@if ( Options?.ConfirmButtonIcon != null )
{
<Icon Name="@Options.ConfirmButtonIcon" Margin="Margin.Is2.FromEnd" />
}
@ConfirmButtonText
</Button>
}
else
{
<Button Color="Color.Primary" Padding="Padding.Is2.OnX" Clicked="@OnOkClicked">
@if ( Options?.OkButtonIcon != null )
{
<Icon Name="@Options.OkButtonIcon" Margin="Margin.Is2.FromEnd" />
}
@OkButtonText
</Button>
}
<ModalFooter class="d-flex justify-content-center">
@if ( IsConfirmation )
{
<Button Color="Color.Danger" Padding="Padding.Is3.OnX" Margin="Margin.Is1.OnX" Clicked="@OnCancelClicked">
@if ( Options?.CancelButtonIcon != null )
{
<Icon Name="@Options.CancelButtonIcon" Margin="Margin.Is2.FromEnd" />
}
@CancelButtonText
</Button>
<Button Color="Color.Primary" Padding="Padding.Is3.OnX" Margin="Margin.Is1.OnX" Clicked="@OnConfirmClicked">
@if ( Options?.ConfirmButtonIcon != null )
{
<Icon Name="@Options.ConfirmButtonIcon" Margin="Margin.Is2.FromEnd" />
}
@ConfirmButtonText
</Button>
}
else
{
<Button Color="Color.Primary" Padding="Padding.Is3.OnX" Margin="Margin.Is1.OnX" Clicked="@OnOkClicked">
@if ( Options?.OkButtonIcon != null )
{
<Icon Name="@Options.OkButtonIcon" Margin="Margin.Is2.FromEnd" />
}
@OkButtonText
</Button>
}
</ModalFooter>
</ModalContent>
</Modal>

2
modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo/Abp/FeatureManagement/IFeatureAppService.cs

@ -10,5 +10,5 @@ public interface IFeatureAppService : IApplicationService
Task UpdateAsync([NotNull] string providerName, string providerKey, UpdateFeaturesDto input);
Task ResetToDefaultAsync([NotNull] string providerName, string providerKey);
Task DeleteAsync([NotNull] string providerName, string providerKey);
}

2
modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs

@ -138,7 +138,7 @@ public class FeatureAppService : FeatureManagementAppServiceBase, IFeatureAppSer
await AuthorizationService.CheckAsync(policyName);
}
public virtual async Task ResetToDefaultAsync([NotNull] string providerName, string providerKey)
public virtual async Task DeleteAsync([NotNull] string providerName, string providerKey)
{
await FeatureValueRepository.DeleteAsync(providerName, providerKey);
}

2
modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor

@ -97,7 +97,7 @@
}
</ModalBody>
<ModalFooter>
<Button Color="Color.Primary" Clicked="@(async () => await ResetToDefaultAsync(ProviderName,ProviderKey))">@L["ResetToDefault"]</Button>
<Button Color="Color.Primary" Clicked="@(async () => await DeleteAsync(ProviderName,ProviderKey))">@L["ResetToDefault"]</Button>
<Button Color="Color.Secondary" Clicked="CloseModal">@L["Cancel"]</Button>
<Button Color="Color.Primary" Clicked="SaveAsync">@L["Save"]</Button>
</ModalFooter>

4
modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor.cs

@ -114,13 +114,13 @@ public partial class FeatureManagementModal
}
}
public virtual async Task ResetToDefaultAsync([NotNull] string providerName, string providerKey = null)
public virtual async Task DeleteAsync([NotNull] string providerName, string providerKey = null)
{
if (!await Message.Confirm(L["AreYouSureToResetToDefault"]))
{
return;
}
await FeatureAppService.ResetToDefaultAsync(ProviderName, ProviderKey);
await FeatureAppService.DeleteAsync(ProviderName, ProviderKey);
await Message.Success(L["ResetedToDefault"]);
}

4
modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureSettingGroup/FeatureSettingManagementComponent.razor.cs

@ -1,6 +1,6 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Volo.Abp.AspNetCore.Components;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.FeatureManagement.Localization;
@ -26,7 +26,7 @@ public partial class FeatureSettingManagementComponent : AbpComponentBase
{
Settings = new FeatureSettingViewModel
{
HasManageHostFeaturesPermission = await PermissionChecker.IsGrantedAsync(FeatureManagementPermissions.ManageHostFeatures)
HasManageHostFeaturesPermission = await AuthorizationService.IsGrantedAsync(FeatureManagementPermissions.ManageHostFeatures)
};
}

4
modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/ClientProxies/FeaturesClientProxy.Generated.cs

@ -34,9 +34,9 @@ public partial class FeaturesClientProxy : ClientProxyBase<IFeatureAppService>,
});
}
public virtual async Task ResetToDefaultAsync(string providerName, string providerKey)
public virtual async Task DeleteAsync(string providerName, string providerKey)
{
await RequestAsync(nameof(ResetToDefaultAsync), new ClientProxyRequestTypeValue
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), providerName },
{ typeof(string), providerKey }

8
modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/ClientProxies/featureManagement-generate-proxy.json

@ -150,10 +150,10 @@
"allowAnonymous": null,
"implementFrom": "Volo.Abp.FeatureManagement.IFeatureAppService"
},
"ResetToDefaultAsyncByProviderNameAndProviderKey": {
"uniqueName": "ResetToDefaultAsyncByProviderNameAndProviderKey",
"name": "ResetToDefaultAsync",
"httpMethod": null,
"DeleteAsyncByProviderNameAndProviderKey": {
"uniqueName": "DeleteAsyncByProviderNameAndProviderKey",
"name": "DeleteAsync",
"httpMethod": "DELETE",
"url": "api/feature-management/features",
"supportedVersions": [],
"parametersOnMethod": [

6
modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo/Abp/FeatureManagement/FeaturesController.cs

@ -28,9 +28,9 @@ public class FeaturesController : AbpControllerBase, IFeatureAppService
return FeatureAppService.UpdateAsync(providerName, providerKey, input);
}
[HttpPost]
public Task ResetToDefaultAsync(string providerName, string providerKey)
[HttpDelete]
public virtual Task DeleteAsync(string providerName, string providerKey)
{
return FeatureAppService.ResetToDefaultAsync(providerName, providerKey);
return FeatureAppService.DeleteAsync(providerName, providerKey);
}
}

2
modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.js

@ -13,7 +13,7 @@ var abp = abp || {};
if (confirmed) {
let providerName = $('#ProviderName').val();
let prodiverKey = $('#ProviderKey').val();
volo.abp.featureManagement.features.resetToDefault(providerName, prodiverKey).then(function () {
volo.abp.featureManagement.features.delete(providerName, prodiverKey).then(function () {
abp.notify.success(l('ResetedToDefault'));
});
}

4
modules/feature-management/src/Volo.Abp.FeatureManagement.Web/wwwroot/client-proxies/featureManagement-proxy.js

@ -27,10 +27,10 @@
}, ajaxParams));
};
volo.abp.featureManagement.features.resetToDefault = function(providerName, providerKey, ajaxParams) {
volo.abp.featureManagement.features['delete'] = function(providerName, providerKey, ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/feature-management/features' + abp.utils.buildQueryString([{ name: 'providerName', value: providerName }, { name: 'providerKey', value: providerKey }]) + '',
type: 'POST',
type: 'DELETE',
dataType: null
}, ajaxParams));
};

2
modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs

@ -73,7 +73,7 @@ public class FeatureAppService_Tests : FeatureManagementApplicationTestBase
{
Login(_testData.User1Id);
var exception = await Record.ExceptionAsync(async () =>
await _featureAppService.ResetToDefaultAsync("test", "test"));
await _featureAppService.DeleteAsync("test", "test"));
Assert.Null(exception);
}

177
modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20220623064459_Initial.Designer.cs → modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20221101043137_Initial.Designer.cs

@ -13,18 +13,108 @@ using Volo.Abp.EntityFrameworkCore;
namespace OpenIddict.Demo.Server.Migrations
{
[DbContext(typeof(ServerDbContext))]
[Migration("20220623064459_Initial")]
[Migration("20221101043137_Initial")]
partial class Initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("ProductVersion", "6.0.5")
.HasAnnotation("ProductVersion", "7.0.0-rc.2.22472.11")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("AllowedProviders")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("DefaultValue")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("Description")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<bool>("IsAvailableToHost")
.HasColumnType("bit");
b.Property<bool>("IsVisibleToClients")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ParentName")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ValueType")
.HasMaxLength(2048)
.HasColumnType("nvarchar(2048)");
b.HasKey("Id");
b.HasIndex("GroupName");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpFeatures", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpFeatureGroups", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
{
@ -1011,6 +1101,59 @@ namespace OpenIddict.Demo.Server.Migrations
b.ToTable("OpenIddictTokens", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<bool>("IsEnabled")
.HasColumnType("bit");
b.Property<byte>("MultiTenancySide")
.HasColumnType("tinyint");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ParentName")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Providers")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("StateCheckers")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("GroupName");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpPermissions", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
@ -1045,6 +1188,34 @@ namespace OpenIddict.Demo.Server.Migrations
b.ToTable("AbpPermissionGrants", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpPermissionGroups", (string)null);
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")

119
modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20220623064459_Initial.cs → modules/openiddict/app/OpenIddict.Demo.Server/Migrations/20221101043137_Initial.cs

@ -5,8 +5,10 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace OpenIddict.Demo.Server.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
@ -29,6 +31,42 @@ namespace OpenIddict.Demo.Server.Migrations
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpFeatureGroups",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpFeatureGroups", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpFeatures",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ParentName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Description = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
DefaultValue = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
IsVisibleToClients = table.Column<bool>(type: "bit", nullable: false),
IsAvailableToHost = table.Column<bool>(type: "bit", nullable: false),
AllowedProviders = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ValueType = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpFeatures", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpFeatureValues",
columns: table => new
@ -103,6 +141,40 @@ namespace OpenIddict.Demo.Server.Migrations
table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpPermissionGroups",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpPermissionGroups", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpPermissions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ParentName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
IsEnabled = table.Column<bool>(type: "bit", nullable: false),
MultiTenancySide = table.Column<byte>(type: "tinyint", nullable: false),
Providers = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
StateCheckers = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpPermissions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpRoles",
columns: table => new
@ -536,6 +608,23 @@ namespace OpenIddict.Demo.Server.Migrations
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_AbpFeatureGroups_Name",
table: "AbpFeatureGroups",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AbpFeatures_GroupName",
table: "AbpFeatures",
column: "GroupName");
migrationBuilder.CreateIndex(
name: "IX_AbpFeatures_Name",
table: "AbpFeatures",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AbpFeatureValues_Name_ProviderName_ProviderKey",
table: "AbpFeatureValues",
@ -572,6 +661,23 @@ namespace OpenIddict.Demo.Server.Migrations
unique: true,
filter: "[TenantId] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_AbpPermissionGroups_Name",
table: "AbpPermissionGroups",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AbpPermissions_GroupName",
table: "AbpPermissions",
column: "GroupName");
migrationBuilder.CreateIndex(
name: "IX_AbpPermissions_Name",
table: "AbpPermissions",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AbpRoleClaims_RoleId",
table: "AbpRoleClaims",
@ -685,11 +791,18 @@ namespace OpenIddict.Demo.Server.Migrations
column: "ReferenceId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpClaimTypes");
migrationBuilder.DropTable(
name: "AbpFeatureGroups");
migrationBuilder.DropTable(
name: "AbpFeatures");
migrationBuilder.DropTable(
name: "AbpFeatureValues");
@ -702,6 +815,12 @@ namespace OpenIddict.Demo.Server.Migrations
migrationBuilder.DropTable(
name: "AbpPermissionGrants");
migrationBuilder.DropTable(
name: "AbpPermissionGroups");
migrationBuilder.DropTable(
name: "AbpPermissions");
migrationBuilder.DropTable(
name: "AbpRoleClaims");

174
modules/openiddict/app/OpenIddict.Demo.Server/Migrations/ServerDbContextModelSnapshot.cs

@ -19,10 +19,99 @@ namespace OpenIddict.Demo.Server.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("ProductVersion", "6.0.5")
.HasAnnotation("ProductVersion", "7.0.0-rc.2.22472.11")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("AllowedProviders")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("DefaultValue")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("Description")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<bool>("IsAvailableToHost")
.HasColumnType("bit");
b.Property<bool>("IsVisibleToClients")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ParentName")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ValueType")
.HasMaxLength(2048)
.HasColumnType("nvarchar(2048)");
b.HasKey("Id");
b.HasIndex("GroupName");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpFeatures", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpFeatureGroups", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
{
@ -1009,6 +1098,59 @@ namespace OpenIddict.Demo.Server.Migrations
b.ToTable("OpenIddictTokens", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<bool>("IsEnabled")
.HasColumnType("bit");
b.Property<byte>("MultiTenancySide")
.HasColumnType("tinyint");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ParentName")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Providers")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("StateCheckers")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("GroupName");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpPermissions", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
@ -1043,6 +1185,34 @@ namespace OpenIddict.Demo.Server.Migrations
b.ToTable("AbpPermissionGrants", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpPermissionGroups", (string)null);
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")

18
modules/openiddict/app/OpenIddict.Demo.Server/OpenIddictServerModule.cs

@ -151,20 +151,16 @@ public class OpenIddictServerModule : AbpModule
if ((await dbContext.Database.GetPendingMigrationsAsync()).Any())
{
await dbContext.Database.MigrateAsync();
await context.ServiceProvider
.GetRequiredService<IDataSeeder>()
.SeedAsync();
}
await context.ServiceProvider
.GetRequiredService<IDataSeeder>()
.SeedAsync();
var tenantManager = context.ServiceProvider.GetRequiredService<TenantManager>();
var tenantRepository = context.ServiceProvider.GetRequiredService<ITenantRepository>();
if (await tenantRepository.FindByNameAsync("Default") == null)
{
var tenant = await tenantRepository.InsertAsync( await tenantManager.CreateAsync("Default"));
await context.ServiceProvider
.GetRequiredService<IDataSeeder>()
.SeedAsync(tenant.Id);
}
var tenant = await tenantRepository.FindByNameAsync("Default") ??
await tenantRepository.InsertAsync(await tenantManager.CreateAsync("Default"));
await context.ServiceProvider.GetRequiredService<IDataSeeder>().SeedAsync(tenant.Id);
}
}

2
modules/openiddict/app/angular/README.md

@ -1,4 +1,4 @@
# Angular
# BookStore
This is a startup project based on the ABP framework. For more information, visit <a href="https://abp.io/" target="_blank">abp.io</a>

55
modules/openiddict/app/angular/angular.json

@ -2,12 +2,12 @@
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": false,
"defaultCollection": "@angular-eslint/schematics"
"schematicCollections": ["@angular-eslint/schematics"]
},
"version": 1,
"newProjectRoot": "projects",
"projects": {
"Angular": {
"BookStore": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
@ -21,7 +21,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/Angular",
"outputPath": "dist/BookStore",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
@ -56,15 +56,46 @@
"bundleName": "ngx-datatable-material"
},
{
"input": "node_modules/bootstrap/dist/css/bootstrap.rtl.min.css",
"input": "node_modules/@volo/ngx-lepton-x.lite/assets/css/bootstrap-dim.css",
"inject": false,
"bundleName": "bootstrap-rtl.min"
"bundleName": "bootstrap-dim"
},
{
"input": "node_modules/bootstrap/dist/css/bootstrap.min.css",
"inject": true,
"bundleName": "bootstrap-ltr.min"
"input": "node_modules/@volo/ngx-lepton-x.lite/assets/css/ng-bundle.css",
"inject": false,
"bundleName": "ng-bundle"
},
{
"input": "node_modules/@volo/ngx-lepton-x.lite/assets/css/side-menu/layout-bundle.css",
"inject": false,
"bundleName": "layout-bundle"
},
{
"input": "node_modules/@abp/ng.theme.lepton-x/assets/css/abp-bundle.css",
"inject": false,
"bundleName": "abp-bundle"
},
{
"input": "node_modules/@volo/ngx-lepton-x.lite/assets/css/bootstrap-dim.rtl.css",
"inject": false,
"bundleName": "bootstrap-dim.rtl"
},
{
"input": "node_modules/@volo/ngx-lepton-x.lite/assets/css/ng-bundle.rtl.css",
"inject": false,
"bundleName": "ng-bundle.rtl"
},
{
"input": "node_modules/@volo/ngx-lepton-x.lite/assets/css/side-menu/layout-bundle.rtl.css",
"inject": false,
"bundleName": "layout-bundle.rtl"
},
{
"input": "node_modules/@abp/ng.theme.lepton-x/assets/css/abp-bundle.rtl.css",
"inject": false,
"bundleName": "abp-bundle.rtl"
},
"node_modules/bootstrap-icons/font/bootstrap-icons.css",
"src/styles.scss"
],
"scripts": []
@ -106,10 +137,10 @@
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "Angular:build:production"
"browserTarget": "BookStore:build:production"
},
"development": {
"browserTarget": "Angular:build:development"
"browserTarget": "BookStore:build:development"
}
},
"defaultConfiguration": "development"
@ -117,7 +148,7 @@
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "Angular:build"
"browserTarget": "BookStore:build"
}
},
"test": {
@ -142,5 +173,5 @@
}
}
},
"defaultProject": "Angular"
"defaultProject": "BookStore"
}

2
modules/openiddict/app/angular/karma.conf.js

@ -25,7 +25,7 @@ module.exports = function (config) {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/Angular'),
dir: require('path').join(__dirname, './coverage/BookStore'),
subdir: '.',
reporters: [
{ type: 'html' },

55
modules/openiddict/app/angular/package.json

@ -1,5 +1,5 @@
{
"name": "Angular",
"name": "BookStore",
"version": "0.0.0",
"scripts": {
"ng": "ng",
@ -18,44 +18,45 @@
"@abp/ng.identity": "~6.0.1",
"@abp/ng.setting-management": "~6.0.1",
"@abp/ng.tenant-management": "~6.0.1",
"@abp/ng.theme.basic": "~6.0.1",
"@abp/ng.theme.lepton-x": "^1.0.0",
"@abp/ng.theme.shared": "~6.0.1",
"@angular/animations": "~13.1.1",
"@angular/common": "~13.1.1",
"@angular/compiler": "~13.1.1",
"@angular/core": "~13.1.1",
"@angular/forms": "~13.1.1",
"@angular/localize": "~13.1.1",
"@angular/platform-browser": "~13.1.1",
"@angular/platform-browser-dynamic": "~13.1.1",
"@angular/router": "~13.1.1",
"rxjs": "~6.6.0",
"@angular/animations": "^14.2.1",
"@angular/common": "^14.2.1",
"@angular/compiler": "^14.2.1",
"@angular/core": "^14.2.1",
"@angular/forms": "^14.2.1",
"@angular/localize": "^14.2.1",
"@angular/platform-browser": "^14.2.1",
"@angular/platform-browser-dynamic": "^14.2.1",
"@angular/router": "^14.2.1",
"bootstrap-icons": "~1.8.3",
"rxjs": "7.5.6",
"tslib": "^2.1.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@abp/ng.schematics": "~6.0.1",
"@angular-devkit/build-angular": "~13.1.2",
"@angular-eslint/builder": "~13.0.1",
"@angular-eslint/eslint-plugin": "~13.0.1",
"@angular-eslint/eslint-plugin-template": "~13.0.1",
"@angular-eslint/schematics": "~13.0.1",
"@angular-eslint/template-parser": "~13.0.1",
"@angular/cli": "~13.1.2",
"@angular/compiler-cli": "~13.1.1",
"@angular/language-service": "~13.1.1",
"@angular-devkit/build-angular": "^14.2.3",
"@angular-eslint/builder": "~14.1.1",
"@angular-eslint/eslint-plugin": "~14.1.1",
"@angular-eslint/eslint-plugin-template": "~14.1.1",
"@angular-eslint/schematics": "~14.1.1",
"@angular-eslint/template-parser": "~14.1.1",
"@angular/cli": "^14.2.3",
"@angular/compiler-cli": "^14.2.1",
"@angular/language-service": "^14.2.1",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "5.3.0",
"@typescript-eslint/parser": "5.3.0",
"eslint": "^8.2.0",
"jasmine-core": "~3.7.0",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"eslint": "^8.23.0",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.7.0",
"ng-packagr": "^13.1.2",
"typescript": "~4.5.4"
"ng-packagr": "^14.2.1",
"typescript": "~4.8.3"
}
}

6
modules/openiddict/app/angular/src/app/app.module.ts

@ -4,7 +4,8 @@ import { registerLocale } from '@abp/ng.core/locale';
import { IdentityConfigModule } from '@abp/ng.identity/config';
import { SettingManagementConfigModule } from '@abp/ng.setting-management/config';
import { TenantManagementConfigModule } from '@abp/ng.tenant-management/config';
import { ThemeBasicModule } from '@abp/ng.theme.basic';
import { ThemeLeptonXModule } from '@abp/ng.theme.lepton-x';
import { SideMenuLayoutModule } from '@abp/ng.theme.lepton-x/layouts';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
@ -28,7 +29,8 @@ import { APP_ROUTE_PROVIDER } from './route.provider';
IdentityConfigModule.forRoot(),
TenantManagementConfigModule.forRoot(),
SettingManagementConfigModule.forRoot(),
ThemeBasicModule.forRoot(),
ThemeLeptonXModule.forRoot(),
SideMenuLayoutModule.forRoot(),
],
declarations: [AppComponent],
providers: [APP_ROUTE_PROVIDER],

1
modules/openiddict/app/angular/src/app/home/home-routing.module.ts

@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home.component';
import { ApplicationLayoutComponent } from '@abp/ng.theme.basic';
const routes: Routes = [{ path: '', component: HomeComponent }];

43
modules/openiddict/app/angular/src/app/home/home.component.html

@ -2,7 +2,7 @@
<div class="p-5 text-center">
<div class="d-inline-block bg-success text-white p-1 h5 rounded mb-4" role="alert">
<h5 class="m-1">
<i class="fas fa-rocket"></i> Congratulations, <strong>Angular</strong> is
<i class="fas fa-rocket"></i> Congratulations, <strong>BookStore</strong> is
successfully running!
</h5>
</div>
@ -11,9 +11,38 @@
<p class="lead px-lg-5 mx-lg-5">{{ '::LongWelcomeMessage' | abpLocalization }}</p>
<a *ngIf="!hasLoggedIn" (click)="login()" class="px-4 btn btn-primary ms-1" role="button"
><i class="fa fa-sign-in"></i> {{ 'AbpAccount::Login' | abpLocalization }}</a
><i class="fa fa-sign-in"></i> {{ 'AbpAccount::Login' | abpLocalization }}</a
>
</div>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-auto text-center">
<img src="https://abp.io/assets/png/mastering-abp-framework.webp" style="max-width: 400px;"
class="w-100 mb-5 my-md-3">
</div>
<div class="col-md d-flex align-items-center">
<div class="pe-0 pe-md-4">
<small class="text-uppercase text-muted">THE OFFICIAL GUIDE</small>
<h2 class="mb-4">Mastering ABP Framework</h2>
<p class="mb-4">Written by the creator of the ABP Framework, this book will help you gain a complete
understanding of the framework and modern web application development techniques.</p>
<div class="mb-4">
<a href="https://www.amazon.com/gp/product/B097Z2DM8Q/ref=dbs_a_def_rwt_hsch_vapi_tkin_p1_i0"
class="btn btn-success mb-1">
Buy on Amazon US
</a>
&nbsp;
<a href="https://www.packtpub.com/product/mastering-abp-framework/9781801079242"
class="btn btn-primary mb-1">
Buy on PACKT
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="my-3 text-center">
<h3>Let's improve your application!</h3>
<p>Here are some links to help you get started:</p>
@ -268,13 +297,13 @@
<div class="mb-5 text-center">
<p class="align-middle">
<a href="https://twitter.com/abpframework" target="_blank" class="mx-2"
><i class="fa fa-twitter"></i><span class="text-secondary"> Abp Framework</span></a
><i class="fa fa-twitter"></i><span class="text-secondary"> Abp Framework</span></a
>
<a href="https://twitter.com/abpcommercial" target="_blank" class="mx-2"
><i class="fa fa-twitter"></i><span class="text-secondary"> Abp Commercial</span></a
><i class="fa fa-twitter"></i><span class="text-secondary"> Abp Commercial</span></a
>
<a href="https://github.com/abpframework/abp" target="_blank" class="mx-2"
><i class="fa fa-github"></i><span class="text-secondary"> abpframework</span></a
><i class="fa fa-github"></i><span class="text-secondary"> abpframework</span></a
>
</p>
</div>
@ -296,7 +325,7 @@
[href]="link.href"
target="_blank"
class="btn btn-link px-1"
>{{ link.label }} <i class="fas fa-chevron-right"></i
>{{ link.label }} <i class="fas fa-chevron-right"></i
></a>
</div>
</div>
@ -309,7 +338,7 @@
<i class="fas fa-plus d-block mb-3 fa- 2x text-secondary"></i>
<span [innerHTML]="context.title"></span>
<a [href]="context.href" target="_blank" class="d-block mt-2 btn btn-sm btn-link"
>Details <i class="fas fa-chevron-right"></i
>Details <i class="fas fa-chevron-right"></i
></a>
</h6>
</div>

100
modules/openiddict/app/angular/src/app/home/home.component.spec.ts

@ -0,0 +1,100 @@
import { CoreTestingModule } from "@abp/ng.core/testing";
import { ThemeBasicTestingModule } from "@abp/ng.theme.basic/testing";
import { ThemeSharedTestingModule } from "@abp/ng.theme.shared/testing";
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { NgxValidateCoreModule } from "@ngx-validate/core";
import { HomeComponent } from "./home.component";
import { OAuthService } from 'angular-oauth2-oidc';
import { AuthService } from '@abp/ng.core';
describe("HomeComponent", () => {
let fixture: ComponentFixture<HomeComponent>;
const mockOAuthService = jasmine.createSpyObj('OAuthService', ['hasValidAccessToken'])
const mockAuthService = jasmine.createSpyObj('AuthService', ['navigateToLogin'])
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [HomeComponent],
imports: [
CoreTestingModule.withConfig(),
ThemeSharedTestingModule.withConfig(),
ThemeBasicTestingModule.withConfig(),
NgxValidateCoreModule,
],
providers: [
/* mock providers here */
{
provide: OAuthService,
useValue: mockOAuthService
},
{
provide: AuthService,
useValue: mockAuthService
}
],
}).compileComponents();
})
);
beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
fixture.detectChanges();
});
it("should be initiated", () => {
expect(fixture.componentInstance).toBeTruthy();
});
describe('when login state is true', () => {
beforeAll(() => {
mockOAuthService.hasValidAccessToken.and.returnValue(true)
});
it("hasLoggedIn should be true", () => {
expect(fixture.componentInstance.hasLoggedIn).toBeTrue();
expect(mockOAuthService.hasValidAccessToken).toHaveBeenCalled()
})
it("button should not be exists", () => {
const element = fixture.nativeElement
const button = element.querySelector('[role="button"]')
expect(button).toBeNull()
})
})
describe('when login state is false', () => {
beforeAll(() => {
mockOAuthService.hasValidAccessToken.and.returnValue(false)
});
it("hasLoggedIn should be false", () => {
expect(fixture.componentInstance.hasLoggedIn).toBeFalse();
expect(mockOAuthService.hasValidAccessToken).toHaveBeenCalled()
})
it("button should be exists", () => {
const element = fixture.nativeElement
const button = element.querySelector('[role="button"]')
expect(button).toBeDefined()
})
describe('when button clicked', () => {
beforeEach(() => {
const element = fixture.nativeElement
const button = element.querySelector('[role="button"]')
button.click()
});
it("navigateToLogin have been called", () => {
expect(mockAuthService.navigateToLogin).toHaveBeenCalled()
})
})
})
});

BIN
modules/openiddict/app/angular/src/assets/images/logo/logo-light-thumbnail.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
modules/openiddict/app/angular/src/assets/images/logo/logo-light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

6
modules/openiddict/app/angular/src/environments/environment.prod.ts

@ -6,7 +6,7 @@ export const environment = {
production: true,
application: {
baseUrl,
name: 'Angular',
name: 'BookStore',
logoUrl: '',
},
oAuthConfig: {
@ -16,12 +16,12 @@ export const environment = {
dummyClientSecret: '1q2w3e*',
responseType: 'code',
scope: 'offline_access AbpAPI',
requireHttps: true
requireHttps: true,
},
apis: {
default: {
url: 'https://localhost:44301',
rootNamespace: 'OpenIddict.Demo.Client.Angular',
rootNamespace: 'BookStore',
},
},
} as Environment;

6
modules/openiddict/app/angular/src/environments/environment.ts

@ -6,7 +6,7 @@ export const environment = {
production: false,
application: {
baseUrl,
name: 'Angular',
name: 'BookStore',
logoUrl: '',
},
oAuthConfig: {
@ -16,12 +16,12 @@ export const environment = {
dummyClientSecret: '1q2w3e*',
responseType: 'code',
scope: 'offline_access AbpAPI',
requireHttps: false,
requireHttps: true,
},
apis: {
default: {
url: 'https://localhost:44301',
rootNamespace: 'OpenIddict.Demo.Client.Angular',
rootNamespace: 'BookStore',
},
},
} as Environment;

2
modules/openiddict/app/angular/src/index.html

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Angular</title>
<title>BookStore</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

5
modules/openiddict/app/angular/src/styles.scss

@ -8,6 +8,10 @@
transform: rotate(360deg);
}
}
:root {
--lpx-logo: url('/assets/images/logo/logo-light.png');
--lpx-logo-icon: url('/assets/images/logo/logo-light-thumbnail.png');
}
.donut {
display: inline-block;
border: 4px solid rgba(0, 0, 0, 0.1);
@ -23,4 +27,5 @@
left: 50%;
transform: translate(-50%, -50%);
}
}

4
modules/openiddict/app/angular/src/test.ts

@ -1,11 +1,11 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
import 'zone.js/testing';
declare const require: {
context(

7
modules/openiddict/app/angular/tsconfig.json

@ -10,12 +10,9 @@
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"target": "es2020",
"module": "es2020",
"lib": [
"es2018",
"dom"
],
"lib": ["es2018", "dom"],
"paths": {
"@proxy": ["src/app/proxy/index.ts"],
"@proxy/*": ["src/app/proxy/*"]

6560
modules/openiddict/app/angular/yarn.lock

File diff suppressed because it is too large

6
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo.Abp.OpenIddict.AspNetCore.csproj

@ -20,8 +20,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OpenIddict.Server.AspNetCore" Version="3.1.1" />
<PackageReference Include="OpenIddict.Validation.AspNetCore" Version="3.1.1" />
<PackageReference Include="OpenIddict.Validation.ServerIntegration" Version="3.1.1" />
<PackageReference Include="OpenIddict.Server.AspNetCore" Version="4.0.0-preview4.22517.68" />
<PackageReference Include="OpenIddict.Validation.AspNetCore" Version="4.0.0-preview4.22517.68" />
<PackageReference Include="OpenIddict.Validation.ServerIntegration" Version="4.0.0-preview4.22517.68" />
</ItemGroup>
</Project>

8
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.ClientCredentials.cs

@ -29,13 +29,9 @@ public partial class TokenController
OpenIddictConstants.Claims.PreferredUsername, OpenIddictConstants.Claims.Role);
// The Subject and PreferredUsername will be removed by <see cref="RemoveClaimsFromClientCredentialsGrantType"/>.
// Use the client_id as the subject identifier.
identity.AddClaim(OpenIddictConstants.Claims.Subject, await ApplicationManager.GetClientIdAsync(application),
OpenIddictConstants.Destinations.AccessToken, OpenIddictConstants.Destinations.IdentityToken);
identity.AddClaim(OpenIddictConstants.Claims.PreferredUsername, await ApplicationManager.GetDisplayNameAsync(application),
OpenIddictConstants.Destinations.AccessToken, OpenIddictConstants.Destinations.IdentityToken);
identity.AddClaim(OpenIddictConstants.Claims.Subject, await ApplicationManager.GetClientIdAsync(application));
identity.AddClaim(OpenIddictConstants.Claims.PreferredUsername, await ApplicationManager.GetDisplayNameAsync(application));
// Note: In the original OAuth 2.0 specification, the client credentials grant
// doesn't return an identity token, which is an OpenID Connect concept.

12
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Handlers/AttachAbpCustomChallengeErrors.cs

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using OpenIddict.Server;
namespace Volo.Abp.OpenIddict.Handlers;
@ -26,13 +24,9 @@ public class AttachAbpCustomChallengeErrors : IOpenIddictServerHandler<OpenIddic
{
Check.NotNull(context, nameof(context));
var properties = context.Transaction.Properties[typeof(AuthenticationProperties).FullName!].As<AuthenticationProperties>();
if (properties != null)
foreach (var property in context.Properties.Where(x => CustomChallengeErrors.Contains(x.Key)))
{
foreach (var property in properties.Items.Where(x => CustomChallengeErrors.Contains(x.Key)))
{
context.Response.SetParameter(property.Key, property.Value);
}
context.Response.SetParameter(property.Key, property.Value);
}
return default;

2
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/OpenIddictClaimsPrincipalContributor.cs

@ -36,7 +36,7 @@ public class OpenIddictClaimsPrincipalContributor : IAbpClaimsPrincipalContribut
var clientId = httpContext.GetOpenIddictServerRequest()?.ClientId;
if (clientId != null)
{
identity.AddClaim(OpenIddictConstants.Claims.ClientId, clientId, OpenIddictConstants.Destinations.AccessToken);
identity.AddClaim(OpenIddictConstants.Claims.ClientId, clientId);
}
}
}

2
modules/openiddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo.Abp.OpenIddict.Domain.Shared.csproj

@ -14,7 +14,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OpenIddict.Abstractions" Version="3.1.1" />
<PackageReference Include="OpenIddict.Abstractions" Version="4.0.0-preview4.22517.68" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftPackageVersion)" />
</ItemGroup>

2
modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo.Abp.OpenIddict.Domain.csproj

@ -17,7 +17,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OpenIddict.Core" Version="3.1.1" />
<PackageReference Include="OpenIddict.Core" Version="4.0.0-preview4.22517.68" />
</ItemGroup>
</Project>

Loading…
Cancel
Save