< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.WebHttpSecurity
Assembly: CoreWCF.WebHttp
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/WebHttpSecurity.cs
Line coverage
95%
Covered lines: 22
Uncovered lines: 1
Coverable lines: 23
Total lines: 68
Line coverage: 95.6%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
DisableTransportAuthentication(...)100%11100%
EnableTransportAuthentication(...)100%11100%
EnableTransportSecurity(...)100%11100%
ApplyAuthorizationPolicySupport(...)50%22100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/WebHttpSecurity.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;
 5using CoreWCF.Channels;
 6
 7namespace CoreWCF
 8{
 9    public sealed class WebHttpSecurity
 10    {
 11        internal const WebHttpSecurityMode DefaultMode = WebHttpSecurityMode.None;
 12        private WebHttpSecurityMode _mode;
 13        private HttpTransportSecurity _transportSecurity;
 14
 4515        public WebHttpSecurity()
 16        {
 4517            _transportSecurity = new HttpTransportSecurity();
 4518        }
 19
 20        public WebHttpSecurityMode Mode
 21        {
 153422            get { return _mode; }
 23            set
 24            {
 1125                if (!WebHttpSecurityModeHelper.IsDefined(value))
 26                {
 027                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 28                }
 29
 1130                _mode = value;
 1131                IsModeSet = true;
 1132            }
 33        }
 34
 1135        internal bool IsModeSet { get; private set; }
 36
 37        public HttpTransportSecurity Transport
 38        {
 155639            get { return _transportSecurity; }
 40            set
 41            {
 642                _transportSecurity = (value == null) ? new HttpTransportSecurity() : value;
 643            }
 44        }
 45
 46        internal void DisableTransportAuthentication(HttpTransportBindingElement http)
 47        {
 63148            HttpTransportHelpers.DisableTransportAuthentication(http);
 63149        }
 50
 51        internal void EnableTransportAuthentication(HttpTransportBindingElement http)
 52        {
 12453            HttpTransportHelpers.ConfigureTransportAuthentication(http, _transportSecurity);
 12454        }
 55
 56        internal void EnableTransportSecurity(HttpsTransportBindingElement https)
 57        {
 2258            HttpTransportHelpers.ConfigureTransportProtectionAndAuthentication(https, _transportSecurity);
 2259        }
 60
 61        internal void ApplyAuthorizationPolicySupport(HttpTransportBindingElement httpTransport)
 62        {
 77763            httpTransport.AlwaysUseAuthorizationPolicySupport =
 77764                Transport.AlwaysUseAuthorizationPolicySupport
 77765                || Transport.ClientCredentialType == HttpClientCredentialType.InheritedFromHost;
 77766        }
 67    }
 68}