< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.Tokens.RsaSecurityToken
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/RsaSecurityToken.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 12
Coverable lines: 12
Total lines: 54
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(...)100%110%
.ctor(...)0%440%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/RsaSecurityToken.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 System.Security.Cryptography;
 7using CoreWCF.Security;
 8
 9namespace CoreWCF.IdentityModel.Tokens
 10{
 11    internal class RsaSecurityToken : SecurityToken
 12    {
 13        private readonly string _id;
 14        private readonly DateTime _effectiveTime;
 15
 16        public RsaSecurityToken(RSA rsa)
 017            : this(rsa, SecurityUniqueId.Create().Value)
 18        {
 019        }
 20
 021        public RsaSecurityToken(RSA rsa, string id)
 22        {
 023            Rsa = rsa ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(rsa));
 024            _id = id ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(id));
 025            _effectiveTime = DateTime.UtcNow;
 026        }
 27
 28        public override string Id
 29        {
 030            get { return _id; }
 31        }
 32
 33        public override DateTime ValidFrom
 34        {
 035            get { return _effectiveTime; }
 36        }
 37
 38        public override DateTime ValidTo
 39        {
 40            // Never expire
 041            get { return SecurityUtils.MaxUtcDateTime; }
 42        }
 43
 44        public override ReadOnlyCollection<SecurityKey> SecurityKeys
 45        {
 46            get
 47            {
 048                throw new PlatformNotSupportedException("RsaSecurityKey");
 49            }
 50        }
 51
 052        public RSA Rsa { get; }
 53    }
 54}