Raggiunto primo stato presentabile

This commit is contained in:
2022-03-05 04:45:12 +01:00
parent b0732c9c4f
commit bbd6b9eb7e
19 changed files with 1326 additions and 468 deletions
+4 -4
View File
@@ -49,7 +49,7 @@ type AuthService struct {
UserFromSessionToken func(session string) (string, error)
// AuthenticationFailed handles failed authentications
AuthenticationFailed http.Handler
AuthenticationFailed func(error) http.Handler
// OtherError handles other errors
OtherError func(error) http.Handler
@@ -57,7 +57,7 @@ type AuthService struct {
func (auth *AuthService) Login(w http.ResponseWriter, r *http.Request, userID, password string) {
if err := auth.CheckUserPassword(userID, password); err != nil {
auth.AuthenticationFailed.ServeHTTP(w, r)
auth.AuthenticationFailed(err).ServeHTTP(w, r)
return
}
@@ -98,7 +98,7 @@ func (auth *AuthService) Middleware(config *AuthMiddlewareConfig) func(http.Hand
return
}
auth.AuthenticationFailed.ServeHTTP(w, r)
auth.AuthenticationFailed(err).ServeHTTP(w, r)
return
}
if err != nil {
@@ -139,7 +139,7 @@ func (auth *AuthService) Middleware(config *AuthMiddlewareConfig) func(http.Hand
}
if !hasAll {
auth.AuthenticationFailed.ServeHTTP(w, r)
auth.AuthenticationFailed(err).ServeHTTP(w, r)
return
}
}