Skip to content

Commit 663a3ba

Browse files
committed
fix: block creating oidc users when oidc has not been configured
1 parent bf4b7ab commit 663a3ba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

coderd/users.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,19 @@ func (api *API) postUser(rw http.ResponseWriter, r *http.Request) {
465465
loginType = database.LoginTypePassword
466466
case codersdk.LoginTypeOIDC:
467467
loginType = database.LoginTypeOIDC
468+
if api.OIDCConfig == nil {
469+
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
470+
Message: "You must configure OIDC before creating OIDC users.",
471+
})
472+
return
473+
}
468474
case codersdk.LoginTypeGithub:
469475
loginType = database.LoginTypeGithub
470476
default:
471477
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
472478
Message: fmt.Sprintf("Unsupported login type %q for manually creating new users.", req.UserLoginType),
473479
})
480+
return
474481
}
475482

476483
user, _, err := api.CreateUser(ctx, api.Database, CreateUserRequest{

0 commit comments

Comments
 (0)
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