当前位置: 首页>>代码示例>>C#>>正文


C# ClaimSet.FindClaims方法代码示例

本文整理汇总了C#中ClaimSet.FindClaims方法的典型用法代码示例。如果您正苦于以下问题:C# ClaimSet.FindClaims方法的具体用法?C# ClaimSet.FindClaims怎么用?C# ClaimSet.FindClaims使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClaimSet的用法示例。


在下文中一共展示了ClaimSet.FindClaims方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryGetStringClaimValue

 bool TryGetStringClaimValue(ClaimSet claimSet, string claimType, out string claimValue)
 {
     claimValue = null;
     IEnumerable<Claim> matchingClaims = claimSet.FindClaims(claimType, Rights.PossessProperty);
     if (matchingClaims == null)
         return false;
     IEnumerator<Claim> enumerator = matchingClaims.GetEnumerator();
     enumerator.MoveNext();
     claimValue = (enumerator.Current.Resource == null) ? null : enumerator.Current.Resource.ToString();
     return true;
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:11,代码来源:service.cs

示例2: CheckDnsEquivalence

 internal Claim CheckDnsEquivalence(ClaimSet claimSet, string expectedSpn)
 {
     // host/<machine-name> satisfies the DNS identity claim
     IEnumerable<Claim> claims = claimSet.FindClaims(ClaimTypes.Spn, Rights.PossessProperty);
     foreach (Claim claim in claims)
     {
         if (expectedSpn.Equals((string)claim.Resource, StringComparison.OrdinalIgnoreCase))
         {
             return claim;
         }
     }
     return null;
 }
开发者ID:TerabyteX,项目名称:wcf,代码行数:13,代码来源:IdentityVerifier.cs

示例3: GetUniqueRsaClaim

		/// <summary>
		/// Gets the Unique RSA Claim from the SAML token.
		/// </summary>
		/// <param name="cs">the claimset which contains the claim</param>
		/// <returns>a RSA claim</returns>
		private static Claim GetUniqueRsaClaim(ClaimSet cs) {
			Requires.NotNull(cs, "cs");

			Claim rsa = null;

			foreach (Claim c in cs.FindClaims(ClaimTypes.Rsa, Rights.PossessProperty)) {
				if (null == rsa) {
					rsa = c;
				} else if (!rsa.Equals(c)) {
					// Found two non-equal RSA claims
					return null;
				}
			}
			return rsa;
		}
开发者ID:SachiraChin,项目名称:dotnetopenid,代码行数:20,代码来源:TokenUtility.cs

示例4: CreateIdentityFromClaimSet

 /// <summary>
 /// Utility function to create an EndpointIdentity from a ClaimSet
 /// </summary>
 /// <param name="claims">Claims to create the EndpointIdentity with</param>
 /// <returns>An EndpointIdentity</returns>
 private EndpointIdentity CreateIdentityFromClaimSet(ClaimSet claims)
 {
     foreach (Claim claim in claims.FindClaims(null, Rights.Identity))
     {
         return EndpointIdentity.CreateIdentity(claim);
     }
     return null;
 }
开发者ID:ssickles,项目名称:archive,代码行数:13,代码来源:TokenProcessor.cs

示例5: GetUniqueRsaClaim

        /// <summary>
        /// Gets the Unique RSA Claim from the SAML token.
        /// </summary>
        /// <param name="cs">the claimset which contains the claim</param>
        /// <returns>a RSA claim</returns>
        private static Claim GetUniqueRsaClaim(ClaimSet cs)
        {
            Contract.Requires(cs != null);
            ErrorUtilities.VerifyArgumentNotNull(cs, "cs");

            Claim rsa = null;

            foreach (Claim c in cs.FindClaims(ClaimTypes.Rsa, Rights.PossessProperty)) {
                if (null == rsa) {
                    rsa = c;
                } else if (!rsa.Equals(c)) {
                    // Found two non-equal RSA claims
                    return null;
                }
            }
            return rsa;
        }
开发者ID:jcp-xx,项目名称:dotnetopenid,代码行数:22,代码来源:TokenUtility.cs

示例6: CheckDnsEquivalence

        Claim CheckDnsEquivalence(ClaimSet claimSet, string expedtedDns)
        {
            IEnumerable<Claim> claims = claimSet.FindClaims(ClaimTypes.Dns, Rights.PossessProperty);
            foreach (Claim claim in claims)
            {
                // 格外允许"localhost"
                if (expedtedDns.Equals("localhost", StringComparison.OrdinalIgnoreCase))
                {
                    return claim;
                }

                string strCurrent = (string)claim.Resource;

                // 格外允许"DigitalPlatform"和任意出发字符串匹配
                if (strCurrent.Equals("DigitalPlatform", StringComparison.OrdinalIgnoreCase))
                    return claim;

                if (expedtedDns.Equals(strCurrent, StringComparison.OrdinalIgnoreCase))
                {
                    return claim;
                }
            }
            return null;
        }
开发者ID:paopaofeng,项目名称:dp2,代码行数:24,代码来源:RmsChannel.cs

示例7: CheckDnsEquivalence

 private Claim CheckDnsEquivalence(ClaimSet claimSet, string expectedSpn)
 {
     foreach (Claim claim in claimSet.FindClaims(ClaimTypes.Spn, Rights.PossessProperty))
     {
         if (expectedSpn.Equals((string) claim.Resource, StringComparison.OrdinalIgnoreCase))
         {
             return claim;
         }
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:IdentityVerifier.cs


注:本文中的ClaimSet.FindClaims方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。