Skip to content

Commit e5efeaa

Browse files
authored
test Jwt bearer options length (#2464)
1 parent 1c65d4a commit e5efeaa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/Microsoft.Identity.Web.Test/WebAppExtensionsTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Threading.Tasks;
1010
using Microsoft.AspNetCore.Authentication;
1111
using Microsoft.AspNetCore.Authentication.Cookies;
12+
using Microsoft.AspNetCore.Authentication.JwtBearer;
1213
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
1314
using Microsoft.AspNetCore.Components.Server.Circuits;
1415
using Microsoft.AspNetCore.Http;
@@ -33,6 +34,7 @@
3334
using NSubstitute;
3435
using NSubstitute.Extensions;
3536
using Xunit;
37+
using TokenValidatedContext = Microsoft.AspNetCore.Authentication.OpenIdConnect.TokenValidatedContext;
3638

3739
namespace Microsoft.Identity.Web.Test
3840
{
@@ -886,5 +888,17 @@ public void PreventChangesInOpenIdConnectOptionsToBeOverlooked()
886888
//System.IO.File.WriteAllLines(@"C:\temp\net8.txt", typeof(OpenIdConnectOptions).GetProperties().Select(p => p.Name));
887889
Assert.Equal(expectedNumberOfProperties, numberOfProperties);
888890
}
891+
892+
[Fact]
893+
public void PreventChangesInJwtBearerOptionsToBeOverlooked()
894+
{
895+
int numProps = typeof(JwtBearerOptions).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).Length;
896+
#if NET8_0_OR_GREATER
897+
int expectedNumberOfProperties = 32;
898+
#else
899+
int expectedNumberOfProperties = 29;
900+
#endif
901+
Assert.Equal(expectedNumberOfProperties, numProps);
902+
}
889903
}
890904
}

0 commit comments

Comments
 (0)