summaryrefslogtreecommitdiffstats
path: root/routers/web/auth
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/auth')
-rw-r--r--routers/web/auth/auth.go2
-rw-r--r--routers/web/auth/linkaccount.go2
-rw-r--r--routers/web/auth/oauth.go10
-rw-r--r--routers/web/auth/webauthn.go6
4 files changed, 10 insertions, 10 deletions
diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go
index b7a73e4379..8017602d99 100644
--- a/routers/web/auth/auth.go
+++ b/routers/web/auth/auth.go
@@ -243,7 +243,7 @@ func SignInPost(ctx *context.Context) {
}
// Check if the user has webauthn registration
- hasWebAuthnTwofa, err := auth.HasWebAuthnRegistrationsByUID(u.ID)
+ hasWebAuthnTwofa, err := auth.HasWebAuthnRegistrationsByUID(ctx, u.ID)
if err != nil {
ctx.ServerError("UserSignIn", err)
return
diff --git a/routers/web/auth/linkaccount.go b/routers/web/auth/linkaccount.go
index 745b4e818c..c6e3d1231b 100644
--- a/routers/web/auth/linkaccount.go
+++ b/routers/web/auth/linkaccount.go
@@ -185,7 +185,7 @@ func linkAccount(ctx *context.Context, u *user_model.User, gothUser goth.User, r
}
// If WebAuthn is enrolled -> Redirect to WebAuthn instead
- regs, err := auth.GetWebAuthnCredentialsByUID(u.ID)
+ regs, err := auth.GetWebAuthnCredentialsByUID(ctx, u.ID)
if err == nil && len(regs) > 0 {
ctx.Redirect(setting.AppSubURL + "/user/webauthn")
return
diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go
index 640c01e203..40c91b3f85 100644
--- a/routers/web/auth/oauth.go
+++ b/routers/web/auth/oauth.go
@@ -237,7 +237,7 @@ func newAccessTokenResponse(ctx go_context.Context, grant *auth.OAuth2Grant, ser
idToken.EmailVerified = user.IsActive
}
if grant.ScopeContains("groups") {
- groups, err := getOAuthGroupsForUser(user)
+ groups, err := getOAuthGroupsForUser(ctx, user)
if err != nil {
log.Error("Error getting groups: %v", err)
return nil, &AccessTokenError{
@@ -291,7 +291,7 @@ func InfoOAuth(ctx *context.Context) {
Picture: ctx.Doer.AvatarLink(ctx),
}
- groups, err := getOAuthGroupsForUser(ctx.Doer)
+ groups, err := getOAuthGroupsForUser(ctx, ctx.Doer)
if err != nil {
ctx.ServerError("Oauth groups for user", err)
return
@@ -303,8 +303,8 @@ func InfoOAuth(ctx *context.Context) {
// returns a list of "org" and "org:team" strings,
// that the given user is a part of.
-func getOAuthGroupsForUser(user *user_model.User) ([]string, error) {
- orgs, err := org_model.GetUserOrgsList(user)
+func getOAuthGroupsForUser(ctx go_context.Context, user *user_model.User) ([]string, error) {
+ orgs, err := org_model.GetUserOrgsList(ctx, user)
if err != nil {
return nil, fmt.Errorf("GetUserOrgList: %w", err)
}
@@ -1197,7 +1197,7 @@ func handleOAuth2SignIn(ctx *context.Context, source *auth.Source, u *user_model
}
// If WebAuthn is enrolled -> Redirect to WebAuthn instead
- regs, err := auth.GetWebAuthnCredentialsByUID(u.ID)
+ regs, err := auth.GetWebAuthnCredentialsByUID(ctx, u.ID)
if err == nil && len(regs) > 0 {
ctx.Redirect(setting.AppSubURL + "/user/webauthn")
return
diff --git a/routers/web/auth/webauthn.go b/routers/web/auth/webauthn.go
index 013e11eacc..b19e18aa8e 100644
--- a/routers/web/auth/webauthn.go
+++ b/routers/web/auth/webauthn.go
@@ -55,7 +55,7 @@ func WebAuthnLoginAssertion(ctx *context.Context) {
return
}
- exists, err := auth.ExistsWebAuthnCredentialsForUID(user.ID)
+ exists, err := auth.ExistsWebAuthnCredentialsForUID(ctx, user.ID)
if err != nil {
ctx.ServerError("UserSignIn", err)
return
@@ -127,14 +127,14 @@ func WebAuthnLoginAssertionPost(ctx *context.Context) {
}
// Success! Get the credential and update the sign count with the new value we received.
- dbCred, err := auth.GetWebAuthnCredentialByCredID(user.ID, cred.ID)
+ dbCred, err := auth.GetWebAuthnCredentialByCredID(ctx, user.ID, cred.ID)
if err != nil {
ctx.ServerError("GetWebAuthnCredentialByCredID", err)
return
}
dbCred.SignCount = cred.Authenticator.SignCount
- if err := dbCred.UpdateSignCount(); err != nil {
+ if err := dbCred.UpdateSignCount(ctx); err != nil {
ctx.ServerError("UpdateSignCount", err)
return
}