mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 02:11:09 +00:00
authenticator config: use static CA reader for OIDC CA
This commit is contained in:
parent
fa294f3e4e
commit
4ae4266c91
@ -19,6 +19,7 @@ package authenticator
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||
@ -158,7 +159,7 @@ func (config Config) New() (authenticator.Request, *spec.SecurityDefinitions, er
|
||||
var oidcCAContent oidc.CAContentProvider
|
||||
if len(config.OIDCCAFile) != 0 {
|
||||
var oidcCAErr error
|
||||
oidcCAContent, oidcCAErr = dynamiccertificates.NewDynamicCAContentFromFile("oidc-authenticator", config.OIDCCAFile)
|
||||
oidcCAContent, oidcCAErr = staticCAContentProviderFromFile("oidc-authenticator", config.OIDCCAFile)
|
||||
if oidcCAErr != nil {
|
||||
return nil, nil, oidcCAErr
|
||||
}
|
||||
@ -318,3 +319,12 @@ func newWebhookTokenAuthenticator(config Config) (authenticator.Token, error) {
|
||||
|
||||
return tokencache.New(webhookTokenAuthenticator, false, config.WebhookTokenAuthnCacheTTL, config.WebhookTokenAuthnCacheTTL), nil
|
||||
}
|
||||
|
||||
func staticCAContentProviderFromFile(purpose, filename string) (dynamiccertificates.CAContentProvider, error) {
|
||||
fileBytes, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return dynamiccertificates.NewStaticCAContent(purpose, fileBytes)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user