feat: add im auth verification flows

This commit is contained in:
richjohnrambo
2026-08-12 00:20:27 +08:00
parent 1ffcb85bee
commit d239e37f56
16 changed files with 2030 additions and 22 deletions
+12
View File
@@ -1175,6 +1175,18 @@ func (s *Session) onLogin(msgID string, timestamp time.Time, rec *auth.Rec, miss
// Check if the token is suitable for session authentication.
if features&auth.FeatureNoLogin == 0 {
if store.Security == nil {
logs.Warn.Println("s.onLogin: user security store is unavailable", s.sid)
reply = decodeStoreError(types.ErrInternal, msgID, timestamp, nil)
return reply
}
authVersion, err := store.Security.GetAuthVersion(s.tenantID, rec.Uid)
if err != nil {
logs.Warn.Println("s.onLogin: failed to read auth version", rec.Uid, err, s.sid)
reply = decodeStoreError(err, msgID, timestamp, nil)
return reply
}
rec.AuthVersion = authVersion
// Authenticate the session.
s.uid = rec.Uid
s.authLvl = rec.AuthLevel