feat: add im auth verification flows
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user