mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-03-21 21:47:11 +02:00
Add startup logging for skipped auth routes
This commit is contained in:
parent
fa4ba5e7ea
commit
89a8ac8c1f
@ -293,6 +293,7 @@ func buildRoutesAllowlist(opts *options.Options) ([]*allowedRoute, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
logger.Printf("Skipping auth - Method: ALL | Path: %s", path)
|
||||||
routes = append(routes, &allowedRoute{
|
routes = append(routes, &allowedRoute{
|
||||||
method: "",
|
method: "",
|
||||||
pathRegex: compiledRegex,
|
pathRegex: compiledRegex,
|
||||||
@ -318,6 +319,7 @@ func buildRoutesAllowlist(opts *options.Options) ([]*allowedRoute, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
logger.Printf("Skipping auth - Method: %s | Path: %s", method, path)
|
||||||
routes = append(routes, &allowedRoute{
|
routes = append(routes, &allowedRoute{
|
||||||
method: method,
|
method: method,
|
||||||
pathRegex: compiledRegex,
|
pathRegex: compiledRegex,
|
||||||
|
@ -2365,9 +2365,9 @@ func Test_buildRoutesAllowlist(t *testing.T) {
|
|||||||
if tc.shouldError {
|
if tc.shouldError {
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
assert.NoError(t, err)
|
|
||||||
}
|
}
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
for i, route := range routes {
|
for i, route := range routes {
|
||||||
assert.Greater(t, len(tc.expectedMethods), i)
|
assert.Greater(t, len(tc.expectedMethods), i)
|
||||||
assert.Equal(t, route.method, tc.expectedMethods[i])
|
assert.Equal(t, route.method, tc.expectedMethods[i])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user