From ce7fb2f7584937ba605ed77bd3bd6b0ffa2c6c5c Mon Sep 17 00:00:00 2001 From: Logan Saso Date: Sun, 24 Dec 2023 00:07:05 -0800 Subject: [PATCH] Updates with some messaging on new vs old username formats --- CHANGELOG.md | 2 +- config/config.yml_example_discord | 8 +++++--- pkg/structs/structs.go | 6 ++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d008fc4..95d8e4ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Coming soon! Please document any work in progress here as part of your PR. It will be moved to the next tag when released. -* Implement a Discord provider that uses `id` as the username to match against in the `whiteList` config +* Implement a Discord provider that uses Discord's updated username https://support.discord.com/hc/en-us/articles/12620128861463 * Upgrade golang to `v1.19` from `v1.18` ## v0.39.0 diff --git a/config/config.yml_example_discord b/config/config.yml_example_discord index bcc3b8d9..1d4fd3cc 100644 --- a/config/config.yml_example_discord +++ b/config/config.yml_example_discord @@ -1,13 +1,15 @@ # Vouch Proxy configuration -# bare minimum to get Vouch Proxy running with OpenID Connect (such as okta) +# bare minimum to get Vouch Proxy running with Discord as an OpenID Provider vouch: domains: - yourdomain.com - # whiteList is a list of user ids that will allow a login if allowAllUsers is false + # whiteList is a list of usernames that will allow a login if allowAllUsers is false whiteList: - - 12341234123412345 + - loganintech + # If the user still hasn't chosen a new username, the old username#discrimnator format will work + - LoganInTech#1203 cookie: # allow the jwt/cookie to be set into http://yourdomain.com (defaults to true, requiring https://yourdomain.com) diff --git a/pkg/structs/structs.go b/pkg/structs/structs.go index 5db89df1..e709237b 100644 --- a/pkg/structs/structs.go +++ b/pkg/structs/structs.go @@ -255,8 +255,10 @@ type DiscordUser struct { PreparedUsername string } -// PrepareUserData copies the Username and Discriminator in the format that Discord guarantees to be unique -// https://support.discord.com/hc/en-us/articles/4407571667351-Law-Enforcement-Guidelines Subheading "How to find usernames and discriminators" +// PrepareUserData copies the Username to PreparedUsername. If the Discriminator is present that is +// appended to the Username in the format "Username#Discriminator" to match the old format of Discord usernames +// Previous format which is being phased out: https://support.discord.com/hc/en-us/articles/4407571667351-Law-Enforcement-Guidelines Subheading "How to find usernames and discriminators" +// Details about the new username requirements: https://support.discord.com/hc/en-us/articles/12620128861463 func (u *DiscordUser) PrepareUserData() { u.PreparedUsername = u.Username if u.Discriminator != "0" {