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


C# SecurityKeyIdentifier.TryFind方法代码示例

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


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

示例1: ResolveClaimSet

 public virtual ClaimSet ResolveClaimSet(SecurityKeyIdentifier keyIdentifier)
 {
     RsaKeyIdentifierClause clause;
     EncryptedKeyIdentifierClause clause2;
     if (keyIdentifier == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("keyIdentifier");
     }
     if (keyIdentifier.TryFind<RsaKeyIdentifierClause>(out clause))
     {
         return new DefaultClaimSet(new Claim[] { new Claim(ClaimTypes.Rsa, clause.Rsa, Rights.PossessProperty) });
     }
     if (keyIdentifier.TryFind<EncryptedKeyIdentifierClause>(out clause2))
     {
         return new DefaultClaimSet(new Claim[] { Claim.CreateHashClaim(clause2.GetBuffer()) });
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:SamlSecurityTokenAuthenticator.cs

示例2: ResolveIdentity

        public virtual IIdentity ResolveIdentity(SecurityKeyIdentifier keyIdentifier)
        {
            if (keyIdentifier == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("keyIdentifier");

            RsaKeyIdentifierClause rsaKeyIdentifierClause;
            if (keyIdentifier.TryFind<RsaKeyIdentifierClause>(out rsaKeyIdentifierClause))
            {
                return SecurityUtils.CreateIdentity(rsaKeyIdentifierClause.Rsa.ToXmlString(false), this.GetType().Name);
            }

            return null;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:13,代码来源:SamlSecurityTokenAuthenticator.cs

示例3: ResolveClaimSet

        public virtual ClaimSet ResolveClaimSet(SecurityKeyIdentifier keyIdentifier)
        {
            if (keyIdentifier == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("keyIdentifier");

            RsaKeyIdentifierClause rsaKeyIdentifierClause;
            EncryptedKeyIdentifierClause encryptedKeyIdentifierClause;
            if (keyIdentifier.TryFind<RsaKeyIdentifierClause>(out rsaKeyIdentifierClause))
            {
                return new DefaultClaimSet(new Claim(ClaimTypes.Rsa, rsaKeyIdentifierClause.Rsa, Rights.PossessProperty));
            }
            else if (keyIdentifier.TryFind<EncryptedKeyIdentifierClause>(out encryptedKeyIdentifierClause))
            {
                return new DefaultClaimSet(Claim.CreateHashClaim(encryptedKeyIdentifierClause.GetBuffer()));
            }

            return null;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:18,代码来源:SamlSecurityTokenAuthenticator.cs

示例4: ResolveSignatureToken

 SecurityToken ResolveSignatureToken(SecurityKeyIdentifier keyIdentifier, SecurityTokenResolver resolver, bool isPrimarySignature)
 {
     SecurityToken token;
     TryResolveKeyIdentifier(keyIdentifier, resolver, true, out token);
     if (token == null && !isPrimarySignature)
     {
         // check if there is a rsa key token authenticator
         if (keyIdentifier.Count == 1)
         {
             RsaKeyIdentifierClause rsaClause;
             if (keyIdentifier.TryFind<RsaKeyIdentifierClause>(out rsaClause))
             {
                 RsaSecurityTokenAuthenticator rsaAuthenticator = FindAllowedAuthenticator<RsaSecurityTokenAuthenticator>(false);
                 if (rsaAuthenticator != null)
                 {
                     token = new RsaSecurityToken(rsaClause.Rsa);
                     ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies = rsaAuthenticator.ValidateToken(token);
                     SupportingTokenAuthenticatorSpecification spec;
                     TokenTracker rsaTracker = GetSupportingTokenTracker(rsaAuthenticator, out spec);
                     if (rsaTracker == null)
                     {
                         throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(SR.GetString(SR.UnknownTokenAuthenticatorUsedInTokenProcessing, rsaAuthenticator)));
                     }
                     rsaTracker.RecordToken(token);
                     SecurityTokenAuthorizationPoliciesMapping.Add(token, authorizationPolicies);
                 }
             }
         }
     }
     if (token == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(
                 SR.GetString(SR.UnableToResolveKeyInfoForVerifyingSignature, keyIdentifier, resolver)));
     }
     return token;
 }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:36,代码来源:WSSecurityOneDotZeroReceiveSecurityHeader.cs

示例5: ResolveSignatureToken

 private SecurityToken ResolveSignatureToken(SecurityKeyIdentifier keyIdentifier, SecurityTokenResolver resolver, bool isPrimarySignature)
 {
     SecurityToken token;
     RsaKeyIdentifierClause clause;
     TryResolveKeyIdentifier(keyIdentifier, resolver, true, out token);
     if (((token == null) && !isPrimarySignature) && ((keyIdentifier.Count == 1) && keyIdentifier.TryFind<RsaKeyIdentifierClause>(out clause)))
     {
         RsaSecurityTokenAuthenticator tokenAuthenticator = base.FindAllowedAuthenticator<RsaSecurityTokenAuthenticator>(false);
         if (tokenAuthenticator != null)
         {
             SupportingTokenAuthenticatorSpecification specification;
             token = new RsaSecurityToken(clause.Rsa);
             ReadOnlyCollection<IAuthorizationPolicy> onlys = tokenAuthenticator.ValidateToken(token);
             TokenTracker supportingTokenTracker = base.GetSupportingTokenTracker(tokenAuthenticator, out specification);
             if (supportingTokenTracker == null)
             {
                 throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(System.ServiceModel.SR.GetString("UnknownTokenAuthenticatorUsedInTokenProcessing", new object[] { tokenAuthenticator })));
             }
             supportingTokenTracker.RecordToken(token);
             base.SecurityTokenAuthorizationPoliciesMapping.Add(token, onlys);
         }
     }
     if (token == null)
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(System.ServiceModel.SR.GetString("UnableToResolveKeyInfoForVerifyingSignature", new object[] { keyIdentifier, resolver })));
     }
     return token;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:WSSecurityOneDotZeroReceiveSecurityHeader.cs

示例6: ResolveIdentity

 public virtual IIdentity ResolveIdentity(SecurityKeyIdentifier keyIdentifier)
 {
     RsaKeyIdentifierClause clause;
     if (keyIdentifier == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("keyIdentifier");
     }
     if (keyIdentifier.TryFind<RsaKeyIdentifierClause>(out clause))
     {
         return System.IdentityModel.SecurityUtils.CreateIdentity(clause.Rsa.ToXmlString(false), base.GetType().Name);
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:SamlSecurityTokenAuthenticator.cs

示例7: TryResolveTokenCore

 protected override bool TryResolveTokenCore(SecurityKeyIdentifier keyIdentifier, out SecurityToken token)
 {
     SecurityContextKeyIdentifierClause sctSkiClause;
     if (keyIdentifier.TryFind<SecurityContextKeyIdentifierClause>(out sctSkiClause))
     {
         return TryResolveToken(sctSkiClause, out token);
     }
     else
     {
         token = null;
         return false;
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:13,代码来源:SecurityContextSecurityTokenResolver.cs

示例8: ResolveSecurityToken

        internal static SecurityToken ResolveSecurityToken(SecurityKeyIdentifier ski, SecurityTokenResolver tokenResolver)
        {
            SecurityToken token = null;

            if (tokenResolver != null)
            {
                tokenResolver.TryResolveToken(ski, out token);
            }

            if (token == null)
            {
                // Check if this is a RSA key.
                RsaKeyIdentifierClause rsaClause;
                if (ski.TryFind<RsaKeyIdentifierClause>(out rsaClause))
                    token = new RsaSecurityToken(rsaClause.Rsa);
            }

            if (token == null)
            {
                // Check if this is a X509RawDataKeyIdentifier Clause.
                X509RawDataKeyIdentifierClause rawDataKeyIdentifierClause;
                if (ski.TryFind<X509RawDataKeyIdentifierClause>(out rawDataKeyIdentifierClause))
                    token = new X509SecurityToken(new X509Certificate2(rawDataKeyIdentifierClause.GetX509RawData()));
            }

            return token;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:27,代码来源:SamlSerializer.cs

示例9: ResolveSecurityToken

 internal static SecurityToken ResolveSecurityToken(SecurityKeyIdentifier ski, SecurityTokenResolver tokenResolver)
 {
     SecurityToken token = null;
     RsaKeyIdentifierClause clause;
     X509RawDataKeyIdentifierClause clause2;
     if (tokenResolver != null)
     {
         tokenResolver.TryResolveToken(ski, out token);
     }
     if ((token == null) && ski.TryFind<RsaKeyIdentifierClause>(out clause))
     {
         token = new RsaSecurityToken(clause.Rsa);
     }
     if ((token == null) && ski.TryFind<X509RawDataKeyIdentifierClause>(out clause2))
     {
         token = new X509SecurityToken(new X509Certificate2(clause2.GetX509RawData()));
     }
     return token;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:SamlSerializer.cs

示例10: TryResolveTokenCore

 protected override bool TryResolveTokenCore(SecurityKeyIdentifier keyIdentifier, out SecurityToken token)
 {
     SecurityContextKeyIdentifierClause clause;
     if (keyIdentifier.TryFind<SecurityContextKeyIdentifierClause>(out clause))
     {
         return base.TryResolveToken(clause, out token);
     }
     token = null;
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:SecurityContextSecurityTokenResolver.cs


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