mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 08:50:42 +02:00
proxy: add support for logging http request headers (#4388)
* config: add customization options for logging * config: validate log fields * proxy: add support for logging http request headers * log subset of headers * fix test name * dont use log.HTTPHeaders for access logs * canonicalize http/2 headers
This commit is contained in:
parent
4698e4661a
commit
638d9f3d6c
11 changed files with 172 additions and 13 deletions
|
@ -311,13 +311,13 @@ func safeEval(ctx context.Context, q rego.PreparedEvalQuery, options ...rego.Eva
|
|||
// carryOverJWTAssertion copies assertion JWT from request to response
|
||||
// note that src keys are expected to be http.CanonicalHeaderKey
|
||||
func carryOverJWTAssertion(dst http.Header, src map[string]string) {
|
||||
jwtForKey := http.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertionFor)
|
||||
jwtForKey := httputil.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertionFor)
|
||||
jwtFor, ok := src[jwtForKey]
|
||||
if ok && jwtFor != "" {
|
||||
dst.Add(jwtForKey, jwtFor)
|
||||
return
|
||||
}
|
||||
jwtFor, ok = src[http.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertion)]
|
||||
jwtFor, ok = src[httputil.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertion)]
|
||||
if ok && jwtFor != "" {
|
||||
dst.Add(jwtForKey, jwtFor)
|
||||
}
|
||||
|
|
|
@ -422,11 +422,11 @@ func TestEvaluator(t *testing.T) {
|
|||
}{
|
||||
{map[string]string{}, ""},
|
||||
{map[string]string{
|
||||
http.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertion): "identity-a",
|
||||
httputil.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertion): "identity-a",
|
||||
}, "identity-a"},
|
||||
{map[string]string{
|
||||
http.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertionFor): "identity-a",
|
||||
http.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertion): "identity-b",
|
||||
httputil.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertionFor): "identity-a",
|
||||
httputil.CanonicalHeaderKey(httputil.HeaderPomeriumJWTAssertion): "identity-b",
|
||||
}, "identity-a"},
|
||||
}
|
||||
for _, tc := range tcs {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue