Skip to content

1.11.0 #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3491e44
refactor: rename JwtTokenService => JsonWebTokenService
WeihanLi Jun 23, 2024
22a3a9a
refactor: more rename on JwtToken => JsonWebToken
WeihanLi Jun 23, 2024
b0e9662
Automated dotnet-format update from commit 22a3a9aa74d8f0bbe402f00398…
WeihanLi Jun 23, 2024
8bbfc94
update package version
WeihanLi Jun 23, 2024
09d33ce
Merge branch 'dev' of https://github.com/WeihanLi/WeihanLi.Web.Extens…
WeihanLi Jun 23, 2024
47d7834
build: remove build.cake
WeihanLi Jun 23, 2024
59f7b2d
feat: enable central package version management
WeihanLi Jun 23, 2024
6fa2899
refactor: rename extensions JsonWebTokenService => JwtService
WeihanLi Jun 23, 2024
8dd7d05
add auth sample for config inspector
WeihanLi Jun 24, 2024
73539a5
feat: config inspector support configKey filter
WeihanLi Jun 25, 2024
b85d127
refactor: use collection expression
WeihanLi Jun 29, 2024
736ca30
refactor: update condition
WeihanLi Jun 29, 2024
92676cd
Automated dotnet-format update from commit 736ca30805b3f33230d77619c2…
WeihanLi Jun 29, 2024
8f900e0
docs: update docfx.json
WeihanLi Jun 29, 2024
761a80e
refactor: simplify ConfigInspectorMiddleware
WeihanLi Jun 30, 2024
6a664f9
refactor: update config key filter logics
WeihanLi Jun 30, 2024
6fc6074
refactor: remove Path from ConfigInspectorOptions
WeihanLi Jun 30, 2024
afa5b11
update ConfigInspectorMiddleware
WeihanLi Jun 30, 2024
d52647f
Merge branch 'dev' of https://github.com/WeihanLi/WeihanLi.Web.Extens…
WeihanLi Jun 30, 2024
05b7735
Automated dotnet-format update from commit d52647fec1f905223a2ae0d47d…
WeihanLi Jun 30, 2024
63c89ad
feat: upgrade jwt package
WeihanLi Sep 6, 2024
c9edfa0
feat: update dependencies
WeihanLi Sep 6, 2024
2d86811
build: fix build script
WeihanLi Sep 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<VersionMajor>1</VersionMajor>
<VersionMinor>10</VersionMinor>
<VersionMinor>11</VersionMinor>
<VersionPatch>0</VersionPatch>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
<VersionSuffix Condition="'$(Configuration)'=='DEBUG'">develop</VersionSuffix>
Expand Down
19 changes: 19 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageFloatingVersionsEnabled>true</CentralPackageFloatingVersionsEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Condition="'$(TargetFramework)'=='net6.0'" Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.33" />
<PackageVersion Condition="'$(TargetFramework)'=='net7.0'" Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.20" />
<PackageVersion Condition="'$(TargetFramework)'=='net8.0'" Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
<PackageVersion Condition="'$(TargetFramework)'=='net9.0'" Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0-*" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.7.2" />
<PackageVersion Include="WeihanLi.Common" Version="1.0.69" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageVersion Include="xunit" Version="2.9.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
</Project>
165 changes: 0 additions & 165 deletions build.cake

This file was deleted.

10 changes: 5 additions & 5 deletions build/build.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var target = CommandLineParser.Val("target", "Default", args);
var apiKey = CommandLineParser.Val("apiKey", "", args);
var stable = CommandLineParser.Val("stable", null, args).ToBoolean();
var noPush = CommandLineParser.Val("noPush", null, args).ToBoolean();
var target = CommandLineParser.Val("target", args, "Default");
var apiKey = CommandLineParser.Val("apiKey", args);
var stable = CommandLineParser.BooleanVal("stable", args);
var noPush = CommandLineParser.BooleanVal("noPush", args);
var branchName = EnvHelper.Val("BUILD_SOURCEBRANCHNAME", "local");

var solutionPath = "./WeihanLi.Web.Extensions.sln";
Expand Down Expand Up @@ -114,4 +114,4 @@ async Task ExecuteCommandAsync(string commandText, KeyValuePair<string, string>[
var result = await CommandExecutor.ExecuteCommandAndOutputAsync(commandText);
result.EnsureSuccessExitCode();
Console.WriteLine();
}
}
55 changes: 19 additions & 36 deletions docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,43 @@
{
"src": [
{
"src": "./src",
"files": [
"src/**.csproj",
"src/WeihanLi.Web.Extensions/*.cs",
"src/**/*.cs"
],
"exclude": [ "**/bin/**", "**/obj/**" ]
"**/*.csproj"
]
}
],
"dest": "docs/api",
"disableGitFeatures": false,
"disableDefaultFilter": false
"dest": "docs/api"
}
],
"build": {
"content": [
"content": [
{
"files": [
"docs/api/**.md",
"docs/api/**.yml",
"docs/api/**/toc.yml",
"toc.yml",
"*.md"
"**/*.{md,yml}"
],
"exclude": [
"_site/**"
]
}
],
"resource": [
{
"files": [
"docs/images"
]
}
],
"overwrite": [
{
"files": [
"docs/api/**.md"
],
"exclude": [
"obj/**",
"_site/**"
"images/**"
]
}
],
"dest": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"output": "_site",
"template": [
"default"
"default",
"modern"
],
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": false,
"disableGitFeatures": false
"globalMetadata": {
"_appName": "WeihanLi.Web.Extensions",
"_appTitle": "WeihanLi.Web.Extensions",
"_enableSearch": true,
"pdf": false
}
}
}
52 changes: 49 additions & 3 deletions samples/WeihanLi.Web.Extensions.Samples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using System.Reflection;
using System.Text;
using System.Text.Json.Serialization;
using WeihanLi.Common.Aspect;
using WeihanLi.Common.Models;
Expand Down Expand Up @@ -41,7 +42,7 @@
options.KeyLocation = KeyLocation.HeaderOrQuery;
})
;
builder.Services.AddJwtTokenServiceWithJwtBearerAuth(options =>
builder.Services.AddJwtServiceWithJwtBearerAuth(options =>
{
options.SecretKey = Guid.NewGuid().ToString();
options.Issuer = "https://id.weihanli.xyz";
Expand Down Expand Up @@ -137,10 +138,55 @@
options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1");
});

app.MapConfigInspector().ShortCircuit();

app.UseAuthentication();
app.UseAuthorization();

// app.MapConfigInspector(optionsConfigure: options =>
// {
// options.ConfigRenderer = async (context, configs) =>
// {
// var htmlStart = """
// <html>
// <head>
// <title>Config Inspector</title>
// </head>
// <body>
// <table style="font-size:1.2em;line-height:1.6em">
// <thead>
// <tr>
// <th>Provider</th>
// <th>Key</th>
// <th>Value</th>
// <th>Active</th>
// </tr>
// </thead>
// <tbody>
// """;
// var htmlEnd = "</tbody></table></body></html>";
// var tbody = new StringBuilder();
// foreach (var config in configs)
// {
// tbody.Append($"<tr><td>{config.Provider}</td>");
// foreach (var item in config.Items)
// {
// tbody.Append(
// $$"""<td>{{item.Key}}</td><td>{{item.Value}}</td><td><input type="checkbox" {{(item.Active ? "checked" : "")}} /></td>""");
// }
//
// tbody.AppendLine("</tr>");
// }
//
// var responseText = $"{htmlStart}{tbody}{htmlEnd}";
// await context.Response.WriteAsync(responseText);
// };
// });

app.MapConfigInspector()
// .RequireAuthorization(x => x
// .AddAuthenticationSchemes("ApiKey")
// .RequireAuthenticatedUser()
// )
;
app.MapControllers();

await app.RunAsync();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -11,6 +11,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
<Import Project="../build/sign.props" />
<PropertyGroup>
<PropertyGroup>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
Loading
Loading