From 89a8ac8c1f4995e270b8db3f6b71b28fc95ef780 Mon Sep 17 00:00:00 2001 From: Nick Meves Date: Sat, 26 Sep 2020 12:38:01 -0700 Subject: [PATCH] Add startup logging for skipped auth routes --- oauthproxy.go | 2 ++ oauthproxy_test.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/oauthproxy.go b/oauthproxy.go index c92eb850..ae5231f6 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -293,6 +293,7 @@ func buildRoutesAllowlist(opts *options.Options) ([]*allowedRoute, error) { if err != nil { return nil, err } + logger.Printf("Skipping auth - Method: ALL | Path: %s", path) routes = append(routes, &allowedRoute{ method: "", pathRegex: compiledRegex, @@ -318,6 +319,7 @@ func buildRoutesAllowlist(opts *options.Options) ([]*allowedRoute, error) { if err != nil { return nil, err } + logger.Printf("Skipping auth - Method: %s | Path: %s", method, path) routes = append(routes, &allowedRoute{ method: method, pathRegex: compiledRegex, diff --git a/oauthproxy_test.go b/oauthproxy_test.go index 53bc9543..e42033d1 100644 --- a/oauthproxy_test.go +++ b/oauthproxy_test.go @@ -2365,9 +2365,9 @@ func Test_buildRoutesAllowlist(t *testing.T) { if tc.shouldError { assert.Error(t, err) return - } else { - assert.NoError(t, err) } + assert.NoError(t, err) + for i, route := range routes { assert.Greater(t, len(tc.expectedMethods), i) assert.Equal(t, route.method, tc.expectedMethods[i])