From d9d679930df5c0a6fbc728a298626cde24534155 Mon Sep 17 00:00:00 2001 From: Mathias Gebbe Date: Wed, 25 Feb 2026 21:54:56 +0100 Subject: [PATCH] revert(api): remove reserved connector ID prefix check The __client_credentials connector ID is no longer used since the client_credentials grant now uses an empty connector ID. Remove the __ prefix validation from CreateConnector and its associated test. Signed-off-by: Mathias Gebbe --- server/api.go | 5 ----- server/api_test.go | 15 --------------- 2 files changed, 20 deletions(-) diff --git a/server/api.go b/server/api.go index e629ac01..724c4807 100644 --- a/server/api.go +++ b/server/api.go @@ -7,7 +7,6 @@ import ( "fmt" "log/slog" "strconv" - "strings" "golang.org/x/crypto/bcrypt" @@ -440,10 +439,6 @@ func (d dexAPI) CreateConnector(ctx context.Context, req *api.CreateConnectorReq return nil, errors.New("no id supplied") } - if strings.HasPrefix(req.Connector.Id, "__") { - return nil, fmt.Errorf("connector ID %q is invalid: IDs starting with \"__\" are reserved for internal use", req.Connector.Id) - } - if req.Connector.Type == "" { return nil, errors.New("no type supplied") } diff --git a/server/api_test.go b/server/api_test.go index 08ba0831..5ddbcc4a 100644 --- a/server/api_test.go +++ b/server/api_test.go @@ -536,21 +536,6 @@ func TestCreateConnector(t *testing.T) { } else if !strings.Contains(err.Error(), "invalid config supplied") { t.Fatalf("Unexpected error: %v", err) } - - // Test reserved connector ID (__ prefix) - reservedReq := api.CreateConnectorReq{ - Connector: &api.Connector{ - Id: "__client_credentials", - Name: "Reserved", - Type: "TestType", - Config: []byte(`{"key": "value"}`), - }, - } - if _, err := client.CreateConnector(ctx, &reservedReq); err == nil { - t.Fatal("Expected an error for reserved connector ID, but none occurred") - } else if !strings.Contains(err.Error(), "reserved for internal use") { - t.Fatalf("Unexpected error: %v", err) - } } func TestUpdateConnector(t *testing.T) {