< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.SecurityUtils
Assembly: CoreWCF.Http
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Http/src/CoreWCF/Security/SecurityUtils.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 4
Coverable lines: 4
Total lines: 20
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 Cyclomatic complexity NPath complexity Sequence coverage
ValidateAnonymityConstraint(...)0%440%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Http/src/CoreWCF/Security/SecurityUtils.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Security.Principal;
 5using CoreWCF.IdentityModel.Tokens;
 6
 7namespace CoreWCF.Security
 8{
 9    internal static class SecurityUtils
 10    {
 11        public static void ValidateAnonymityConstraint(WindowsIdentity identity, bool allowUnauthenticatedCallers)
 12        {
 013            if (!allowUnauthenticatedCallers && identity.User.IsWellKnown(WellKnownSidType.AnonymousSid))
 14            {
 015                throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(
 016                    new SecurityTokenValidationException(SR.AnonymousLogonsAreNotAllowed));
 17            }
 018        }
 19    }
 20}