< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.Protocols.WSTrust.RequestedProofToken
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/RequestedProofToken.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 18
Coverable lines: 18
Total lines: 80
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
.ctor(...)0%220%
.ctor(...)100%110%
.ctor(...)100%110%
.ctor(...)0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/RequestedProofToken.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 CoreWCF.IdentityModel.Tokens;
 5
 6namespace CoreWCF.IdentityModel.Protocols.WSTrust
 7{
 8    /// <summary>
 9    /// The content of a RequestedProofToken element could be EncryptedSecurityToken which means that EncryptedKey is us
 10    /// under the RequestedProofToken. If the security token is a regular token, such as a SCT,
 11    /// then its session key will be the material which gets encrypted.  Another possibility is where
 12    /// we use combined entropy, then RequestedProofToken will only contain a ComputedKey element.
 13    /// </summary>
 14    public class RequestedProofToken
 15    {
 16        /// <summary>
 17        /// In case of combined entropy, construct a requestedprooftoken
 18        /// instance with computed key algorithm to specify the algorithm used to
 19        /// calculate the session key.
 20        /// </summary>
 21        /// <param name="computedKeyAlgorithm">The algorithm used to computed the session key in
 22        /// the combined entropy case.</param>
 23        public RequestedProofToken(string computedKeyAlgorithm)
 024            : base()
 25        {
 026            if (string.IsNullOrEmpty(computedKeyAlgorithm))
 27            {
 028                DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(computedKeyAlgorithm));
 29            }
 30
 031            ComputedKeyAlgorithm = computedKeyAlgorithm;
 032        }
 33
 34        /// <summary>
 35        /// When the requested proof token contains real key in plain text.
 36        /// </summary>
 37        /// <param name="secret">The key material.</param>
 038        public RequestedProofToken(byte[] secret)
 39        {
 040            ProtectedKey = new ProtectedKey(secret);
 041        }
 42
 43        /// <summary>
 44        /// When the requested proof token contains real key encrypted.
 45        /// </summary>
 46        /// <param name="secret">The key material.</param>
 47        /// <param name="wrappingCredentials">The encrypting credentials to encrypt the key material.</param>
 048        public RequestedProofToken(byte[] secret, EncryptingCredentials wrappingCredentials)
 49        {
 050            ProtectedKey = new ProtectedKey(secret, wrappingCredentials);
 051        }
 52
 53        /// <summary>
 54        /// Constructs a requested proof token instance with the protected key.
 55        /// </summary>
 56        /// <param name="protectedKey">The protected key which can be either binary secret or encrypted key.</param>
 057        public RequestedProofToken(ProtectedKey protectedKey)
 58        {
 059            if (protectedKey == null)
 60            {
 061                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(protectedKey));
 62            }
 63
 064            ProtectedKey = protectedKey;
 065        }
 66
 67        /// <summary>
 68        /// Gets the computed key algorithm used to calculate the session key in the combined
 69        /// entropy case.
 70        /// </summary>
 071        public string ComputedKeyAlgorithm { get; }
 72
 73        /// <summary>
 74        /// In the case when the requested proof token contains the real key,
 75        /// ProtectedKey getter will returns the real key bytes either encrypted
 76        /// or plaintext.
 77        /// </summary>
 078        public ProtectedKey ProtectedKey { get; }
 79    }
 80}