Skip to content

Commit 42f9978

Browse files
committed
Refactor Swashbuckle support into separate package
- Updated README.md to note Swashbuckle support moved to SimpleAuthentication.Swashbuckle. - Added SimpleAuthentication.Swashbuckle project to solution. - Updated sample projects to target net9.0 and reference SimpleAuthentication.Swashbuckle. - Updated SimpleAuthentication.csproj with conditional OpenApi reference and updated dependencies. - Removed Swashbuckle-related files from SimpleAuthentication. - Added GitHub Actions workflow to publish SimpleAuthentication.Swashbuckle to NuGet. - Added SimpleAuthentication.Swashbuckle project and documentation files. - Introduced new functionality for authentication support in Swagger, including JWT Bearer, API Key, and Basic Authentication schemes. - Added version.json for version management with NerdBank.GitVersioning.
1 parent b027bb0 commit 42f9978

File tree

17 files changed

+217
-21
lines changed

17 files changed

+217
-21
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish Swashbuckle for Simple Authentication on NuGet
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths: [ 'src/SimpleAuthentication.Swashbuckle/**' ]
7+
workflow_dispatch:
8+
9+
env:
10+
NET_VERSION: '9.x'
11+
PROJECT_NAME: src/SimpleAuthentication.Swashbuckle
12+
PROJECT_FILE: SimpleAuthentication.Swashbuckle.csproj
13+
TAG_NAME: swashbuckle
14+
RELEASE_NAME: SimpleAuthenticationTools.Swashbuckle
15+
16+
jobs:
17+
build:
18+
name: Publish Swashbuckle for Simple Authentication on NuGet
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
26+
27+
- name: Setup .NET SDK ${{ env.NET_VERSION }}
28+
uses: actions/setup-dotnet@v3
29+
with:
30+
dotnet-version: ${{ env.NET_VERSION }}
31+
dotnet-quality: 'ga'
32+
33+
- name: Nerdbank.GitVersioning
34+
uses: dotnet/[email protected]
35+
id: nbgv
36+
with:
37+
path: ${{ env.PROJECT_NAME }}
38+
39+
- name: Package
40+
run: dotnet pack -c Release -o . '${{ env.PROJECT_NAME }}/${{ env.PROJECT_FILE }}'
41+
42+
- name: Publish on NuGet
43+
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
44+
45+
- name: Create release
46+
uses: actions/create-release@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
49+
with:
50+
tag_name: ${{ env.TAG_NAME }}_v${{ steps.nbgv.outputs.NuGetPackageVersion }}
51+
release_name: ${{ env.RELEASE_NAME }} ${{ steps.nbgv.outputs.NuGetPackageVersion }}
52+
draft: false
53+
prerelease: false

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
A library to easily integrate Authentication in ASP.NET Core projects. Currently it supports JWT Bearer, API Key and Basic Authentication in both Controller-based and Minimal API projects.
1010

11+
> [!IMPORTANT]
12+
> **Update from Version 2.x to 3.x**
13+
> Swashbuckle (Swagger) support has been moved out from SimpleAuthentication. If you're using the `AddSimpleAuthentication` extension method with `AddSwaggerGen`, now you need to install the [SimpleAuthentication.Swashbuckle](https://github.com/marcominerva/SimpleAuthentication/tree/master/src/SimpleAuthentication.Swashbuckle) package.
14+
1115
## Installation
1216

1317
The library is available on [NuGet](https://www.nuget.org/packages/SimpleAuthenticationTools). Just search for *SimpleAuthenticationTools* in the **Package Manager GUI** or run the following command in the **.NET CLI**:

SimpleAuthentication.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicAuthenticationSample",
3131
EndProject
3232
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JwtBearerSample", "samples\MinimalApis\JwtBearerSample\JwtBearerSample.csproj", "{14A175D5-1AA7-4B31-809F-BB47014E9B20}"
3333
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleAuthentication.Swashbuckle", "src\SimpleAuthentication.Swashbuckle\SimpleAuthentication.Swashbuckle.csproj", "{2B13BC55-EA62-47F4-9857-968DED3488CA}"
35+
EndProject
3436
Global
3537
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3638
Debug|Any CPU = Debug|Any CPU
@@ -69,6 +71,10 @@ Global
6971
{14A175D5-1AA7-4B31-809F-BB47014E9B20}.Debug|Any CPU.Build.0 = Debug|Any CPU
7072
{14A175D5-1AA7-4B31-809F-BB47014E9B20}.Release|Any CPU.ActiveCfg = Release|Any CPU
7173
{14A175D5-1AA7-4B31-809F-BB47014E9B20}.Release|Any CPU.Build.0 = Release|Any CPU
74+
{2B13BC55-EA62-47F4-9857-968DED3488CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75+
{2B13BC55-EA62-47F4-9857-968DED3488CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
76+
{2B13BC55-EA62-47F4-9857-968DED3488CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
77+
{2B13BC55-EA62-47F4-9857-968DED3488CA}.Release|Any CPU.Build.0 = Release|Any CPU
7278
EndGlobalSection
7379
GlobalSection(SolutionProperties) = preSolution
7480
HideSolutionNode = FALSE

samples/Controllers/ApiKeySample/ApiKeySample.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
1111
</ItemGroup>
1212

1313
<ItemGroup>
14+
<ProjectReference Include="..\..\..\src\SimpleAuthentication.Swashbuckle\SimpleAuthentication.Swashbuckle.csproj" />
1415
<ProjectReference Include="..\..\..\src\SimpleAuthentication\SimpleAuthentication.csproj" />
1516
</ItemGroup>
1617

samples/Controllers/BasicAuthenticationSample/BasicAuthenticationSample.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
1111
</ItemGroup>
1212

1313
<ItemGroup>
14+
<ProjectReference Include="..\..\..\src\SimpleAuthentication.Swashbuckle\SimpleAuthentication.Swashbuckle.csproj" />
1415
<ProjectReference Include="..\..\..\src\SimpleAuthentication\SimpleAuthentication.csproj" />
1516
</ItemGroup>
1617

samples/Controllers/JwtBearerSample/JwtBearerSample.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
11-
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.9.0" />
10+
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.2.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
15+
<ProjectReference Include="..\..\..\src\SimpleAuthentication.Swashbuckle\SimpleAuthentication.Swashbuckle.csproj" />
1516
<ProjectReference Include="..\..\..\src\SimpleAuthentication\SimpleAuthentication.csproj" />
1617
</ItemGroup>
1718

samples/MinimalApis/ApiKeySample/ApiKeySample.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
11-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
15+
<ProjectReference Include="..\..\..\src\SimpleAuthentication.Swashbuckle\SimpleAuthentication.Swashbuckle.csproj" />
1516
<ProjectReference Include="..\..\..\src\SimpleAuthentication\SimpleAuthentication.csproj" />
1617
</ItemGroup>
1718

samples/MinimalApis/BasicAuthenticationSample/BasicAuthenticationSample.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
11-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
15+
<ProjectReference Include="..\..\..\src\SimpleAuthentication.Swashbuckle\SimpleAuthentication.Swashbuckle.csproj" />
1516
<ProjectReference Include="..\..\..\src\SimpleAuthentication\SimpleAuthentication.csproj" />
1617
</ItemGroup>
1718

samples/MinimalApis/JwtBearerSample/JwtBearerSample.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
11-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
15+
<ProjectReference Include="..\..\..\src\SimpleAuthentication.Swashbuckle\SimpleAuthentication.Swashbuckle.csproj" />
1516
<ProjectReference Include="..\..\..\src\SimpleAuthentication\SimpleAuthentication.csproj" />
1617
</ItemGroup>
1718

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<LangVersion>latest</LangVersion>
8+
<RootNamespace>SimpleAuthentication</RootNamespace>
9+
<DocumentationFile>SimpleAuthentication.Swashbuckle.xml</DocumentationFile>
10+
<Authors>Marco Minerva</Authors>
11+
<Company>Marco Minerva</Company>
12+
<Product>Swashbuckle extensions for Simple Authentication for ASP.NET Core</Product>
13+
<Title>Swashbuckle extensions for Simple Authentication for ASP.NET Core</Title>
14+
<Description>A library to easily integrate Authentication in ASP.NET Core projects</Description>
15+
<PackageId>SimpleAuthenticationTools.Swashbuckle</PackageId>
16+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
17+
<PackageProjectUrl>https://github.com/marcominerva/SimpleAuthentication</PackageProjectUrl>
18+
<PackageIcon>Toolbox.png</PackageIcon>
19+
<PackageTags>csharp visualstudio aspnetcore webapi minimal-api authentication jwt jwt-bearer apikey apikey-authentication basic-authentication utilities helpers swashbuckle openapi</PackageTags>
20+
<RepositoryType>git</RepositoryType>
21+
<RepositoryUrl>https://github.com/marcominerva/SimpleAuthentication.git</RepositoryUrl>
22+
<RepositoryBranch>master</RepositoryBranch>
23+
<PackageReadmeFile>README.md</PackageReadmeFile>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<None Remove="SimpleAuthentication.Swashbuckle.xml" />
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<PackageReference Include="SimpleAuthenticationTools.Abstractions" Version="3.0.2" />
36+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="7.2.0" />
37+
</ItemGroup>
38+
39+
<ItemGroup>
40+
<None Include="..\..\Toolbox.png">
41+
<Pack>True</Pack>
42+
<PackagePath></PackagePath>
43+
</None>
44+
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
45+
</ItemGroup>
46+
47+
</Project>

0 commit comments

Comments
 (0)