diff --git a/pkg.go b/pkg.go index ce321d7..932684e 100644 --- a/pkg.go +++ b/pkg.go @@ -112,7 +112,7 @@ func (service *Service) defaultAuthenticationHandler(req AuthenticationRequest, } // }}} func (service *Service) defaultAuthorizationHandler(sess *session.T, r *http.Request) (resp bool, err error) { // {{{ resp = true - service.logger.Error("webservice", "op", "authorization", "session", sess.UUID, "request", r, "authorized", resp) + service.logger.Debug("webservice", "op", "authorization", "session", sess.UUID, "request", r.URL.String(), "authorized", resp) return } // }}} func (service *Service) defaultErrorHandler(err error, w http.ResponseWriter) { // {{{ diff --git a/session.go b/session.go index 08365bf..c556df3 100644 --- a/session.go +++ b/session.go @@ -20,6 +20,7 @@ type AuthenticationRequest struct { } type AuthenticationResponse struct { + OK bool Authenticated bool UserID int } @@ -88,8 +89,8 @@ func (service *Service) sessionAuthenticate(w http.ResponseWriter, r *http.Reque } // Authenticate against webservice user table if using a database. + var userID int if service.Db != nil { - var userID int authenticated, userID, err = service.Db.Authenticate(authRequest.Username, authRequest.Password) if err != nil { service.errorHandler(err, w) @@ -113,7 +114,8 @@ func (service *Service) sessionAuthenticate(w http.ResponseWriter, r *http.Reque service.errorHandler(err, w) return } - authResponse.UserID = sess.UserID + authResponse.UserID = userID + authResponse.OK = true sess.Authenticated = authResponse.Authenticated