Skip to content

Commit 51685ab

Browse files
author
TANUJ SOOD
committed
Target .NET 10 for Sidecar project
1 parent 94b1860 commit 51685ab

6 files changed

Lines changed: 24 additions & 16 deletions

File tree

src/Microsoft.Identity.Web.Sidecar/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project>
22
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
33
<PropertyGroup>
4-
<TargetFrameworks>net9.0</TargetFrameworks>
4+
<TargetFrameworks>net10.0</TargetFrameworks>
55
</PropertyGroup>
66
<PropertyGroup>
7-
<SidecarAspDependencyVersion>9.0.9</SidecarAspDependencyVersion>
7+
<SidecarAspDependencyVersion>10.0.0</SidecarAspDependencyVersion>
88
<MicrosoftAspNetCoreOpenApiVersion>$(SidecarAspDependencyVersion)</MicrosoftAspNetCoreOpenApiVersion>
99
<MicrosoftExtensionsApiDescriptionServerVersion>$(SidecarAspDependencyVersion)</MicrosoftExtensionsApiDescriptionServerVersion>
1010
<MicrosoftVisualStudioAzureContainersToolsTargetsVersion>1.22.1</MicrosoftVisualStudioAzureContainersToolsTargetsVersion>

src/Microsoft.Identity.Web.Sidecar/DockerFile.NanoServer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This docker file is used for building the container image from a published set of files.
22
# This is used when for workflows where the files need to be signed in CI/CD.
33

4-
FROM mcr.microsoft.com/dotnet/aspnet:9.0-nanoserver-ltsc2022 AS base
4+
FROM mcr.microsoft.com/dotnet/aspnet:10.0-nanoserver-ltsc2022 AS base
55
WORKDIR /app
66

77
COPY app/publish .

src/Microsoft.Identity.Web.Sidecar/Dockerfile.AzureLinux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This docker file is used for building the container image from a published set of files.
22
# This is used when for workflows where the files need to be signed in CI/CD.
33

4-
FROM mcr.microsoft.com/dotnet/aspnet:9.0-azurelinux3.0-distroless AS base
4+
FROM mcr.microsoft.com/dotnet/aspnet:10.0-azurelinux3.0-distroless AS base
55
WORKDIR /app
66

77
COPY app/publish .

src/Microsoft.Identity.Web.Sidecar/OpenApiDescriptions.cs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
using Microsoft.OpenApi.Models;
4+
using Microsoft.OpenApi;
55

66
namespace Microsoft.Identity.Web.Sidecar;
77

88
internal static class OpenApiDescriptions
99
{
1010
internal static void AddOptionsOverrideParameters(OpenApiOperation op)
1111
{
12+
op.Parameters ??= [];
13+
1214
// Scopes (repeatable)
1315
op.Parameters.Add(new OpenApiParameter
1416
{
1517
Name = "optionsOverride.Scopes",
1618
In = ParameterLocation.Query,
1719
Description = "Repeatable. Each occurrence adds one scope. Example: optionsOverride.Scopes=User.Read",
1820
Required = false,
19-
Schema = new OpenApiSchema { Type = "string" },
21+
Schema = new OpenApiSchema { Type = JsonSchemaType.String },
2022
Explode = true,
2123
Style = ParameterStyle.Form
2224
});
2325

2426
// Core boolean / simple toggles
25-
AddSimple(op, "optionsOverride.RequestAppToken", "boolean", "true = acquire an app (client credentials) token instead of user token.");
27+
AddSimple(op, "optionsOverride.RequestAppToken", JsonSchemaType.Boolean, "true = acquire an app (client credentials) token instead of user token.");
2628

2729
// Base request shaping
2830
op.Parameters.Add(new OpenApiParameter
@@ -32,16 +34,16 @@ internal static void AddOptionsOverrideParameters(OpenApiOperation op)
3234
Description = "Ignored. The downstream BaseUrl is fixed by host configuration and cannot be overridden via optionsOverride.",
3335
Required = false,
3436
Deprecated = true,
35-
Schema = new OpenApiSchema { Type = "string" }
37+
Schema = new OpenApiSchema { Type = JsonSchemaType.String }
3638
});
37-
AddSimple(op, "optionsOverride.RelativePath", "string", "Override relative path appended to BaseUrl.");
38-
AddSimple(op, "optionsOverride.HttpMethod", "string", "Override HTTP method (GET, POST, PATCH, etc.).");
39-
AddSimple(op, "optionsOverride.AcceptHeader", "string", "Sets Accept header (e.g. application/json).");
40-
AddSimple(op, "optionsOverride.ContentType", "string", "Sets Content-Type used for serialized body (if body provided).");
39+
AddSimple(op, "optionsOverride.RelativePath", JsonSchemaType.String, "Override relative path appended to BaseUrl.");
40+
AddSimple(op, "optionsOverride.HttpMethod", JsonSchemaType.String, "Override HTTP method (GET, POST, PATCH, etc.).");
41+
AddSimple(op, "optionsOverride.AcceptHeader", JsonSchemaType.String, "Sets Accept header (e.g. application/json).");
42+
AddSimple(op, "optionsOverride.ContentType", JsonSchemaType.String, "Sets Content-Type used for serialized body (if body provided).");
4143

4244
// AcquireTokenOptions.* (token acquisition tuning)
4345
AddAcquireTokenOption(op, "Tenant", "Override tenant (GUID or 'common').");
44-
AddAcquireTokenOption(op, "ForceRefresh", "boolean", "true = bypass token cache.");
46+
AddAcquireTokenOption(op, "ForceRefresh", "true = bypass token cache.", JsonSchemaType.Boolean);
4547
AddAcquireTokenOption(op, "Claims", "JSON claims challenge or extra claims.");
4648
AddAcquireTokenOption(op, "CorrelationId", "GUID correlation id for token acquisition.");
4749
AddAcquireTokenOption(op, "LongRunningWebApiSessionKey", "Session key for long running OBO flows.");
@@ -52,8 +54,9 @@ internal static void AddOptionsOverrideParameters(OpenApiOperation op)
5254
AddAcquireTokenOption(op, "ManagedIdentity.UserAssignedClientId", "Managed Identity client id (user-assigned).");
5355
}
5456

55-
private static void AddSimple(OpenApiOperation op, string name, string type, string desc)
57+
private static void AddSimple(OpenApiOperation op, string name, JsonSchemaType type, string desc)
5658
{
59+
op.Parameters ??= [];
5760
op.Parameters.Add(new OpenApiParameter
5861
{
5962
Name = name,
@@ -64,8 +67,9 @@ private static void AddSimple(OpenApiOperation op, string name, string type, str
6467
});
6568
}
6669

67-
private static void AddAcquireTokenOption(OpenApiOperation op, string name, string description, string type = "string")
70+
private static void AddAcquireTokenOption(OpenApiOperation op, string name, string description, JsonSchemaType type = JsonSchemaType.String)
6871
{
72+
op.Parameters ??= [];
6973
op.Parameters.Add(new OpenApiParameter
7074
{
7175
Name = $"optionsOverride.AcquireTokenOptions.{name}",

src/Microsoft.Identity.Web.Sidecar/OptionsOverrideSchemaTransformer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License.
33

44
using Microsoft.AspNetCore.OpenApi;
5-
using Microsoft.OpenApi.Models;
5+
using Microsoft.OpenApi;
66

77
namespace Microsoft.Identity.Web.Sidecar
88
{

src/Microsoft.Identity.Web.Sidecar/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ public class Program
1414
{
1515

1616
// Adding these the time to merge Andy's PR. Then will do the work to remove reflexion usage
17+
#pragma warning disable IL2123 // RequiresUnreferencedCodeAttribute cannot be placed on entry point
18+
#pragma warning disable IL3057 // RequiresDynamicCodeAttribute cannot be placed on entry point
1719
[RequiresUnreferencedCode("EnableTokenAcquisitionToCallDownstreamApis uses reflection")]
1820
[RequiresDynamicCode("EnableTokenAcquisitionToCallDownstreamApis uses reflection")]
1921
public static void Main(string[] args)
22+
#pragma warning restore IL3057
23+
#pragma warning restore IL2123
2024
{
2125
var builder = WebApplication.CreateSlimBuilder(args);
2226

0 commit comments

Comments
 (0)