updated libs
This commit is contained in:
parent
8104009bdc
commit
f305f96195
11 changed files with 79 additions and 265 deletions
|
|
@ -16,14 +16,16 @@ var errFollower = errors.New("follower write")
|
|||
|
||||
func authHandler(h types.CtxHandler) types.CtxHandler {
|
||||
return func(ctx *types.Context) {
|
||||
user, pass, ok := ctx.Request.BasicAuth()
|
||||
if !ok {
|
||||
ctx.Err(types.ErrUnauthorized)
|
||||
return
|
||||
}
|
||||
if !ctx.Data.Auth.Login(user, pass, ctx.Path()) {
|
||||
ctx.Err(types.ErrForbidden)
|
||||
return
|
||||
if !ctx.Data.AuthDisabled {
|
||||
user, pass, ok := ctx.Request.BasicAuth()
|
||||
if !ok {
|
||||
ctx.Err(types.ErrUnauthorized)
|
||||
return
|
||||
}
|
||||
if !ctx.Data.Auth.Login(user, pass, ctx.Path()) {
|
||||
ctx.Err(types.ErrForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
h(ctx)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue