mirror of
https://github.com/tinyauthapp/tinyauth.git
synced 2026-08-12 03:53:32 +08:00
handle edge cases
This commit is contained in:
@@ -546,6 +546,16 @@ func TestAuthEnabledRule(t *testing.T) {
|
||||
},
|
||||
expected: EffectAllow,
|
||||
},
|
||||
{
|
||||
name: "allows when comma-separated allow paths have trailing whitespace and commas",
|
||||
ctx: &ACLContext{
|
||||
ACLs: &model.App{
|
||||
Path: model.AppPath{Allow: " /bar,/foo/bar,/hello, , "},
|
||||
},
|
||||
Path: "/foo/bar/baz",
|
||||
},
|
||||
expected: EffectAllow,
|
||||
},
|
||||
{
|
||||
name: "allows when path matches allow regex",
|
||||
ctx: &ACLContext{
|
||||
@@ -566,6 +576,16 @@ func TestAuthEnabledRule(t *testing.T) {
|
||||
},
|
||||
expected: EffectDeny,
|
||||
},
|
||||
{
|
||||
name: "denies when allow paths contain only whitespace and commas",
|
||||
ctx: &ACLContext{
|
||||
ACLs: &model.App{
|
||||
Path: model.AppPath{Allow: " , , "},
|
||||
},
|
||||
Path: "/anything",
|
||||
},
|
||||
expected: EffectDeny,
|
||||
},
|
||||
{
|
||||
name: "denies when path does not match allow path",
|
||||
ctx: &ACLContext{
|
||||
|
||||
Reference in New Issue
Block a user