generateSessionID 生成会话ID
(userID, ipAddress, userAgent string)
| 971 | |
| 972 | // generateSessionID 生成会话ID |
| 973 | func (ac *AccessController) generateSessionID(userID, ipAddress, userAgent string) string { |
| 974 | data := fmt.Sprintf("%s:%s:%s:%d", userID, ipAddress, userAgent, time.Now().UnixNano()) |
| 975 | hash := sha256.Sum256([]byte(data)) |
| 976 | return hex.EncodeToString(hash[:]) |
| 977 | } |
| 978 | |
| 979 | // generateCacheKey 生成缓存键 |
| 980 | func (ac *AccessController) generateCacheKey(userID, resource, action string, context map[string]any) string { |