using Elsa.Features.Abstractions; using Elsa.Features.Services; using Elsa.SasTokens.Contracts; using Microsoft.AspNetCore.DataProtection; using Microsoft.Extensions.DependencyInjection; namespace Elsa.SasTokens.Features; /// /// Adds the SAS tokens feature to the workflow runtime. /// /// public class SasTokensFeature(IModule module) : FeatureBase(module) { /// /// Configures the used for setting up data protection. /// Defaults to setting the application name to "Elsa Workflows". /// public Action ConfigureDataProtectionBuilder { get; set; } = b => { b.SetApplicationName("Elsa Workflows"); }; /// /// Factory method to create an instance of . /// Defaults to creating a using dependency injection. /// public Func TokenService { get; set; } = sp => ActivatorUtilities.CreateInstance(sp); /// public override void Apply() { var builder = Services.AddDataProtection(); ConfigureDataProtectionBuilder(builder); Services.AddScoped(TokenService); } }