Commit 3e93151
committed
oidcccl,provisioning: add user provisioning for OIDC authentication
Previously, the OIDC authentication flow in the DB Console only
supported logging in with existing user accounts. There was no
built-in mechanism to automatically create a new database user when a
user authenticated via an OIDC provider for the first time.
This was inadequate because administrators would need to manually
create a database user for every first‑time OIDC login, adding
friction and overhead to onboarding.
To address this, this patch introduces automatic user provisioning for
the OIDC authentication flow. When a new user successfully
authenticates via an OIDC provider, a corresponding CockroachDB user
is now automatically created if one does not already exist. This
functionality is controlled by a new cluster setting,
`security.provisioning.oidc.enabled`, which is disabled by default to
maintain backward compatibility and ensure administrators can opt-in
to this behavior.
Note: The `security.provisioning.oidc.enabled` cluster setting requires checking
user existence before provisioning. This may introduce latency when concurrent
OIDC authentication attempts from browsers generate high read request load on
the user table.
Fixes: #126680
Epic: CRDB-48764
Release note (enterprise change): A new cluster setting,
`security.provisioning.oidc.enabled`, has been added to allow for the
automatic provisioning of users when they log in for the first time
via OIDC. When enabled, a new user will be created in CockroachDB upon
their first successful OIDC authentication. This feature is disabled
by default.
On enabling the setting, user gets created on oidc login and can be validated
using the `SHOW users` command.
```
> SELECT * FROM [SHOW USERS] WHERE username = 'testuser';
username | options | member_of | estimated_last_login_time
-----------------+-------------------------------------------------+-----------+----------------------------
testuser | {PROVISIONSRC=oidc:https://accounts.google.com} | {} | NULL
(1 row)
NOTICE: estimated_last_login_time is computed on a best effort basis; it is not guaranteed to capture every login event
```1 parent ab11edd commit 3e93151
File tree
7 files changed
+633
-11
lines changed- pkg
- ccl
- logictestccl/testdata/logic_test
- oidcccl
- security/provisioning
7 files changed
+633
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
| 163 | + | |
161 | 164 | | |
162 | 165 | | |
163 | 166 | | |
| |||
420 | 423 | | |
421 | 424 | | |
422 | 425 | | |
423 | | - | |
424 | | - | |
425 | | - | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
426 | 430 | | |
427 | 431 | | |
428 | 432 | | |
| |||
490 | 494 | | |
491 | 495 | | |
492 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
493 | 560 | | |
494 | 561 | | |
495 | 562 | | |
| |||
608 | 675 | | |
609 | 676 | | |
610 | 677 | | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
611 | 684 | | |
612 | 685 | | |
613 | 686 | | |
| |||
938 | 1011 | | |
939 | 1012 | | |
940 | 1013 | | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
941 | 1017 | | |
942 | 1018 | | |
943 | 1019 | | |
| |||
0 commit comments