-
Notifications
You must be signed in to change notification settings - Fork 543
Feat: Support client JWT auth method for kafka oidc #4057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
9cd61ec
742b291
3ec7932
b73242b
5a8677c
8481041
b34eb3e
d34cb70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,36 +65,41 @@ const ( | |
| ) | ||
|
|
||
| type KafkaMetadata struct { | ||
| Brokers string `mapstructure:"brokers"` | ||
| internalBrokers []string `mapstructure:"-"` | ||
| ConsumerGroup string `mapstructure:"consumerGroup"` | ||
| ClientID string `mapstructure:"clientId"` | ||
| AuthType string `mapstructure:"authType"` | ||
| SaslUsername string `mapstructure:"saslUsername"` | ||
| SaslPassword string `mapstructure:"saslPassword"` | ||
| SaslMechanism string `mapstructure:"saslMechanism"` | ||
| InitialOffset string `mapstructure:"initialOffset"` | ||
| internalInitialOffset int64 `mapstructure:"-"` | ||
| MaxMessageBytes int `mapstructure:"maxMessageBytes"` | ||
| OidcTokenEndpoint string `mapstructure:"oidcTokenEndpoint"` | ||
| OidcClientID string `mapstructure:"oidcClientID"` | ||
| OidcClientSecret string `mapstructure:"oidcClientSecret"` | ||
| OidcScopes string `mapstructure:"oidcScopes"` | ||
| OidcExtensions string `mapstructure:"oidcExtensions"` | ||
| internalOidcScopes []string `mapstructure:"-"` | ||
| TLSDisable bool `mapstructure:"disableTls"` | ||
| TLSSkipVerify bool `mapstructure:"skipVerify"` | ||
| TLSCaCert string `mapstructure:"caCert"` | ||
| TLSClientCert string `mapstructure:"clientCert"` | ||
| TLSClientKey string `mapstructure:"clientKey"` | ||
| ConsumeRetryEnabled bool `mapstructure:"consumeRetryEnabled"` | ||
| ConsumeRetryInterval time.Duration `mapstructure:"consumeRetryInterval"` | ||
| HeartbeatInterval time.Duration `mapstructure:"heartbeatInterval"` | ||
| SessionTimeout time.Duration `mapstructure:"sessionTimeout"` | ||
| Version string `mapstructure:"version"` | ||
| EscapeHeaders bool `mapstructure:"escapeHeaders"` | ||
| internalVersion sarama.KafkaVersion `mapstructure:"-"` | ||
| internalOidcExtensions map[string]string `mapstructure:"-"` | ||
| Brokers string `mapstructure:"brokers"` | ||
| internalBrokers []string `mapstructure:"-"` | ||
| ConsumerGroup string `mapstructure:"consumerGroup"` | ||
| ClientID string `mapstructure:"clientId"` | ||
| AuthType string `mapstructure:"authType"` | ||
| SaslUsername string `mapstructure:"saslUsername"` | ||
| SaslPassword string `mapstructure:"saslPassword"` | ||
| SaslMechanism string `mapstructure:"saslMechanism"` | ||
| InitialOffset string `mapstructure:"initialOffset"` | ||
| internalInitialOffset int64 `mapstructure:"-"` | ||
| MaxMessageBytes int `mapstructure:"maxMessageBytes"` | ||
| OidcTokenEndpoint string `mapstructure:"oidcTokenEndpoint"` | ||
| OidcClientID string `mapstructure:"oidcClientID"` | ||
| OidcClientSecret string `mapstructure:"oidcClientSecret"` | ||
| OidcScopes string `mapstructure:"oidcScopes"` | ||
| OidcExtensions string `mapstructure:"oidcExtensions"` | ||
| OidcClientAuthMethod string `mapstructure:"oidcClientAuthMethod"` | ||
| OidcClientAssertionCert string `mapstructure:"oidcClientAssertionCert"` | ||
| OidcClientAssertionKey string `mapstructure:"oidcClientAssertionKey"` | ||
| OidcResource string `mapstructure:"oidcResource"` | ||
| OidcAudience string `mapstructure:"oidcAudience"` | ||
| internalOidcScopes []string `mapstructure:"-"` | ||
| TLSDisable bool `mapstructure:"disableTls"` | ||
| TLSSkipVerify bool `mapstructure:"skipVerify"` | ||
| TLSCaCert string `mapstructure:"caCert"` | ||
| TLSClientCert string `mapstructure:"clientCert"` | ||
| TLSClientKey string `mapstructure:"clientKey"` | ||
| ConsumeRetryEnabled bool `mapstructure:"consumeRetryEnabled"` | ||
| ConsumeRetryInterval time.Duration `mapstructure:"consumeRetryInterval"` | ||
| HeartbeatInterval time.Duration `mapstructure:"heartbeatInterval"` | ||
| SessionTimeout time.Duration `mapstructure:"sessionTimeout"` | ||
| Version string `mapstructure:"version"` | ||
| EscapeHeaders bool `mapstructure:"escapeHeaders"` | ||
| internalVersion sarama.KafkaVersion `mapstructure:"-"` | ||
| internalOidcExtensions map[string]string `mapstructure:"-"` | ||
|
|
||
| // configs for kafka client | ||
| ClientConnectionTopicMetadataRefreshInterval time.Duration `mapstructure:"clientConnectionTopicMetadataRefreshInterval"` | ||
|
|
@@ -235,8 +240,14 @@ func (k *Kafka) getKafkaMetadata(meta map[string]string) (*KafkaMetadata, error) | |
| if m.OidcClientID == "" { | ||
| return nil, errors.New("kafka error: missing OIDC Client ID for authType 'oidc'") | ||
| } | ||
| if m.OidcClientSecret == "" { | ||
| return nil, errors.New("kafka error: missing OIDC Client Secret for authType 'oidc'") | ||
| if m.OidcClientAuthMethod == "client_secret" && m.OidcClientSecret == "" { | ||
| return nil, errors.New("kafka error: missing OIDC Client Secret for authType 'oidc' (client_secret)") | ||
| } | ||
| if m.OidcClientAuthMethod == "client_jwt" && m.OidcClientAssertionCert == "" { | ||
| return nil, errors.New("kafka error: missing OIDC Client Assertion Cert for authType 'oidc' (client_jwt)") | ||
| } | ||
| if m.OidcClientAuthMethod == "client_jwt" && m.OidcClientAssertionKey == "" { | ||
| return nil, errors.New("kafka error: missing OIDC Client Assertion Key for authType 'oidc' (client_jwt)") | ||
| } | ||
|
||
| if m.OidcScopes != "" { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls add this field to the auth profile in the metadata.yaml as I don't see it with the openid string default |
||
| m.internalOidcScopes = strings.Split(m.OidcScopes, ",") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.