diff options
Diffstat (limited to 'internal/api/client/auth/middleware.go')
-rw-r--r-- | internal/api/client/auth/middleware.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/api/client/auth/middleware.go b/internal/api/client/auth/middleware.go index a734b2ceb..3599c7048 100644 --- a/internal/api/client/auth/middleware.go +++ b/internal/api/client/auth/middleware.go @@ -49,15 +49,15 @@ func (m *Module) OauthTokenMiddleware(c *gin.Context) { // fetch user's and account for this user id user := >smodel.User{} - if err := m.db.GetByID(uid, user); err != nil || user == nil { + if err := m.db.GetByID(c.Request.Context(), uid, user); err != nil || user == nil { l.Warnf("no user found for validated uid %s", uid) return } c.Set(oauth.SessionAuthorizedUser, user) l.Tracef("set gin context %s to %+v", oauth.SessionAuthorizedUser, user) - acct := >smodel.Account{} - if err := m.db.GetByID(user.AccountID, acct); err != nil || acct == nil { + acct, err := m.db.GetAccountByID(c.Request.Context(), user.AccountID) + if err != nil || acct == nil { l.Warnf("no account found for validated user %s", uid) return } @@ -69,7 +69,7 @@ func (m *Module) OauthTokenMiddleware(c *gin.Context) { if cid := ti.GetClientID(); cid != "" { l.Tracef("authenticated client %s with bearer token, scope is %s", cid, ti.GetScope()) app := >smodel.Application{} - if err := m.db.GetWhere([]db.Where{{Key: "client_id", Value: cid}}, app); err != nil { + if err := m.db.GetWhere(c.Request.Context(), []db.Where{{Key: "client_id", Value: cid}}, app); err != nil { l.Tracef("no app found for client %s", cid) } c.Set(oauth.SessionAuthorizedApplication, app) |