-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draft: feat(translation): expand sources of JWKS (Json Web Key Sets) …
…required to validate JWTs Currently only HTTPS endpoints are supported via remoteJWKS field of the JWTProvider. This is deprecated in favor of a jwksSource field that expands the available locations JWKS content can be retireved from. Sources include an inline string in the source resource, a local file in the Gateway Container or from a Configmap/Secret.
- Loading branch information
Showing
3 changed files
with
118 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "test", | ||
Issuer: "https://www.test.local", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
|
@@ -86,7 +86,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "test", | ||
Issuer: "[email protected]", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
|
@@ -114,7 +114,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "test", | ||
Issuer: "[email protected]", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
ClaimToHeaders: []egv1a1.ClaimToHeader{ | ||
|
@@ -148,7 +148,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "unqualified_...", | ||
Issuer: "https://www.test.local", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
|
@@ -176,7 +176,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "", | ||
Issuer: "https://www.test.local", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
|
@@ -204,23 +204,23 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "unique", | ||
Issuer: "https://www.test.local", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
{ | ||
Name: "non-unique", | ||
Issuer: "https://www.test.local", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
{ | ||
Name: "non-unique", | ||
Issuer: "https://www.test.local", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
|
@@ -248,7 +248,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "test", | ||
Issuer: "http://invalid url.local", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "http://www.test.local", | ||
}, | ||
}, | ||
|
@@ -276,7 +276,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "test", | ||
Issuer: "test@!123...", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
|
@@ -304,7 +304,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "test", | ||
Issuer: "http://www.test.local", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "invalid/local", | ||
}, | ||
}, | ||
|
@@ -331,7 +331,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
{ | ||
Name: "test", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "", | ||
}, | ||
}, | ||
|
@@ -359,7 +359,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "test", | ||
Issuer: "[email protected]", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
ClaimToHeaders: []egv1a1.ClaimToHeader{ | ||
|
@@ -393,7 +393,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
Name: "test", | ||
Issuer: "[email protected]", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
ClaimToHeaders: []egv1a1.ClaimToHeader{ | ||
|
@@ -426,7 +426,7 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
{ | ||
Name: "test", | ||
Audiences: []string{"test.local"}, | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
|
@@ -453,7 +453,34 @@ func TestValidateSecurityPolicy(t *testing.T) { | |
{ | ||
Name: "test", | ||
Issuer: "https://www.test.local", | ||
RemoteJWKS: egv1a1.RemoteJWKS{ | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
name: "unspecified audiences", | ||
policy: &egv1a1.SecurityPolicy{ | ||
TypeMeta: metav1.TypeMeta{ | ||
Kind: egv1a1.KindSecurityPolicy, | ||
APIVersion: egv1a1.GroupVersion.String(), | ||
}, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Namespace: "test", | ||
Name: "test", | ||
}, | ||
Spec: egv1a1.SecurityPolicySpec{ | ||
JWT: &egv1a1.JWT{ | ||
Providers: []egv1a1.JWTProvider{ | ||
{ | ||
Name: "test", | ||
Issuer: "https://www.test.local", | ||
RemoteJWKS: &egv1a1.RemoteJWKS{ | ||
URI: "https://test.local/jwt/public-key/jwks.json", | ||
}, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters