< Summary

Information
Class: Elsa.Identity.Multitenancy.ClaimsTenantResolver
Assembly: Elsa.Identity
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Multitenancy/ClaimsTenantResolver.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 24
Line coverage: 0%
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
.ctor(...)100%210%
Resolve(...)0%2040%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Identity/Multitenancy/ClaimsTenantResolver.cs

#LineLine coverage
 1using Elsa.Common.Multitenancy;
 2using Elsa.Identity.Options;
 3using Microsoft.AspNetCore.Http;
 4using Microsoft.Extensions.Options;
 5
 6namespace Elsa.Identity.Multitenancy;
 7
 8/// <summary>
 9/// Resolves the tenant from the user's claims.
 10/// </summary>
 011public class ClaimsTenantResolver(IHttpContextAccessor httpContextAccessor, IOptions<IdentityTokenOptions> options) : Te
 12{
 13    /// <inheritdoc />
 14    protected override TenantResolverResult Resolve(TenantResolverContext context)
 15    {
 016        var httpContext = httpContextAccessor.HttpContext;
 17
 018        if (httpContext == null)
 019            return Unresolved();
 20
 021        var tenantId = httpContext.User.FindFirst(options.Value.TenantIdClaimsType)?.Value;
 022        return AutoResolve(tenantId);
 23    }
 24}