< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.Selectors.UserNameSecurityTokenAuthenticator
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Selectors/UserNameSecurityTokenAuthenticator.cs
Line coverage
71%
Covered lines: 5
Uncovered lines: 2
Coverable lines: 7
Total lines: 37
Line coverage: 71.4%
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%11100%
CanValidateTokenCore(...)100%11100%
ValidateTokenCoreAsync(...)100%11100%
ValidateUserNamePasswordCore(...)100%110%
ValidateUserNamePasswordCoreAsync(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Selectors/UserNameSecurityTokenAuthenticator.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.Threading.Tasks;
 7using CoreWCF.IdentityModel.Policy;
 8using CoreWCF.IdentityModel.Tokens;
 9
 10namespace CoreWCF.IdentityModel.Selectors
 11{
 12    public abstract class UserNameSecurityTokenAuthenticator : SecurityTokenAuthenticator
 13    {
 1914        protected UserNameSecurityTokenAuthenticator()
 15        {
 1916        }
 17
 3618        protected override bool CanValidateTokenCore(SecurityToken token) => token is UserNameSecurityToken;
 19
 20        protected override ValueTask<ReadOnlyCollection<IAuthorizationPolicy>> ValidateTokenCoreAsync(SecurityToken toke
 21        {
 1822            UserNameSecurityToken userNameToken = (UserNameSecurityToken)token;
 1823            return ValidateUserNamePasswordCoreAsync(userNameToken.UserName, userNameToken.Password);
 24        }
 25
 26        [Obsolete("Implementers should override ValidateUserNamePasswordCoreAsync.")]
 027        protected virtual ReadOnlyCollection<IAuthorizationPolicy> ValidateUserNamePasswordCore(string userName, string 
 28
 29        protected virtual ValueTask<ReadOnlyCollection<IAuthorizationPolicy>> ValidateUserNamePasswordCoreAsync(string u
 30        {
 31            // Default to calling sync implementation to support existing derived types which haven't overridden this me
 32#pragma warning disable CS0618 // Type or member is obsolete
 033            return new ValueTask<ReadOnlyCollection<IAuthorizationPolicy>>(ValidateUserNamePasswordCore(userName, passwo
 34#pragma warning restore CS0618 // Type or member is obsolete
 35        }
 36    }
 37}