IsraelHikingMap / Site

Israel Hiking Map has maps, route planning, and travel information for Israel. This repository holds the files needed for running the Israel Hiking Map site and apps.
https://israelhiking.osm.org.il/
Other
76 stars 31 forks source link

Consider using async pattern for TokenValidation #1968

Closed HarelM closed 4 days ago

HarelM commented 3 months ago

What is the problem this feature will solve?

Infrastructure "tech debt"

What is the feature you are proposing to solve the problem?

Using the new syntax and infrastructure as described here: https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/468

What alternatives have you considered or tried?

Keep the code as is.

Additional information

I'm not sure it's worth the trouble. Last time I touched this part of the code I caused a deadlock for users trying to login, so this code is risky. Having said that, it might be the "right way" to write this code, I'm not sure...

HarelM commented 2 months ago

@alphaleonis I saw that you added a thumbs up, do you know by any chance how to use this token validator? I tried gimini an chatGPT and failed. The linked PR is simply to close this since it's not documented enough as I wrote in the linked issue in azure.

alphaleonis commented 2 months ago

@HarelM Oh, sorry, I don't think I ever intended to comment on this repo. I was probably led here by a link from the issue on the Azure AD repo without realizing I came to a new repository. It is not hard finding plenty of examples on the interwebs on how to use the JwtSecurityTokenHandler to validate tokens, the problem is doing this properly async due to the limitations mentioned in the linked issue.

HarelM commented 2 months ago

I couldn't figure out how to use JsonWebTokenHandler which should've replaced JwtSecurityTokenHandler no matter how hard I tried to search for examples on Google... I eventually have up. Currently, my code run the validation async and also uses an async cache. So it's working I guess...