From 2746fdb7b1e7ae5eb52fc49aa98408fd6843e227 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Fri, 2 Sep 2022 12:18:26 -0400 Subject: [PATCH] maintain: remove extra login function --- internal/access/login.go | 12 ------------ internal/server/handlers.go | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 internal/access/login.go diff --git a/internal/access/login.go b/internal/access/login.go deleted file mode 100644 index fc4447e5cf..0000000000 --- a/internal/access/login.go +++ /dev/null @@ -1,12 +0,0 @@ -package access - -import ( - "time" - - "github.com/infrahq/infra/internal/server/authn" -) - -// Login uses a login method to authenticate a user -func Login(c RequestContext, loginMethod authn.LoginMethod, keyExpiresAt time.Time, keyExtension time.Duration) (authn.LoginResult, error) { - return authn.Login(c.Request.Context(), c.DBTxn, loginMethod, keyExpiresAt, keyExtension) -} diff --git a/internal/server/handlers.go b/internal/server/handlers.go index c4c591b3ad..1eb2938c69 100644 --- a/internal/server/handlers.go +++ b/internal/server/handlers.go @@ -186,7 +186,7 @@ func (a *API) Login(c *gin.Context, r *api.LoginRequest) (*api.LoginResponse, er // do the actual login now that we know the method selected expires := time.Now().UTC().Add(a.server.options.SessionDuration) - result, err := access.Login(rCtx, loginMethod, expires, a.server.options.SessionExtensionDeadline) + result, err := authn.Login(rCtx.Request.Context(), rCtx.DBTxn, loginMethod, expires, a.server.options.SessionExtensionDeadline) if err != nil { if errors.Is(err, internal.ErrBadGateway) { // the user should be shown this explicitly