< Summary

Information
Class: Elsa.ExternalAuthentication.Services.ExternalAuthenticationSecurityNotifier
Assembly: Elsa.ExternalAuthentication
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Services/ExternalAuthenticationSecurityNotifier.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 31
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
PublishAsync(...)50%22100%
Context(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Services/ExternalAuthenticationSecurityNotifier.cs

#LineLine coverage
 1using Elsa.ExternalAuthentication.Notifications;
 2using Elsa.Mediator.Contracts;
 3using Microsoft.Extensions.DependencyInjection;
 4
 5namespace Elsa.ExternalAuthentication.Services;
 6
 7/// <summary>Publishes redacted security events after the caller has committed its state change.</summary>
 118public sealed class ExternalAuthenticationSecurityNotifier(IServiceProvider services)
 9{
 10    public ValueTask PublishAsync(INotification notification, CancellationToken cancellationToken = default)
 11    {
 312        var sender = services.GetService<INotificationSender>();
 313        return sender is null ? ValueTask.CompletedTask : new ValueTask(sender.SendAsync(notification, cancellationToken
 14    }
 15
 16    public static SecurityEventContext Context(
 17        string? actorId,
 18        string? tenantId,
 19        string? connectionId,
 20        string? userId,
 21        SecurityEventOutcome outcome,
 322        string summary) => new(
 323        actorId,
 324        tenantId,
 325        connectionId,
 326        userId,
 327        DateTimeOffset.UtcNow,
 328        outcome,
 329        Guid.NewGuid().ToString("N"),
 330        summary);
 31}