From 5ab84f992283f8f4078b0612e3df7a6109e11ee3 Mon Sep 17 00:00:00 2001 From: Alan Yang Date: Fri, 10 May 2024 14:13:02 -0700 Subject: [PATCH] Add identity model validators --- Directory.Packages.props | 8 +++----- libs/server/Auth/GarnetAadAuthenticator.cs | 2 ++ libs/server/Garnet.server.csproj | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 64ddefbc26..ae06809146 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,9 +1,7 @@ - true - @@ -19,10 +17,10 @@ - + + - + - \ No newline at end of file diff --git a/libs/server/Auth/GarnetAadAuthenticator.cs b/libs/server/Auth/GarnetAadAuthenticator.cs index 0f26601520..6746bf39b8 100644 --- a/libs/server/Auth/GarnetAadAuthenticator.cs +++ b/libs/server/Auth/GarnetAadAuthenticator.cs @@ -10,6 +10,7 @@ using Garnet.server.Auth.Aad; using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Tokens; +using Microsoft.IdentityModel.Validators; namespace Garnet.server.Auth { @@ -62,6 +63,7 @@ public bool Authenticate(ReadOnlySpan password, ReadOnlySpan usernam ValidAudiences = _audiences, IssuerSigningKeys = _signingTokenProvider.SigningTokens }; + parameters.EnableAadSigningKeyIssuerValidation(); var identity = _tokenHandler.ValidateToken(Encoding.UTF8.GetString(password), parameters, out var token); diff --git a/libs/server/Garnet.server.csproj b/libs/server/Garnet.server.csproj index 2950ad32b4..2bbe3b854c 100644 --- a/libs/server/Garnet.server.csproj +++ b/libs/server/Garnet.server.csproj @@ -19,6 +19,7 @@ +