fleet/server/logging_sessions.go
Victor Vrantchan df19fd4b7c Update users service (#156)
Closes #144 #145 #160 
Implements PATCH method on user and endpoint middleware for authnz
Implements `reset_password` (with token) and `forgot_password` endpoints
Added godoc comments for UserService interface
Shift to using testify/assert in test code
Multiple fixes/changes to the UserService API
2016-09-15 10:52:17 -04:00

37 lines
717 B
Go

package server
import (
"time"
"github.com/kolide/kolide-ose/kolide"
"golang.org/x/net/context"
)
func (mw loggingMiddleware) Login(ctx context.Context, username, password string) (user *kolide.User, token string, err error) {
defer func(begin time.Time) {
_ = mw.logger.Log(
"method", "Login",
"user", username,
"err", err,
"took", time.Since(begin),
)
}(time.Now())
user, token, err = mw.Service.Login(ctx, username, password)
return
}
func (mw loggingMiddleware) Logout(ctx context.Context) (err error) {
defer func(begin time.Time) {
_ = mw.logger.Log(
"method", "Logout",
"err", err,
"took", time.Since(begin),
)
}(time.Now())
err = mw.Service.Logout(ctx)
return
}