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

Support multiple JWTs #108

Closed
keeganwitt opened this issue Dec 13, 2023 · 3 comments
Closed

Support multiple JWTs #108

keeganwitt opened this issue Dec 13, 2023 · 3 comments
Milestone

Comments

@keeganwitt
Copy link
Contributor

Something I missed when reviewing #85 is that if you need multiple JWT paths because you have JWTs for more than one audience, there's no way to do this currently.

@faisal-memon
Copy link
Collaborator

@keeganwitt How would that work? An array of audiences? Save them in the same or different files?

@keeganwitt
Copy link
Contributor Author

keeganwitt commented Dec 13, 2023

@keeganwitt How would that work? An array of audiences? Save them in the same or different files?

Yes, an array of files and audiences is what I was thinking. Something like

Index: pkg/sidecar/config.go
===================================================================
diff --git a/pkg/sidecar/config.go b/pkg/sidecar/config.go
--- a/pkg/sidecar/config.go	(revision c86aaa3c6aebb44c8296b9caa742f5250703a9ad)
+++ b/pkg/sidecar/config.go	(date 1702493092224)
@@ -32,9 +32,10 @@
 	RenewSignalDeprecated              string `hcl:"renewSignal"`
 
 	// JWT configuration
-	JWTAudience       string `hcl:"jwt_audience"`
-	JWTSvidFilename   string `hcl:"jwt_svid_file_name"`
-	JWTBundleFilename string `hcl:"jwt_bundle_file_name"`
+	Jwts              []JwtConfig `hcl:"jwts"`
+	JWTAudience       string      `hcl:"jwt_audience"`
+	JWTSvidFilename   string      `hcl:"jwt_svid_file_name"`
+	JWTBundleFilename string      `hcl:"jwt_bundle_file_name"`
 
 	// TODO: is there a reason for this to be exposed? and inside of config?
 	ReloadExternalProcess func() error
@@ -42,6 +43,11 @@
 	Log logrus.FieldLogger
 }
 
+type JwtConfig struct {
+	JWTAudience     string `hcl:"jwt_audience"`
+	JWTSvidFilename string `hcl:"jwt_svid_file_name"`
+}
+
 // ParseConfig parses the given HCL file into a SidecarConfig struct
 func ParseConfig(file string) (*Config, error) {
 	sidecarConfig := new(Config)

@faisal-memon
Copy link
Collaborator

I think we can simplify with just the array of audiences and then add the audience as a suffix to the outputted file.

@faisal-memon faisal-memon modified the milestones: 0.8.0, 0.9.0 Dec 13, 2023
keeganwitt added a commit to keeganwitt/spiffe-helper that referenced this issue Dec 13, 2023
keeganwitt added a commit to keeganwitt/spiffe-helper that referenced this issue Dec 13, 2023
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
@faisal-memon faisal-memon modified the milestones: 0.9.0, 0.8.0 Dec 20, 2023
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

No branches or pull requests

2 participants