< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.Tokens.DerivedKeySecurityTokenStub
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/Tokens/DerivedKeySecurityTokenStub.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 21
Coverable lines: 21
Total lines: 53
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%
CreateToken(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/Tokens/DerivedKeySecurityTokenStub.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 System.Collections.ObjectModel;
 6using CoreWCF.IdentityModel;
 7using CoreWCF.IdentityModel.Tokens;
 8
 9namespace CoreWCF.Security.Tokens
 10{
 11    internal sealed class DerivedKeySecurityTokenStub : SecurityToken
 12    {
 13        private readonly string _id;
 14        private readonly string _derivationAlgorithm;
 15        private readonly string _label;
 16        private readonly int _length;
 17        private readonly byte[] _nonce;
 18        private readonly int _offset;
 19        private readonly int _generation;
 20
 021        public DerivedKeySecurityTokenStub(int generation, int offset, int length,
 022            string label, byte[] nonce,
 023            SecurityKeyIdentifierClause tokenToDeriveIdentifier, string derivationAlgorithm, string id)
 24        {
 025            _id = id;
 026            _generation = generation;
 027            _offset = offset;
 028            _length = length;
 029            _label = label;
 030            _nonce = nonce;
 031            TokenToDeriveIdentifier = tokenToDeriveIdentifier;
 032            _derivationAlgorithm = derivationAlgorithm;
 033        }
 34
 035        public override string Id => _id;
 36
 037        public override DateTime ValidFrom => throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplement
 38
 039        public override DateTime ValidTo => throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplemented
 40
 041        public override ReadOnlyCollection<SecurityKey> SecurityKeys => null;
 42
 043        public SecurityKeyIdentifierClause TokenToDeriveIdentifier { get; }
 44
 45        public DerivedKeySecurityToken CreateToken(SecurityToken tokenToDerive, int maxKeyLength)
 46        {
 047            DerivedKeySecurityToken result = new DerivedKeySecurityToken(_generation, _offset, _length,
 048                _label, _nonce, tokenToDerive, TokenToDeriveIdentifier, _derivationAlgorithm, Id);
 049            result.InitializeDerivedKey(maxKeyLength);
 050            return result;
 51        }
 52    }
 53}