func newWebhookTokenAuthenticator(webhookConfigFile string, ttl time.Duration) (authenticator.Request, error) { webhookTokenAuthenticator, err := webhook.New(webhookConfigFile, ttl) if err != nil { return nil, err } return bearertoken.New(webhookTokenAuthenticator), nil }
// newAuthenticatorFromTokenFile returns an authenticator.Request or an error func newAuthenticatorFromTokenFile(tokenAuthFile string) (authenticator.Request, error) { tokenAuthenticator, err := tokenfile.NewCSV(tokenAuthFile) if err != nil { return nil, err } return bearertoken.New(tokenAuthenticator), nil }
// newServiceAccountAuthenticator returns an authenticator.Request or an error func newServiceAccountAuthenticator(keyfile string, lookup bool, serviceAccountGetter serviceaccount.ServiceAccountTokenGetter) (authenticator.Request, error) { publicKey, err := serviceaccount.ReadPublicKey(keyfile) if err != nil { return nil, err } tokenAuthenticator := serviceaccount.JWTTokenAuthenticator([]*rsa.PublicKey{publicKey}, lookup, serviceAccountGetter) return bearertoken.New(tokenAuthenticator), nil }
// newAuthenticatorFromOIDCIssuerURL returns an authenticator.Request or an error. func newAuthenticatorFromOIDCIssuerURL(issuerURL, clientID, caFile, usernameClaim, groupsClaim string) (authenticator.Request, error) { tokenAuthenticator, err := oidc.New(oidc.OIDCOptions{ IssuerURL: issuerURL, ClientID: clientID, CAFile: caFile, UsernameClaim: usernameClaim, GroupsClaim: groupsClaim, }) if err != nil { return nil, err } return bearertoken.New(tokenAuthenticator), nil }