mirror of
https://github.com/beego/bee.git
synced 2024-11-14 17:00:54 +00:00
add security definition on controller basis
This commit is contained in:
parent
208c3aa697
commit
ae8aea4ec4
@ -640,7 +640,17 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat
|
||||
opts.Produces = append(opts.Produces, ahtml)
|
||||
}
|
||||
}
|
||||
} else if strings.HasPrefix(t, "@Security") {
|
||||
if len(opts.Security) == 0 {
|
||||
opts.Security = make([]map[string]swagger.Security, 0)
|
||||
}
|
||||
fullString := strings.TrimSpace(t[len("@Security"):])
|
||||
e := strings.SplitN(fullString, " ", 4)
|
||||
newMap := make(map[string]swagger.Security)
|
||||
newMap[e[0]] = swagger.Security{}
|
||||
opts.Security = append(opts.Security, newMap)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if routerPath != "" {
|
||||
|
Loading…
Reference in New Issue
Block a user