Skip to content

Conversation

@wwitzel3
Copy link

@wwitzel3 wwitzel3 commented Nov 6, 2025

Add JWT authorization support for the EventBus jetStreamExotic

Signed-off-by: Wayne Witzel III <[email protected]>
@wwitzel3 wwitzel3 marked this pull request as ready for review November 6, 2025 20:53
@wwitzel3 wwitzel3 requested a review from whynowy as a code owner November 6, 2025 20:53
TLS *TLSConfig `json:"tls,omitempty" protobuf:"bytes,4,opt,name=tls"`
// Auth strategy, default to AuthStrategyNone
// +optional
Auth *AuthStrategy `json:"auth,omitempty" protobuf:"bytes,5,opt,name=auth,casttype=AuthStrategy"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we introduce a struct to abstract all the auth types, and deprecate the AccessSecret, something like below:

// NatsAuth defines how to authenticate the nats access
type NatsAuth struct {
	// Basic auth which contains a username and a password
	// +optional
	Basic *BasicAuth `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"`
	// Token auth
	// +optional
	Token *corev1.SecretKeySelector `json:"token,omitempty" protobuf:"bytes,2,opt,name=token"`
	// NKey auth
	// +optional
	JWT *corev1.SecretKeySelector `json:"jwt,omitempty" protobuf:"bytes,3,opt,name=jwt"`
}

type JetStreamConfig struct {
	// JetStream (Nats) URL
	URL string `json:"url,omitempty" protobuf:"bytes,1,opt,name=url"`
	// Secret for auth
	// +optional
    // Deprecated: Use Auth instead
	AccessSecret *corev1.SecretKeySelector `json:"accessSecret,omitempty" protobuf:"bytes,2,opt,name=accessSecret"`
	// +optional
	StreamConfig string `json:"streamConfig,omitempty" protobuf:"bytes,3,opt,name=streamConfig"`
	// SSL/TLS settings for the NATS client
	// +optional
	TLS *TLSConfig `json:"tls,omitempty" protobuf:"bytes,4,opt,name=tls"`
    Auth *NatsAuth `json:"auth,omitempty" protobuf:"bytes,5,opt,name=auth"`
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review! I can look into that, it does have a downstream effective requiring a lot of changes since many of other packages currently have logic that checks for and works against the AuthStrategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants