TUN-6774: Validate OriginRequest.Access to add Ingress.Middleware

We take advantage of the JWTValidator middleware and attach it to an
ingress rule based on Access configurations. We attach the Validator
directly to the ingress rules because we want to take advantage of
caching and token revert/handling that comes with go-oidc.
This commit is contained in:
Sudarsan Reddy
2022-09-22 14:04:47 +01:00
parent 0aa21f302e
commit 462d2f87df
5 changed files with 48 additions and 13 deletions

View File

@@ -42,8 +42,8 @@ func NewJWTValidator(teamName string, certsURL string, audTags []string) *JWTVal
}
}
func (v *JWTValidator) Handle(ctx context.Context, headers http.Header) error {
accessJWT := headers.Get(headerKeyAccessJWTAssertion)
func (v *JWTValidator) Handle(ctx context.Context, r *http.Request) error {
accessJWT := r.Header.Get(headerKeyAccessJWTAssertion)
if accessJWT == "" {
return ErrNoAccessToken
}