nats-io / nats-server

High-Performance server for NATS.io, the cloud and edge native messaging system.
https://nats.io
Apache License 2.0
16.03k stars 1.41k forks source link

canary: changed uses of jwt.TagList.Contains() to jwt.TagList.ContainsEqualFold(), this relaxes matching to be case-insensitive #5950

Closed aricart closed 1 month ago

aricart commented 1 month ago

This changes uses of jwt.Contains() to jwt.ContainsEqualsFold(), allowing case-insensitive matching in the jwt.TagList Signed-off-by: Your Name alberto@synadia.com

aricart commented 1 month ago

This requires the pointed-at branch of JWT, which we need to merge before updating the go.mod to a released version.

aricart commented 1 month ago

Added an utility to jwt.TagList that can return value portion of a tag - where the tag format is tagname:tagvalue, but at the very least tag name has a single character, and tag value is not empty. In those cases, tagname is case-insensitive, the tag value utility returns the value portion of the entry (could be multiple) with the tagname: stripped. This simplifies the code in the server to simply extracting the tag names.