feat: allow configurable username claim field in OIDC (#5507)

Co-authored-by: Colin Adler <colin1adler@gmail.com>
This commit is contained in:
Jan Losinski
2023-01-04 15:16:31 -06:00
committed by GitHub
co-authored by Colin Adler
parent 8968a00035
commit de0601d611
11 changed files with 59 additions and 3 deletions
+6
View File
@@ -248,6 +248,12 @@ func newConfig() *codersdk.DeploymentConfig {
Flag: "oidc-ignore-email-verified",
Default: false,
},
UsernameField: &codersdk.DeploymentConfigField[string]{
Name: "OIDC Username Field",
Usage: "OIDC claim field to use as the username.",
Flag: "oidc-username-field",
Default: "preferred_username",
},
},
Telemetry: &codersdk.TelemetryConfig{
+3 -2
View File
@@ -526,8 +526,9 @@ func Server(vip *viper.Viper, newAPI func(context.Context, *coderd.Options) (*co
Verifier: oidcProvider.Verifier(&oidc.Config{
ClientID: cfg.OIDC.ClientID.Value,
}),
EmailDomain: cfg.OIDC.EmailDomain.Value,
AllowSignups: cfg.OIDC.AllowSignups.Value,
EmailDomain: cfg.OIDC.EmailDomain.Value,
AllowSignups: cfg.OIDC.AllowSignups.Value,
UsernameField: cfg.OIDC.UsernameField.Value,
}
}
+3
View File
@@ -112,6 +112,9 @@ Flags:
OIDC.
Consumes $CODER_OIDC_SCOPES (default
[openid,profile,email])
--oidc-username-field string OIDC claim field to use as the username.
Consumes $CODER_OIDC_USERNAME_FIELD
(default "preferred_username")
--postgres-url string URL of a PostgreSQL database. If empty,
PostgreSQL binaries will be downloaded
from Maven