< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.SessionDerivedKeySecurityTokenParameters
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/SessionDerivedKeySecurityTokenParameters.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 22
Coverable lines: 22
Total lines: 74
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%
.ctor(...)0%220%
CloneCore()100%110%
CreateKeyIdentifierClause(...)0%220%
MatchesKeyIdentifierClause(...)0%440%
InitializeSecurityTokenRequirement(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/SessionDerivedKeySecurityTokenParameters.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.IdentityModel;
 6using CoreWCF.IdentityModel.Selectors;
 7using CoreWCF.IdentityModel.Tokens;
 8using CoreWCF.Security.Tokens;
 9
 10namespace CoreWCF.Security
 11{
 12    internal class SessionDerivedKeySecurityTokenParameters : SecurityTokenParameters
 13    {
 14        private readonly bool _actAsInitiator;
 015        protected SessionDerivedKeySecurityTokenParameters(SessionDerivedKeySecurityTokenParameters other) : base(other)
 16        {
 017            _actAsInitiator = other._actAsInitiator;
 018        }
 19
 020        public SessionDerivedKeySecurityTokenParameters(bool actAsInitiator) : base()
 21        {
 022            _actAsInitiator = actAsInitiator;
 023            InclusionMode = actAsInitiator ? SecurityTokenInclusionMode.AlwaysToRecipient : SecurityTokenInclusionMode.A
 024            RequireDerivedKeys = false;
 025        }
 26
 027        protected internal override bool SupportsClientAuthentication => false;
 028        protected internal override bool SupportsServerAuthentication => false;
 029        protected internal override bool SupportsClientWindowsIdentity => false;
 30
 031        protected internal override bool HasAsymmetricKey => false;
 32
 33        protected override SecurityTokenParameters CloneCore()
 34        {
 035            return new SessionDerivedKeySecurityTokenParameters(this);
 36        }
 37
 38        protected internal override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityT
 39        {
 040            if (referenceStyle == SecurityTokenReferenceStyle.Internal)
 41            {
 042                return token.CreateKeyIdentifierClause<LocalIdKeyIdentifierClause>();
 43            }
 44            else
 45            {
 046                return null;
 47            }
 48        }
 49
 50        protected internal override bool MatchesKeyIdentifierClause(SecurityToken token, SecurityKeyIdentifierClause key
 51        {
 052            if (referenceStyle == SecurityTokenReferenceStyle.Internal)
 53            {
 054                if (!(keyIdentifierClause is LocalIdKeyIdentifierClause localClause))
 55                {
 056                    return false;
 57                }
 58                else
 59                {
 060                    return (localClause.LocalId == token.Id);
 61                }
 62            }
 63            else
 64            {
 065                return false;
 66            }
 67        }
 68
 69        protected internal override void InitializeSecurityTokenRequirement(SecurityTokenRequirement requirement)
 70        {
 071            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
 72        }
 73    }
 74}