private int GetUserId() { try { var authHeader = HttpContext.Request.Headers["Authorization"][0].Split(' ')[1]; if (string.IsNullOrEmpty(authHeader)) { throw new UnauthorizedException(); } return(_encryptor.DecryptData(authHeader)); } catch { throw new UnauthorizedException(); } }