Skip to content

Commit

Permalink
proxy: optionally enable OIDC auth
Browse files Browse the repository at this point in the history
This adds OIDC to the enabled optional auth methods
  • Loading branch information
Steven Hardy committed Nov 7, 2022
1 parent 31fc97c commit 044f9fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/proxy/options/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func NewAuthentication() *Authentication {
auth := &Authentication{
BuiltInOptions: kubeoptions.NewBuiltInAuthenticationOptions().
WithClientCert().
WithOIDC().
WithServiceAccounts().
WithTokenFile(),
// when adding new auth methods, also update AdditionalAuthEnabled below
Expand All @@ -62,7 +63,11 @@ func NewAuthentication() *Authentication {

// When configured to enable auth other than ClientCert, this returns true
func (c *Authentication) AdditionalAuthEnabled() bool {
return c.tokenAuthEnabled() || c.serviceAccountAuthEnabled()
return c.tokenAuthEnabled() || c.serviceAccountAuthEnabled() || c.oidcAuthEnabled()
}

func (c *Authentication) oidcAuthEnabled() bool {
return c.BuiltInOptions.OIDC != nil && c.BuiltInOptions.OIDC.IssuerURL != ""
}

func (c *Authentication) tokenAuthEnabled() bool {
Expand Down

0 comments on commit 044f9fc

Please sign in to comment.