diff --git a/src/Dockerfile b/src/Dockerfile index b059d3e..553d7f4 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build -FROM mcr.microsoft.com/dotnet/sdk:6.0 as source +FROM mcr.microsoft.com/dotnet/sdk:8.0 as source ARG target="Release" RUN apt-get update && apt-get install unzip -y @@ -18,7 +18,7 @@ RUN dotnet publish -c $target -o obj/docker/publish RUN cp -r /src/obj/docker/publish /OpenIdConnectServerMock # Stage 2: Release -FROM mcr.microsoft.com/dotnet/aspnet:6.0 as release +FROM mcr.microsoft.com/dotnet/aspnet:8.0 as release ARG target="Release" RUN apt-get update && apt-get install curl -y && rm -rf /var/lib/apt/lists/* diff --git a/src/Helpers/OptionsHelper.cs b/src/Helpers/OptionsHelper.cs index 3c59eb2..e92f8d0 100644 --- a/src/Helpers/OptionsHelper.cs +++ b/src/Helpers/OptionsHelper.cs @@ -11,9 +11,9 @@ public static void ConfigureOptions(string optionsStr) var targetFields = typeof(T).GetFields(); var jValueValueProp = typeof(JValue).GetProperty(nameof(JValue.Value)); Array.ForEach(targetFields, k => { - if (options.ContainsKey(k.Name)) { + if (options != null && options.ContainsKey(k.Name)) { var fieldJValue = options[k.Name] as JValue; - var fieldValue = jValueValueProp.GetValue(fieldJValue); + var fieldValue = jValueValueProp?.GetValue(fieldJValue); k.SetValue(null, fieldValue); } }); diff --git a/src/Middlewares/BasePathMiddleware.cs b/src/Middlewares/BasePathMiddleware.cs index 79eb352..0abeffc 100644 --- a/src/Middlewares/BasePathMiddleware.cs +++ b/src/Middlewares/BasePathMiddleware.cs @@ -20,7 +20,7 @@ public async Task Invoke(HttpContext context) { var basePath = Config.GetAspNetServicesOptions().BasePath; var request = context.Request; - if(request.Path.Value.Length > basePath.Length) + if(request.Path.Value?.Length > basePath.Length) { request.Path = request.Path.Value.Substring(basePath.Length); context.SetIdentityServerBasePath(basePath); diff --git a/src/OpenIdConnectServerMock.csproj b/src/OpenIdConnectServerMock.csproj index 4b5c2fd..c07da1a 100644 --- a/src/OpenIdConnectServerMock.csproj +++ b/src/OpenIdConnectServerMock.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable true @@ -26,11 +26,11 @@ - - - - - + + + + + diff --git a/src/Program.cs b/src/Program.cs index 1f20854..640acd8 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,5 +1,4 @@ -using Duende.IdentityServer.Hosting; -using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.FileProviders; using OpenIdConnectServer; using OpenIdConnectServer.Helpers; using OpenIdConnectServer.JsonConverters; @@ -36,7 +35,7 @@ }); builder.Services - .AddIdentityServer(options => + .AddIdentityServerBuilder(options => { var configuredOptions = Config.GetServerOptions(); MergeHelper.Merge(configuredOptions, options);