Add --whitelist-prefix option to allowlist a path prefix
The existing --whitelist option only allows a fixed string; this one
does a prefix match instead.
Also extract allowedByWhiteList for unit testability, and add tests.
This new setting allows you to add a list of comma delimited groups to
the allow list.
Previous to this change auth proxy was able to authenticate admins OR
all users on the site, without any fidelity of allowing specific groups.
This also refactors the tests somewhat and adds a bunch of integration
tests to ensure the new setting is properly respected.
Co-authored-by: Saj Goonatilleke <saj@discourse.org>
There are two distinct configuration layers in this program: the 'raw'
types provided by the flag library, and the 'validated' types we present
to the rest of the program. This commit makes that distinction clear,
and internalises some pointer muck from the flag lib.