[fix] table.Guard bug
This commit is contained in:
parent
46ae05a6a8
commit
bf0405d2c4
1 changed files with 10 additions and 4 deletions
|
|
@ -52,15 +52,21 @@ func Guard(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if api.Guard == "" {
|
||||||
|
api.Guard = "bearer-jwt"
|
||||||
|
}
|
||||||
|
|
||||||
guards := strings.Split(api.Guard, ",")
|
guards := strings.Split(api.Guard, ",")
|
||||||
for _, guard := range guards {
|
for _, guard := range guards {
|
||||||
guard = strings.TrimSpace(guard)
|
guard = strings.TrimSpace(guard)
|
||||||
log.Trace("Guard Table %s %s", name, guard)
|
log.Trace("Guard Table %s %s", name, guard)
|
||||||
if middleware, has := gou.HTTPGuards[guard]; has {
|
if guard != "" {
|
||||||
middleware(c)
|
if middleware, has := gou.HTTPGuards[guard]; has {
|
||||||
continue
|
middleware(c)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
gou.ProcessGuard(guard)(c)
|
||||||
}
|
}
|
||||||
gou.ProcessGuard(guard)(c)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue