< Summary

Information
Class: Elsa.Server.Web.Filters.HttpRequestAuthenticationHeaderFilter
Assembly: Elsa.Server.Web
File(s): /home/runner/work/elsa-core/elsa-core/src/apps/Elsa.Server.Web/Filters/HttpRequestAuthenticationHeaderFilter.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 10
Coverable lines: 10
Total lines: 30
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
OnExecute(...)0%4260%

File(s)

/home/runner/work/elsa-core/elsa-core/src/apps/Elsa.Server.Web/Filters/HttpRequestAuthenticationHeaderFilter.cs

#LineLine coverage
 1using Elsa.Http;
 2using Elsa.Workflows;
 3using JetBrains.Annotations;
 4
 5namespace Elsa.Server.Web.Filters;
 6
 7/// <summary>
 8/// Mask the value of the input if it is a HttpRequest and the input name is "Authorization".
 9/// </summary>
 10[UsedImplicitly]
 11public class HttpRequestAuthenticationHeaderFilter : ActivityStateFilterBase
 12{
 13    protected override ActivityStateFilterResult OnExecute(ActivityStateFilterContext context)
 14    {
 015        var activityExecutionContext = context.ActivityExecutionContext;
 016        var activity = activityExecutionContext.Activity;
 017        var inputDescriptor = context.InputDescriptor;
 18
 019        if (activity is not SendHttpRequestBase || inputDescriptor.Name is not nameof(SendHttpRequestBase.Authorization)
 020            return ActivityStateFilterResult.Pass();
 21
 022        var contextValue = context.Value.GetString();
 23
 024        if (contextValue == null)
 025            return ActivityStateFilterResult.Pass();
 26
 027        var maskedValue = new string('*', contextValue.Length);
 028        return Filtered(maskedValue);
 29    }
 30}