Skip to content
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

Allow to configure OIDC subject name for eventshub sender #749

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/eventshub/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ func OIDCCorruptedSignature() EventsHubOption {
return compose(envOption(OIDCGenerateCorruptedSignatureTokenEnv, "true"), envOIDCEnabled())
}

// OIDCSubject sets the name of the OIDC subject to use by the sender. Defaults to "oidc-<eventshub-name>"
creydr marked this conversation as resolved.
Show resolved Hide resolved
func OIDCSubject(sub string) EventsHubOption {
return compose(envOption(OIDCSubjectEnv, sub), envOIDCEnabled())
}

// OIDCToken adds the given token used for OIDC authentication to the request.
func OIDCToken(jwt string) EventsHubOption {
return compose(envOption(OIDCTokenEnv, jwt), envOIDCEnabled())
Expand Down
3 changes: 3 additions & 0 deletions pkg/eventshub/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ func Install(name string, options ...EventsHubOption) feature.StepFn {
if isOIDCEnabled && !isReceiver {
// install oidc sa
oidcSAName := fmt.Sprintf("oidc-%s", name)
if envs[OIDCSubjectEnv] != "" {
oidcSAName = envs[OIDCSubjectEnv]
}
serviceaccount.Install(oidcSAName)(ctx, t)

// generate token
Expand Down
1 change: 1 addition & 0 deletions pkg/eventshub/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
OIDCEnabledEnv = "ENABLE_OIDC_AUTH"
OIDCGenerateExpiredTokenEnv = "OIDC_GENERATE_EXPIRED_TOKEN"
OIDCGenerateInvalidAudienceTokenEnv = "OIDC_GENERATE_INVALID_AUDIENCE_TOKEN"
OIDCSubjectEnv = "OIDC_SUBJECT"
OIDCGenerateCorruptedSignatureTokenEnv = "OIDC_GENERATE_CORRUPTED_SIG_TOKEN"
OIDCSinkAudienceEnv = "OIDC_SINK_AUDIENCE"
OIDCReceiverAudienceEnv = "OIDC_AUDIENCE"
Expand Down
Loading