|
@@ -229,6 +229,14 @@ func (s *Server) HandleRequest(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
//validate username and password
|
|
|
authAgent := s.userHandler.GetAuthAgent()
|
|
|
+
|
|
|
+ //Validate request origin
|
|
|
+ allowAccess, err := authAgent.ValidateLoginRequest(w, r)
|
|
|
+ if !allowAccess {
|
|
|
+ log.Println("Someone from " + r.RemoteAddr + " try to log into " + username + " WebDAV endpoint but got rejected: " + err.Error())
|
|
|
+ http.Error(w, err.Error(), http.StatusUnauthorized)
|
|
|
+ return
|
|
|
+ }
|
|
|
passwordValid, rejectionReason := authAgent.ValidateUsernameAndPasswordWithReason(username, password)
|
|
|
if !passwordValid {
|
|
|
authAgent.Logger.LogAuthByRequestInfo(username, r.RemoteAddr, time.Now().Unix(), false, "webdav")
|