< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.AuthenticationSchemesHelper
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Channels/AuthenticationSchemesHelper.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 71
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 10
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
IsSingleton(...)0%10100%
IsSet(...)100%110%
IsNotSet(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Channels/AuthenticationSchemesHelper.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.Net;
 5
 6namespace CoreWCF.Channels
 7{
 8    internal static class AuthenticationSchemesHelper
 9    {
 10        //public static bool DoesAuthTypeMatch(AuthenticationSchemes authScheme, string authType)
 11        //{
 12        //    if ((authType == null) || (authType.Length == 0))
 13        //    {
 14        //        return authScheme.IsSet(AuthenticationSchemes.Anonymous);
 15        //    }
 16
 17        //    if (authType.Equals("kerberos", StringComparison.OrdinalIgnoreCase) ||
 18        //        authType.Equals("negotiate", StringComparison.OrdinalIgnoreCase))
 19        //    {
 20        //        return authScheme.IsSet(AuthenticationSchemes.Negotiate);
 21        //    }
 22        //    else if (authType.Equals("ntlm", StringComparison.OrdinalIgnoreCase))
 23        //    {
 24        //        return authScheme.IsSet(AuthenticationSchemes.Negotiate) ||
 25        //            authScheme.IsSet(AuthenticationSchemes.Ntlm);
 26        //    }
 27
 28        //    AuthenticationSchemes authTypeScheme;
 29        //    if (!Enum.TryParse<AuthenticationSchemes>(authType, true, out authTypeScheme))
 30        //    {
 31        //        return false;
 32        //    }
 33
 34        //    return authScheme.IsSet(authTypeScheme);
 35        //}
 36
 37        public static bool IsSingleton(this AuthenticationSchemes v)
 38        {
 39            bool result;
 40            switch (v)
 41            {
 42                case AuthenticationSchemes.Digest:
 43                case AuthenticationSchemes.Negotiate:
 44                case AuthenticationSchemes.Ntlm:
 45                case AuthenticationSchemes.Basic:
 46                case AuthenticationSchemes.Anonymous:
 047                    result = true;
 048                    break;
 49                default:
 050                    result = false;
 51                    break;
 52            }
 053            return result;
 54        }
 55
 56        public static bool IsSet(this AuthenticationSchemes thisPtr, AuthenticationSchemes authenticationSchemes)
 57        {
 058            return (thisPtr & authenticationSchemes) == authenticationSchemes;
 59        }
 60
 61        public static bool IsNotSet(this AuthenticationSchemes thisPtr, AuthenticationSchemes authenticationSchemes)
 62        {
 063            return (thisPtr & authenticationSchemes) == 0;
 64        }
 65
 66        //internal static string ToString(AuthenticationSchemes authScheme)
 67        //{
 68        //    return authScheme.ToString().ToLowerInvariant();
 69        //}
 70    }
 71}