< Summary

Information
Class: Elsa.ExternalAuthentication.Endpoints.Broker.CompleteLogout
Assembly: Elsa.ExternalAuthentication
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Endpoints/Broker/CompleteLogout.cs
Line coverage
81%
Covered lines: 9
Uncovered lines: 2
Coverable lines: 11
Total lines: 36
Line coverage: 81.8%
Branch coverage
50%
Covered branches: 5
Total branches: 10
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%
Configure()100%11100%
HandleAsync()50%141066.66%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Endpoints/Broker/CompleteLogout.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.ExternalAuthentication.Constants;
 3using Elsa.ExternalAuthentication.Services;
 4using FastEndpoints;
 5using Microsoft.AspNetCore.Builder;
 6using Microsoft.AspNetCore.RateLimiting;
 7
 8namespace Elsa.ExternalAuthentication.Endpoints.Broker;
 9
 710internal sealed class CompleteLogout(IExternalAuthenticationBroker broker) : ElsaEndpoint<CompleteLogoutRequest>
 11{
 12    public override void Configure()
 13    {
 614        Get("/external-authentication/logout/callback/{connectionKey}");
 615        AllowAnonymous();
 1216        Options(x => x.RequireRateLimiting(ExternalAuthenticationRateLimitPolicyNames.ProviderCallback));
 617    }
 18
 19    public override async Task HandleAsync(CompleteLogoutRequest request, CancellationToken cancellationToken)
 20    {
 121        var result = await broker.CompleteLogoutAsync(Route<string>("connectionKey") ?? request.ConnectionKey ?? string.
 122        if (result.Error is { } error)
 23        {
 024            await BrokerEndpointSupport.SendErrorAsync(Send, error, cancellationToken);
 025            return;
 26        }
 27
 128        await Send.RedirectAsync(result.RedirectUri!.ToString(), false, true);
 129    }
 30}
 31
 32internal sealed class CompleteLogoutRequest
 33{
 34    public string? ConnectionKey { get; set; }
 35    public string? State { get; set; }
 36}