From 847058c56c40d0a5bd56247494ded049f58315a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Banaszewski?= Date: Mon, 13 Oct 2025 14:04:08 +0200 Subject: [PATCH] fix: set default values for `RevokeURL` property in external auth configs (#20270) This PR adds logic that sets default values for `RevokeURL` in external auth configs. --- coderd/externalauth/externalauth.go | 3 +++ coderd/externalauth/externalauth_internal_test.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/coderd/externalauth/externalauth.go b/coderd/externalauth/externalauth.go index 41797706ee..f1ab1cd038 100644 --- a/coderd/externalauth/externalauth.go +++ b/coderd/externalauth/externalauth.go @@ -814,6 +814,9 @@ func copyDefaultSettings(config *codersdk.ExternalAuthConfig, defaults codersdk. if config.ValidateURL == "" { config.ValidateURL = defaults.ValidateURL } + if config.RevokeURL == "" { + config.RevokeURL = defaults.RevokeURL + } if config.AppInstallURL == "" { config.AppInstallURL = defaults.AppInstallURL } diff --git a/coderd/externalauth/externalauth_internal_test.go b/coderd/externalauth/externalauth_internal_test.go index f50593c019..65bb5ee7de 100644 --- a/coderd/externalauth/externalauth_internal_test.go +++ b/coderd/externalauth/externalauth_internal_test.go @@ -19,6 +19,7 @@ func TestGitlabDefaults(t *testing.T) { AuthURL: "https://gitlab.com/oauth/authorize", TokenURL: "https://gitlab.com/oauth/token", ValidateURL: "https://gitlab.com/oauth/token/info", + RevokeURL: "https://gitlab.com/oauth/revoke", DisplayName: "GitLab", DisplayIcon: "/icon/gitlab.svg", Regex: `^(https?://)?gitlab\.com(/.*)?$`, @@ -79,6 +80,7 @@ func TestGitlabDefaults(t *testing.T) { config.AuthURL = "https://gitlab.company.org/oauth/authorize?foo=bar" config.ValidateURL = "https://gitlab.company.org/oauth/token/info" config.TokenURL = "https://gitlab.company.org/oauth/token" + config.RevokeURL = "https://gitlab.company.org/oauth/revoke" config.Regex = `^(https?://)?gitlab\.company\.org(/.*)?$` }, }, @@ -90,6 +92,7 @@ func TestGitlabDefaults(t *testing.T) { AuthURL: "https://auth.com/auth", ValidateURL: "https://validate.com/validate", TokenURL: "https://token.com/token", + RevokeURL: "https://token.com/revoke", Regex: "random", }, expected: cloud, @@ -97,6 +100,7 @@ func TestGitlabDefaults(t *testing.T) { config.AuthURL = "https://auth.com/auth" config.ValidateURL = "https://validate.com/validate" config.TokenURL = "https://token.com/token" + config.RevokeURL = "https://token.com/revoke" config.Regex = `random` }, },