From 213a7db6613621fc94c7c1ab5407650a13ad8e32 Mon Sep 17 00:00:00 2001 From: branchmispredictor Date: Tue, 18 May 2021 18:30:00 -0400 Subject: [PATCH] fix --- pkg/modules/auth/auth.go | 4 ++-- pkg/modules/auth/identityawareproxy/identityawareproxy.go | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/modules/auth/auth.go b/pkg/modules/auth/auth.go index f1ff312654..09286daf29 100644 --- a/pkg/modules/auth/auth.go +++ b/pkg/modules/auth/auth.go @@ -228,8 +228,8 @@ func RenewToken(s *xorm.Session, c echo.Context) (token string, err error) { } return NewUserJWTAuthtoken(u) } - if authProvider, ok := authProviders[claims.Type]; ok { - return "", echo.NewHTTPError(http.StatusBadRequest, models.Message{Message: "External auth types do not use JWT tokens."} + if _, ok := authProviders[claims.Type]; ok { + return "", echo.NewHTTPError(http.StatusBadRequest, models.Message{Message: "External auth types do not use JWT tokens."}) } return "", echo.NewHTTPError(http.StatusBadRequest, models.Message{Message: "Invalid JWT token."}) } diff --git a/pkg/modules/auth/identityawareproxy/identityawareproxy.go b/pkg/modules/auth/identityawareproxy/identityawareproxy.go index 3c1dac16a0..de6ba50c07 100644 --- a/pkg/modules/auth/identityawareproxy/identityawareproxy.go +++ b/pkg/modules/auth/identityawareproxy/identityawareproxy.go @@ -21,8 +21,6 @@ import ( "time" "code.vikunja.io/api/pkg/db" - - "code.vikunja.io/api/pkg/config" "code.vikunja.io/api/pkg/modules/auth" "code.vikunja.io/api/pkg/user" "github.com/dgrijalva/jwt-go" @@ -83,7 +81,7 @@ func newIAPUserJWTAuthClaims(u *user.User) (claims *auth.AuthClaims) { func (p IAPAuthProvider) GetUser(c echo.Context, authClaims *auth.AuthClaims) (*user.User, error) { // The IAP middleware already checked and created a user if needed, no need to regenerate them // Just use the authClaims provided by the middleware - u = &user.User{ + u := &user.User{ ID: authClaims.UserID, Email: authClaims.UserEmail, Username: authClaims.UserUsername,