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
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x
cache: true
cache-dependency-path: '**/packages.lock.json'

Expand All @@ -37,7 +37,7 @@ jobs:

- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x
cache: true
cache-dependency-path: '**/packages.lock.json'

Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:

- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x
cache: true
cache-dependency-path: '**/packages.lock.json'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x
cache: true
cache-dependency-path: '**/packages.lock.json'

Expand All @@ -38,7 +38,7 @@ jobs:

- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x
cache: true
cache-dependency-path: '**/packages.lock.json'

Expand Down
36 changes: 36 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "swagger-https",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}\\playground\\OpenApi.Web\\OpenApi.Web.csproj",
"launchConfigurationId": "TargetFramework=;swagger-https"
},
{
"name": "swagger-http",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}\\playground\\OpenApi.Web\\OpenApi.Web.csproj",
"launchConfigurationId": "TargetFramework=;swagger-http"
},
{
"name": "scalar-https",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}\\playground\\OpenApi.Web\\OpenApi.Web.csproj",
"launchConfigurationId": "TargetFramework=;scalar-https"
},
{
"name": "scalar-http",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}\\playground\\OpenApi.Web\\OpenApi.Web.csproj",
"launchConfigurationId": "TargetFramework=;scalar-http"
}
]
}
4 changes: 4 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"sdk": {
"version": "11.0.100-rc",
"rollForward": "latestMinor"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
Expand Down
4 changes: 2 additions & 2 deletions playground/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="Scalar.AspNetCore" Version="2.18.3" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.3.1" />
<PackageVersion Include="Scalar.AspNetCore" Version="2.20.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="11.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// </copyright>
// -----------------------------------------------------------------------

namespace Altemiq.OpenApi.Web.Controllers;
namespace OpenApi.Web.Controllers;

using Microsoft.AspNetCore.Mvc;

Expand Down
2 changes: 1 addition & 1 deletion playground/OpenApi.Web/OpenApi.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<InterceptorsNamespaces>$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated</InterceptorsNamespaces>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions playground/OpenApi.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
builder.Services.AddOpenApi(options =>
{
_ = options.SetInfo("API");
var results = options.AddOAuth2(
var (_, name) = options.AddOAuth2(
new()
{
Password = new()
Expand All @@ -32,7 +32,7 @@
},
},
});
_ = options.WithAuthorizeCheck(results.Name);
_ = options.WithAuthorizeCheck(name);
_ = options.UsePathBase(PathBase);
});

Expand All @@ -48,7 +48,7 @@
app.UsePathBase(PathBase);

_ = app
.MapGet($"minimal/{nameof(Altemiq.OpenApi.Web.WeatherForecast)}", Altemiq.OpenApi.Web.WeatherForecast.Get)
.MapGet($"minimal/{nameof(OpenApi.Web.WeatherForecast)}", OpenApi.Web.WeatherForecast.Get)
.RequireAuthorization()
.WithScopes("first", "second");

Expand Down
4 changes: 2 additions & 2 deletions playground/OpenApi.Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "scalar",
"applicationUrl": "http://localhost:5164",
"applicationUrl": "http://localhost:5165",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand All @@ -36,7 +36,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "scalar",
"applicationUrl": "https://localhost:7072;http://localhost:5164",
"applicationUrl": "https://localhost:7073;http://localhost:5165",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
2 changes: 1 addition & 1 deletion playground/OpenApi.Web/WeatherForecast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// </copyright>
// -----------------------------------------------------------------------

namespace Altemiq.OpenApi.Web;
namespace OpenApi.Web;

/// <summary>
/// The weather forecast.
Expand Down
30 changes: 15 additions & 15 deletions playground/OpenApi.Web/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"version": 2,
"dependencies": {
"net10.0": {
"net11.0": {
"Scalar.AspNetCore": {
"type": "Direct",
"requested": "[2.18.3, )",
"resolved": "2.18.3",
"contentHash": "6KXPOkCNnoZTXBl8GVNxq/zpS9UdGnz1a23EWy3CEiwYbZKQ5gi2APZ5mBruXcdXIr+ZXSZYiwX81UagjKFxeg=="
"requested": "[2.20.0, )",
"resolved": "2.20.0",
"contentHash": "BQ7Pzt3BkM+U9qh63APQSgELutm7acoOfCBIjQlO5tHioi7+J9LZ0z2BK5fUBVazO4aWblghz1C4XwzqFhexxw=="
},
"Swashbuckle.AspNetCore.SwaggerUI": {
"type": "Direct",
"requested": "[10.3.1, )",
"resolved": "10.3.1",
"contentHash": "kXuMIVJBDD6qMwG78VUrKy4x5Ke98HU0Q023Sf2iSBO/x45c5BuByYPAExIs9UeVsjdGGgvLWU5jK8l6MO2Z0Q=="
"requested": "[11.0.0, )",
"resolved": "11.0.0",
"contentHash": "WvmQe52t2Gei4j1zBPV6euNqdlOlE300p4ce1GTd7hJLV8sLEyIuwJ7IGcK/WK87G2OpEoIb3k2MxMhdQahWrA=="
},
"Microsoft.AspNetCore.OpenApi": {
"type": "Transitive",
"resolved": "10.0.14",
"contentHash": "3M6yO4nv8fmvM/1X7DqQcMxw/ptNLBcUzZt19SBEyfZF32gqZuwoPNnYd1xlDnFvQOGOkZDncf7p9E24blcTkQ==",
"resolved": "11.0.0",
"contentHash": "B5nHzRjpd5BhKN1ijqc2X4QVuQCCbQAWL/q3wpJgUBZou60IT0wgi1eiU3fF/DAj21RgBHXYAVNCV/AJ9y1GKw==",
"dependencies": {
"Microsoft.OpenApi": "[2.12.2, 3.0.0)"
"Microsoft.OpenApi": "[3.11.0, 4.0.0)"
}
},
"Microsoft.OpenApi": {
"type": "Transitive",
"resolved": "2.12.2",
"contentHash": "ZkT7qiJe0Kj0+DTZOZo+xrDy1kNmdsWFQVPIQLNx9ZJ0T9cB2LG7r+Bi60so8/+yg1nkS7QCPadrzsTG4VPKrA=="
"resolved": "3.11.0",
"contentHash": "kvQz+mL/fnDw2VaE8zMyQhbMv7FmOYUydIhCVNKxQdrLu9XiMT/07DHwJ5YkRO2uzcxTFvMAKFKKywxoyLKHcA=="
},
"aspnetcore.openapi": {
"type": "Project",
"dependencies": {
"Microsoft.AspNetCore.OpenApi": "[10.0.14, )",
"OpenApi": "[2.12.2, )"
"Microsoft.AspNetCore.OpenApi": "[11.0.0, )",
"OpenApi": "[3.11.0, )"
}
},
"openapi": {
"type": "Project",
"dependencies": {
"Microsoft.OpenApi": "[2.12.2, )"
"Microsoft.OpenApi": "[3.11.0, 4.0.0)"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/AspNetCore.OpenApi/AspNetCore.OpenApi.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<RootNamespace>Microsoft.AspNetCore</RootNamespace>
<VersionPrefix Condition=" '$(VersionPrefix)' == '' ">$(VerMicrosoft_AspNetCore_OpenApi)</VersionPrefix>

Expand All @@ -24,7 +24,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" VersionOverride="$(VerMicrosoft_AspNetCore_OpenApi)" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -61,7 +61,7 @@
-->
<XmlPoke XmlInputPath="$(ResolvedNuspecFile)"
Query="//*[local-name()='dependency' and @id='Altemiq.OpenApi']/@version"
Value="[$(VerMicrosoft_OpenApi),$(VerMicrosoft_OpenApi_Max))" />
Value="$(VerMicrosoft_OpenApi_Range)" />

<Message Importance="high" Text="[Pack Intercept] Version replacement for Altemiq.OpenApi complete. Resuming pack lifecycle." />

Expand Down
18 changes: 7 additions & 11 deletions src/AspNetCore.OpenApi/OpenApi/OpenApiOptionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@
// </copyright>
// -----------------------------------------------------------------------

#pragma warning disable SA1200
using OpenApiSecuritySchemeAndName = (Microsoft.OpenApi.OpenApiSecurityScheme Scheme, string Name);
#pragma warning restore SA1200

namespace Microsoft.AspNetCore.OpenApi;

using Microsoft.OpenApi;
using Microsoft.OpenApi.Models;

#pragma warning disable SA1101, RCS1263
using OpenApiSecuritySchemeAndName = (Microsoft.OpenApi.OpenApiSecurityScheme Scheme, string Name);

/// <summary>
/// The <see cref="OpenApiOptions"/> extensions.
/// </summary>
public static class OpenApiOptionsExtensions
{
private const string UnauthorizedValue = "User is not authorised";
private const string ForbiddenValue = "User access to resource is forbidden";

private static readonly string UnauthorizedKey = Http.StatusCodes.Status401Unauthorized.ToString(System.Globalization.CultureInfo.InvariantCulture);
private static readonly string ForbiddenKey = Http.StatusCodes.Status403Forbidden.ToString(System.Globalization.CultureInfo.InvariantCulture);

/// <content>
/// The <see cref="OpenApiOptions"/> extensions.
/// </content>
Expand Down Expand Up @@ -310,12 +312,6 @@ private OpenApiSecurityScheme AddSecurityScheme(SecuritySchemeType type, string
}
}

private const string UnauthorizedValue = "User is not authorised";
private const string ForbiddenValue = "User access to resource is forbidden";

private static readonly string UnauthorizedKey = Http.StatusCodes.Status401Unauthorized.ToString(System.Globalization.CultureInfo.InvariantCulture);
private static readonly string ForbiddenKey = Http.StatusCodes.Status403Forbidden.ToString(System.Globalization.CultureInfo.InvariantCulture);

private static OpenApiSecurityScheme GetSecurityScheme(SecuritySchemeType type, Action<OpenApiSecurityScheme>? configure = default)
{
var securityScheme = new OpenApiSecurityScheme
Expand Down
Loading
Loading