< Summary

Information
Class: Elsa.ExternalAuthentication.Permissions.BuiltInPermissionGrantSourceDescriptors
Assembly: Elsa.ExternalAuthentication
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Permissions/BuiltInPermissionGrantSourceDescriptors.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 47
Coverable lines: 47
Total lines: 60
Line coverage: 0%
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
Mapping(...)100%210%
PassThrough()100%210%
Field(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.ExternalAuthentication/Permissions/BuiltInPermissionGrantSourceDescriptors.cs

#LineLine coverage
 1using System.Text.Json;
 2using Elsa.ExternalAuthentication.Models;
 3
 4namespace Elsa.ExternalAuthentication.Permissions;
 5
 6internal static class BuiltInPermissionGrantSourceDescriptors
 7{
 8    public static IReadOnlyList<SettingFieldDescriptor> Mapping(string defaultClaimType) =>
 09    [
 010        Field(
 011            "claimType",
 012            "Projected claim type",
 013            "The normalized projected claim whose values are matched.",
 014            "string",
 015            "text",
 016            JsonSerializer.SerializeToElement(defaultClaimType)),
 017        Field(
 018            "mappings",
 019            "Claim value mappings",
 020            "A JSON object or array mapping explicit claim values to arrays of Elsa permission strings.",
 021            "json",
 022            "json",
 023            JsonSerializer.SerializeToElement(Array.Empty<object>()))
 024    ];
 25
 26    public static IReadOnlyList<SettingFieldDescriptor> PassThrough() =>
 027    [
 028        Field(
 029            "claimType",
 030            "Projected permission claim type",
 031            "The normalized projected claim containing candidate Elsa permission strings.",
 032            "string",
 033            "text",
 034            JsonSerializer.SerializeToElement("permissions")),
 035        Field(
 036            "allowedPermissions",
 037            "Allowed permission boundary",
 038            "Only these exact permission strings may pass through from the projected claim.",
 039            "string-array",
 040            "string-array",
 041            JsonSerializer.SerializeToElement(Array.Empty<string>()))
 042    ];
 43
 44    private static SettingFieldDescriptor Field(string name, string displayName, string description, string valueType, s
 045        new(
 046            name,
 047            displayName,
 048            description,
 049            valueType,
 050            true,
 051            uiHint,
 052            defaultValue,
 053            [],
 054            new SettingFieldValidation(MaximumLength: 16_384),
 055            false,
 056            false,
 057            null,
 058            null,
 059            false);
 60}