mirror of
https://github.com/bitwarden/server
synced 2025-12-13 14:53:34 +00:00
[PM-17562] Add HEC integration support (#6010)
* [PM-17562] Add HEC integration support * Re-ordered parameters per PR suggestion * Apply suggestions from code review Co-authored-by: Matt Bishop <mbishop@bitwarden.com> * Refactored webhook request model validation to be more clear --------- Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#nullable enable
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Bit.Core.AdminConsole.Utilities;
|
||||
@@ -19,8 +20,15 @@ public static partial class IntegrationTemplateProcessor
|
||||
return TokenRegex().Replace(template, match =>
|
||||
{
|
||||
var propertyName = match.Groups[1].Value;
|
||||
var property = type.GetProperty(propertyName);
|
||||
return property?.GetValue(values)?.ToString() ?? match.Value;
|
||||
if (propertyName == "EventMessage")
|
||||
{
|
||||
return JsonSerializer.Serialize(values);
|
||||
}
|
||||
else
|
||||
{
|
||||
var property = type.GetProperty(propertyName);
|
||||
return property?.GetValue(values)?.ToString() ?? match.Value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user