mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
37 lines
721 B
Go
37 lines
721 B
Go
package service
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/kolide/kolide/server/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
|
|
}
|