Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = crlf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{cs,csproj,props,targets,sln}]
charset = utf-8-bom

[*.{json,yml,yaml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:
- package-ecosystem: nuget
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 10
commit-message:
prefix: chore
include: scope
groups:
tests:
patterns: ["xunit*", "AwesomeAssertions"]
ignore:
# Never reintroduce FluentAssertions (commercial license since v8)
- dependency-name: "FluentAssertions"

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
commit-message:
prefix: ci
38 changes: 20 additions & 18 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:
inputs:
version:
description: Existing release to publish again (e.g. 8.0.1). Builds tag v<version> and pushes it to nuget.org.
description: Existing release to publish again (e.g. 9.0.0). Builds tag v<version> and pushes it to nuget.org.
required: true

env:
Expand All @@ -19,38 +19,40 @@ permissions:
id-token: write # NuGet trusted publishing (OIDC)

jobs:
build:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{ inputs.version && format('v{0}', inputs.version) || github.sha }}

- name: Setup .NET 8
uses: actions/setup-dotnet@v3
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: 8.0.x
global-json-file: global.json

- name: Setup .NET 9
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore

- name: Setup .NET 10
uses: actions/setup-dotnet@v3
with:
dotnet-version: 10.0.x
- name: Build
run: dotnet build --no-restore -c Release

- name: Test
run: dotnet test --no-build -c Release

- name: Semantic Release
id: semantic
if: github.event_name == 'push'
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 24
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
@semantic-release/changelog@6
@semantic-release/git@10
conventional-changelog-conventionalcommits@8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -65,7 +67,7 @@ jobs:

- name: Generate Package
if: steps.version.outputs.value != ''
run: dotnet pack -c Release -o out -p:PackageVersion=${{ steps.version.outputs.value }} -p:RepositoryUrl=${{env.CURRENT_REPO_URL}}
run: dotnet pack src/NetDevPack.Identity/NetDevPack.Identity.csproj -c Release -o out -p:Version=${{ steps.version.outputs.value }} -p:RepositoryUrl=${{ env.CURRENT_REPO_URL }}

- name: NuGet login (trusted publishing)
id: nuget
Expand All @@ -76,4 +78,4 @@ jobs:

- name: Publish the package to nuget.org
if: steps.version.outputs.value != ''
run: dotnet nuget push ./out/*.nupkg --skip-duplicate -n -d -k ${{ steps.nuget.outputs.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
run: dotnet nuget push ./out/*.nupkg --skip-duplicate -k ${{ steps.nuget.outputs.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
34 changes: 17 additions & 17 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
name: Pull Request Analisys
name: NetDevPack - MASTER PR

on:
pull_request:
branches: [ master ]

permissions:
contents: read

jobs:
build:
pull-request:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET 8
uses: actions/setup-dotnet@v3
uses: actions/checkout@v7
with:
dotnet-version: 8.0.x
fetch-depth: 0

- name: Setup .NET 9
uses: actions/setup-dotnet@v3
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: 9.0.x

- name: Setup .NET 10
uses: actions/setup-dotnet@v3
with:
dotnet-version: 10.0.x
global-json-file: global.json

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore -c Release

- name: Test
run: dotnet test --no-build
run: dotnet test --no-build -c Release

- name: Check vulnerable packages
run: |
dotnet list package --vulnerable --include-transitive 2>&1 | tee vulnerable.txt
! grep -q "has the following vulnerable packages" vulnerable.txt
31 changes: 21 additions & 10 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
{
"branches": ["master"],

"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/github",
"@semantic-release/git"
]
}
"branches": [
"master"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/changelog",
"@semantic-release/github",
"@semantic-release/git"
]
}
11 changes: 11 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>
<!-- Shared settings for every project under this repository -->
<PropertyGroup>
<LangVersion>latest</LangVersion>
<!-- Fail the build when a dependency has a known vulnerability (NuGet Audit) -->
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
<WarningsAsErrors>$(WarningsAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsAsErrors>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
</Project>
37 changes: 37 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project>
<!--
Central Package Management: every version lives here, csproj files only declare <PackageReference Include="..." />.
Microsoft.* packages that ship with .NET follow the target framework (net10.0 -> 10.0.x).
-->
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>

<ItemGroup>
<!-- Library -->
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.15" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.15" />
<PackageVersion Include="NetDevPack.Security.Jwt.AspNetCore" Version="10.0.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.23.0" />

<!--
Transitive pins: NetDevPack.Security.Jwt 10.0.0 depends on System.Security.Cryptography.Xml/Pkcs 10.0.12,
which have high severity advisories. Remove after moving to NetDevPack.Security.Jwt 11.
-->
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="10.0.15" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="10.0.15" />

<!-- Sample -->
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.15" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.15" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.15" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
<PackageVersion Include="NetDevPack" Version="8.0.2" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.3.1" />

<!-- Tests -->
<PackageVersion Include="AwesomeAssertions" Version="9.6.0" />
<PackageVersion Include="xunit.v3" Version="4.0.3" />
</ItemGroup>
</Project>
28 changes: 14 additions & 14 deletions NetDevPack.Identity.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCore.Jwt.Sample", "sr
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetDevPack.Identity.Tests", "tests\NetDevPack.Identity.Tests\NetDevPack.Identity.Tests.csproj", "{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetDevPack.Identity.Tests", "tests\NetDevPack.Identity.Tests\NetDevPack.Identity.Tests.csproj", "{791D0389-3723-4B9C-A49C-416B55FE51D5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -49,26 +49,26 @@ Global
{B5BE907B-0C79-489F-99BD-2AD82FA727E3}.Release|x64.Build.0 = Release|Any CPU
{B5BE907B-0C79-489F-99BD-2AD82FA727E3}.Release|x86.ActiveCfg = Release|Any CPU
{B5BE907B-0C79-489F-99BD-2AD82FA727E3}.Release|x86.Build.0 = Release|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Debug|x64.ActiveCfg = Debug|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Debug|x64.Build.0 = Debug|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Debug|x86.ActiveCfg = Debug|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Debug|x86.Build.0 = Debug|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Release|Any CPU.Build.0 = Release|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Release|x64.ActiveCfg = Release|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Release|x64.Build.0 = Release|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Release|x86.ActiveCfg = Release|Any CPU
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB}.Release|x86.Build.0 = Release|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Debug|x64.ActiveCfg = Debug|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Debug|x64.Build.0 = Debug|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Debug|x86.ActiveCfg = Debug|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Debug|x86.Build.0 = Debug|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Release|Any CPU.Build.0 = Release|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Release|x64.ActiveCfg = Release|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Release|x64.Build.0 = Release|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Release|x86.ActiveCfg = Release|Any CPU
{791D0389-3723-4B9C-A49C-416B55FE51D5}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{43A11876-765D-4387-BC28-4C9371DDD62D} = {7985C809-6CBD-44C2-BEA7-1AD828707F3E}
{B5BE907B-0C79-489F-99BD-2AD82FA727E3} = {8A673A3F-D855-4F9B-BA0B-0D2B5DE369EB}
{85BF6109-3FD5-4E5E-908E-4192A26EA8AB} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{791D0389-3723-4B9C-A49C-416B55FE51D5} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C92C10D5-BEA9-4EC0-BD95-6228657E412D}
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ If you liked the project or if NetDevPack helped you, please give a star ;)
dotnet add package NetDevPack.Identity
```

### Compatibility

| Version | Target frameworks | NetDevPack.Security.Jwt |
| ------- | ----------------- | ----------------------- |
| 9.x | .NET 10 (LTS) | 10.x |
| 8.x | .NET 8, .NET 10 | 8.x |

> **Breaking change in v9:** .NET 8 is out of support since 2026-11-10 and is no longer targeted. If you need it, stay on 8.x. The public API did not change.

If you want to use our IdentityDbContext (ASP.NET Identity standard) you will need to create the Identity tables. Set your connection string in the `appsettings.json` and follow the next steps:

Add the IdentityDbContext configuration in your `startup.cs`:
Expand Down
Loading
Loading