From 6585dc217f1ed3b1cd9c018ff7c10b0782af4293 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Wed, 31 Jul 2024 12:12:58 +0000 Subject: [PATCH] fix: block creating oidc users when oidc has not been configured --- coderd/users.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/coderd/users.go b/coderd/users.go index 565aeca1cb2a8..bfa81f86624e4 100644 --- a/coderd/users.go +++ b/coderd/users.go @@ -464,6 +464,12 @@ func (api *API) postUser(rw http.ResponseWriter, r *http.Request) { } loginType = database.LoginTypePassword case codersdk.LoginTypeOIDC: + if api.OIDCConfig == nil { + httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ + Message: "You must configure OIDC before creating OIDC users.", + }) + return + } loginType = database.LoginTypeOIDC case codersdk.LoginTypeGithub: loginType = database.LoginTypeGithub @@ -471,6 +477,7 @@ func (api *API) postUser(rw http.ResponseWriter, r *http.Request) { httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ Message: fmt.Sprintf("Unsupported login type %q for manually creating new users.", req.UserLoginType), }) + return } user, _, err := api.CreateUser(ctx, api.Database, CreateUserRequest{ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy