< Summary

Information
Class: Elsa.SasTokens.Features.SasTokensFeature
Assembly: Elsa.SasTokens
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.SasTokens/Features/SasTokensFeature.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 35
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
.ctor(...)100%11100%
get_ConfigureDataProtectionBuilder()100%11100%
get_TokenService()100%11100%
Apply()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.SasTokens/Features/SasTokensFeature.cs

#LineLine coverage
 1using Elsa.Features.Abstractions;
 2using Elsa.Features.Services;
 3using Elsa.SasTokens.Contracts;
 4using Microsoft.AspNetCore.DataProtection;
 5using Microsoft.Extensions.DependencyInjection;
 6
 7namespace Elsa.SasTokens.Features;
 8
 9/// <summary>
 10/// Adds the SAS tokens feature to the workflow runtime.
 11/// </summary>
 12/// <inheritdoc />
 113public class SasTokensFeature(IModule module) : FeatureBase(module)
 14{
 15    /// <summary>
 16    /// Configures the <see cref="IDataProtectionBuilder"/> used for setting up data protection.
 17    /// Defaults to setting the application name to "Elsa Workflows".
 18    /// </summary>
 419    public Action<IDataProtectionBuilder> ConfigureDataProtectionBuilder { get; set; } = b => { b.SetApplicationName("El
 20
 21    /// <summary>
 22    /// Factory method to create an instance of <see cref="ITokenService"/>.
 23    /// Defaults to creating a <see cref="DataProtectorTokenService"/> using dependency injection.
 24    /// </summary>
 325    public Func<IServiceProvider, ITokenService> TokenService { get; set; } = sp => ActivatorUtilities.CreateInstance<Da
 26
 27    /// <inheritdoc />
 28    public override void Apply()
 29    {
 130        var builder = Services.AddDataProtection();
 131        ConfigureDataProtectionBuilder(builder);
 32
 133        Services.AddScoped(TokenService);
 134    }
 35}