< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.Tokens.EndpointAuthorizationPolicy
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/EndpointAuthorizationPolicy.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 57
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
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%
CoreWCF.IdentityModel.Policy.IAuthorizationPolicy.Evaluate(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/EndpointAuthorizationPolicy.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.Claims;
 5using CoreWCF.IdentityModel.Policy;
 6
 7namespace CoreWCF.IdentityModel.Tokens
 8{
 9    /// <summary>
 10    /// Implementation of IAuthorizationPolicy that contains endpoint specific
 11    /// AuthorizationPolicy.
 12    /// </summary>
 13    internal class EndpointAuthorizationPolicy : IAuthorizationPolicy
 14    {
 015        private readonly string _id = IdentityModelUniqueId.CreateUniqueId();
 16
 17        /// <summary>
 18        /// Creates an instance of <see cref="EndpointAuthorizationPolicy"/>
 19        /// </summary>
 20        /// <param name="endpointId">Identifier of the Endpoint to which the token should be restricted.</param>
 021        public EndpointAuthorizationPolicy( string endpointId )
 22        {
 023            EndpointId = endpointId ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpointI
 024        }
 25
 26        /// <summary>
 27        /// Gets the EndpointId for the AuthorizationPolicy
 28        /// </summary>
 029        public string EndpointId { get; }
 30
 31        #region IAuthorizationPolicy Members
 32
 33        /// <summary>
 34        /// Check if the claims in the EvaluationContext.
 35        /// </summary>
 36        /// <param name="evaluationContext">The current evaluationContext</param>
 37        /// <param name="state">Any custom state.</param>
 38        /// <returns>Returns true by default.</returns>
 039        bool IAuthorizationPolicy.Evaluate(EvaluationContext evaluationContext, ref object state) => true;
 40
 41        /// <summary>
 42        /// Gets the Issuer ClaimSet. Returns null by default.
 43        /// </summary>
 044        ClaimSet IAuthorizationPolicy.Issuer => null;
 45
 46        #endregion
 47
 48        #region IAuthorizationComponent Members
 49
 50        /// <summary>
 51        /// Gets the Id.
 52        /// </summary>
 053        string IAuthorizationComponent.Id => _id;
 54        #endregion
 55    }
 56
 57}