< Summary

Information
Class: Elsa.Extensions.ModuleExtensions
Assembly: Elsa.Identity
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Extensions/ModuleExtensions.cs
Line coverage
33%
Covered lines: 4
Uncovered lines: 8
Coverable lines: 12
Total lines: 44
Line coverage: 33.3%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
UseIdentity(...)100%11100%
UseIdentity(...)0%2040%
UseDefaultAuthentication(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Extensions/ModuleExtensions.cs

#LineLine coverage
 1using Elsa.Features.Services;
 2using Elsa.Identity.Features;
 3
 4// ReSharper disable once CheckNamespace
 5namespace Elsa.Extensions;
 6
 7/// <summary>
 8/// Extensions for <see cref="IModule"/> that installs the <see cref="IdentityFeature"/> feature.
 9/// </summary>
 10public static class ModuleExtensions
 11{
 12    /// <summary>
 13    /// Installs and configures the <see cref="IdentityFeature"/> feature.
 14    /// </summary>
 15    public static IModule UseIdentity(this IModule module, Action<IdentityFeature>? configure = null)
 16    {
 217        module.Configure(configure);
 218        return module;
 19    }
 20
 21    /// <summary>
 22    /// Installs and configures the <see cref="IdentityFeature"/> feature.
 23    /// </summary>
 24    public static IModule UseIdentity(this IModule module, string signingKey, string issuer = "http://elsa.api", string 
 25    {
 026        module.UseIdentity(identity => identity.TokenOptions += options =>
 027        {
 028            options.Audience = audience;
 029            options.Issuer = issuer;
 030            options.AccessTokenLifetime = tokenLifetime ?? TimeSpan.FromHours(1);
 031            options.SigningKey = signingKey;
 032        });
 033        return module;
 34    }
 35
 36    /// <summary>
 37    /// Installs and configures the <see cref="DefaultAuthenticationFeature"/> feature.
 38    /// </summary>
 39    public static IModule UseDefaultAuthentication(this IModule module, Action<DefaultAuthenticationFeature>? configure 
 40    {
 241        module.Configure(configure);
 242        return module;
 43    }
 44}