alexhiggins732 / IdentityServer8

DotNet 8, Identity, OpenID Connect and OAuth 2.0 Framework for ASP.NET Core Identity Server 8
Apache License 2.0
53 stars 25 forks source link

Breaking change in Microsoft.IdentityModel - exception throw when calling IsNullOrEmpty() #40

Open peterharding93 opened 3 months ago

peterharding93 commented 3 months ago

A breaking change was made in Microsoft.IdentityModel 8.0.0 (one of the preview releases I think) which makes the extension method IsNullOrEmpty() private. See https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/2651

It seems that the nuget package IdentityServer8 version 8.0.4 tries to call this method. This causes a run time exception.

I specifically hit this bug inside DefaultKeyMaterialService.GetSigningCredentialsAsync(), but there are a few other locations that seem to call this.

I made a workaround by explicit checking for null && !Any(). A quick search for all calls to IsNullOrEmpty should show all the locations where this code needs to be fixed.

More Information: this change seemed to have occurred when updating Microsoft.IdentityModel.Tokens from 7.x to 8.1; that is from 7.7.1 to any of the 8.0.0 libraries.