< Summary

Information
Class: Elsa.ExternalAuthentication.Endpoints.Broker.CompleteCallbackRequest
Assembly: Elsa.ExternalAuthentication
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Endpoints/Broker/CompleteCallback.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 43
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ConnectionKey()100%11100%
get_State()100%11100%

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.ExternalAuthentication.Constants;
 3using Elsa.ExternalAuthentication.Models;
 4using Elsa.ExternalAuthentication.Services;
 5using FastEndpoints;
 6using Microsoft.AspNetCore.Builder;
 7using Microsoft.AspNetCore.RateLimiting;
 8
 9namespace Elsa.ExternalAuthentication.Endpoints.Broker;
 10
 11internal sealed class CompleteCallback(IExternalAuthenticationBroker broker) : ElsaEndpoint<CompleteCallbackRequest>
 12{
 13    public override void Configure()
 14    {
 15        Get("/external-authentication/callback/{connectionKey}");
 16        AllowAnonymous();
 17        Options(x => x.RequireRateLimiting(ExternalAuthenticationRateLimitPolicyNames.ProviderCallback));
 18    }
 19
 20    public override async Task HandleAsync(CompleteCallbackRequest request, CancellationToken cancellationToken)
 21    {
 22        var parameters = HttpContext.Request.Query.ToDictionary(x => x.Key, x => (IReadOnlyCollection<string>)x.Value.Wh
 23        var result = await broker.CompleteCallbackAsync(Route<string>("connectionKey") ?? request.ConnectionKey ?? strin
 24        if (result.Error is { } error)
 25        {
 26            if (result.RedirectUri is not null)
 27            {
 28                await Send.RedirectAsync(result.RedirectUri.ToString(), false, true);
 29                return;
 30            }
 31            await BrokerEndpointSupport.SendErrorAsync(Send, error, cancellationToken);
 32            return;
 33        }
 34
 35        await Send.RedirectAsync(result.RedirectUri!.ToString(), false, true);
 36    }
 37}
 38
 39internal sealed class CompleteCallbackRequest
 40{
 141    public string? ConnectionKey { get; set; }
 142    public string? State { get; set; }
 43}

Methods/Properties

get_ConnectionKey()
get_State()