fixed authentication middleware
This commit is contained in:
@@ -8,15 +8,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func ApplyAuthenticationByConfig(next http.Handler) http.Handler {
|
func ApplyAuthenticationByConfig(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
handler := next
|
||||||
if config.Instance().RequireAuth {
|
|
||||||
Authenticated(next)
|
if config.Instance().RequireAuth {
|
||||||
return
|
handler = Authenticated(handler)
|
||||||
}
|
}
|
||||||
if config.Instance().UseOpenId {
|
if config.Instance().UseOpenId {
|
||||||
openid.Middleware(next)
|
handler = openid.Middleware(handler)
|
||||||
return
|
}
|
||||||
}
|
|
||||||
next.ServeHTTP(w, r)
|
return handler
|
||||||
})
|
}
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user