@@ -203,7 +203,11 @@ func (o *BuiltInAuthenticationOptions) WithClientCert() *BuiltInAuthenticationOp
203
203
204
204
// WithOIDC set default value for OIDC authentication
205
205
func (o * BuiltInAuthenticationOptions ) WithOIDC () * BuiltInAuthenticationOptions {
206
- o .OIDC = & OIDCAuthenticationOptions {areFlagsConfigured : func () bool { return false }}
206
+ o .OIDC = & OIDCAuthenticationOptions {
207
+ areFlagsConfigured : func () bool { return false },
208
+ UsernameClaim : "sub" ,
209
+ SigningAlgs : []string {"RS256" },
210
+ }
207
211
return o
208
212
}
209
213
@@ -353,33 +357,33 @@ func (o *BuiltInAuthenticationOptions) AddFlags(fs *pflag.FlagSet) {
353
357
"The URL of the OpenID issuer, only HTTPS scheme will be accepted. " +
354
358
"If set, it will be used to verify the OIDC JSON Web Token (JWT)." )
355
359
356
- fs .StringVar (& o .OIDC .ClientID , oidcClientIDFlag , o .OIDC .ClientID ,
360
+ fs .StringVar (& o .OIDC .ClientID , oidcClientIDFlag , o .OIDC .ClientID , "" +
357
361
"The client ID for the OpenID Connect client, must be set if oidc-issuer-url is set." )
358
362
359
363
fs .StringVar (& o .OIDC .CAFile , oidcCAFileFlag , o .OIDC .CAFile , "" +
360
364
"If set, the OpenID server's certificate will be verified by one of the authorities " +
361
365
"in the oidc-ca-file, otherwise the host's root CA set will be used." )
362
366
363
- fs .StringVar (& o .OIDC .UsernameClaim , oidcUsernameClaimFlag , "sub" , "" +
367
+ fs .StringVar (& o .OIDC .UsernameClaim , oidcUsernameClaimFlag , o . OIDC . UsernameClaim , "" +
364
368
"The OpenID claim to use as the user name. Note that claims other than the default ('sub') " +
365
369
"is not guaranteed to be unique and immutable. This flag is experimental, please see " +
366
370
"the authentication documentation for further details." )
367
371
368
- fs .StringVar (& o .OIDC .UsernamePrefix , oidcUsernamePrefixFlag , "" , "" +
372
+ fs .StringVar (& o .OIDC .UsernamePrefix , oidcUsernamePrefixFlag , o . OIDC . UsernamePrefix , "" +
369
373
"If provided, all usernames will be prefixed with this value. If not provided, " +
370
374
"username claims other than 'email' are prefixed by the issuer URL to avoid " +
371
375
"clashes. To skip any prefixing, provide the value '-'." )
372
376
373
- fs .StringVar (& o .OIDC .GroupsClaim , oidcGroupsClaimFlag , "" , "" +
377
+ fs .StringVar (& o .OIDC .GroupsClaim , oidcGroupsClaimFlag , o . OIDC . GroupsClaim , "" +
374
378
"If provided, the name of a custom OpenID Connect claim for specifying user groups. " +
375
379
"The claim value is expected to be a string or array of strings. This flag is experimental, " +
376
380
"please see the authentication documentation for further details." )
377
381
378
- fs .StringVar (& o .OIDC .GroupsPrefix , oidcGroupsPrefixFlag , "" , "" +
382
+ fs .StringVar (& o .OIDC .GroupsPrefix , oidcGroupsPrefixFlag , o . OIDC . GroupsPrefix , "" +
379
383
"If provided, all groups will be prefixed with this value to prevent conflicts with " +
380
384
"other authentication strategies." )
381
385
382
- fs .StringSliceVar (& o .OIDC .SigningAlgs , oidcSigningAlgsFlag , [] string { "RS256" } , "" +
386
+ fs .StringSliceVar (& o .OIDC .SigningAlgs , oidcSigningAlgsFlag , o . OIDC . SigningAlgs , "" +
383
387
"Comma-separated list of allowed JOSE asymmetric signing algorithms. JWTs with a " +
384
388
"supported 'alg' header values are: RS256, RS384, RS512, ES256, ES384, ES512, PS256, PS384, PS512. " +
385
389
"Values are defined by RFC 7518 https://tools.ietf.org/html/rfc7518#section-3.1." )
0 commit comments