fix review
This commit is contained in:
parent
66f2a973a3
commit
7cf27e0fde
5 changed files with 103 additions and 73 deletions
|
|
@ -9,10 +9,10 @@ import (
|
|||
)
|
||||
|
||||
type Middleware struct {
|
||||
Username string
|
||||
Password string
|
||||
BasePath string
|
||||
SkipAuthPaths []string
|
||||
Username string
|
||||
Password string
|
||||
BasePath string
|
||||
Public []string
|
||||
}
|
||||
|
||||
func unsafeMethod(method string) bool {
|
||||
|
|
@ -20,7 +20,7 @@ func unsafeMethod(method string) bool {
|
|||
}
|
||||
|
||||
func (m *Middleware) Handler(c *router.Context) {
|
||||
for _, path := range m.SkipAuthPaths {
|
||||
for _, path := range m.Public {
|
||||
if strings.HasPrefix(c.Req.URL.Path, m.BasePath+path) {
|
||||
c.Next()
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue