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


C# SecurityTokenReferenceStyle类代码示例

本文整理汇总了C#中SecurityTokenReferenceStyle的典型用法代码示例。如果您正苦于以下问题:C# SecurityTokenReferenceStyle类的具体用法?C# SecurityTokenReferenceStyle怎么用?C# SecurityTokenReferenceStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Validate

 public static void Validate(SecurityTokenReferenceStyle value)
 {
     if (!IsDefined(value))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int) value, typeof(SecurityTokenReferenceStyle)));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:TokenReferenceStyleHelper.cs

示例2: CreateKeyIdentifierClause

        protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause( System.IdentityModel.Tokens.SecurityToken token, SecurityTokenReferenceStyle referenceStyle )
        {
            if ( referenceStyle == SecurityTokenReferenceStyle.Internal )
                return token.CreateKeyIdentifierClause<LocalIdKeyIdentifierClause>();

            throw new NotSupportedException( "External references are not supported for tokens" );
        }
开发者ID:Sn3b,项目名称:Omniture-API,代码行数:7,代码来源:SecurityTokenParameters.cs

示例3: CreateKeyIdentifierClause

 internal protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
 {
     if (token is GenericXmlSecurityToken)
         return base.CreateGenericXmlTokenKeyIdentifierClause(token, referenceStyle);
     else
         return this.CreateKeyIdentifierClause<SecurityContextKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:SspiSecurityTokenParameters.cs

示例4: CreateKeyIdentifierClause

 protected internal override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
 {
     if (referenceStyle == SecurityTokenReferenceStyle.Internal)
     {
         return token.CreateKeyIdentifierClause<LocalIdKeyIdentifierClause>();
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:SessionDerivedKeySecurityTokenParameters.cs

示例5: IsDefined

 public static bool IsDefined(SecurityTokenReferenceStyle value)
 {
     if (value != SecurityTokenReferenceStyle.External)
     {
         return (value == SecurityTokenReferenceStyle.Internal);
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:TokenReferenceStyleHelper.cs

示例6: CreateKeyIdentifierClause

        internal protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
        {
            SecurityKeyIdentifierClause result = null;

            switch (this.x509ReferenceStyle)
            {
                default:
                case X509KeyIdentifierClauseType.Any:
                    if (referenceStyle == SecurityTokenReferenceStyle.External)
                    {
                        X509SecurityToken x509Token = token as X509SecurityToken;
                        if (x509Token != null)
                        {
                            X509SubjectKeyIdentifierClause x509KeyIdentifierClause;
                            if (X509SubjectKeyIdentifierClause.TryCreateFrom(x509Token.Certificate, out x509KeyIdentifierClause))
                            {
                                result = x509KeyIdentifierClause;
                            }
                        }
                        else
                        {
                            X509WindowsSecurityToken windowsX509Token = token as X509WindowsSecurityToken;
                            if (windowsX509Token != null)
                            {
                                X509SubjectKeyIdentifierClause x509KeyIdentifierClause;
                                if (X509SubjectKeyIdentifierClause.TryCreateFrom(windowsX509Token.Certificate, out x509KeyIdentifierClause))
                                {
                                    result = x509KeyIdentifierClause;
                                }
                            }
                        }

                        if (result == null)
                            result = token.CreateKeyIdentifierClause<X509IssuerSerialKeyIdentifierClause>();
                        if (result == null)
                            result = token.CreateKeyIdentifierClause<X509ThumbprintKeyIdentifierClause>();
                    }
                    else
                        result = token.CreateKeyIdentifierClause<LocalIdKeyIdentifierClause>();
                    break;
                case X509KeyIdentifierClauseType.Thumbprint:
                    result = this.CreateKeyIdentifierClause<X509ThumbprintKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);
                    break; 
                case X509KeyIdentifierClauseType.SubjectKeyIdentifier:
                    result = this.CreateKeyIdentifierClause<X509SubjectKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);
                    break;
                case X509KeyIdentifierClauseType.IssuerSerial:
                    result = this.CreateKeyIdentifierClause<X509IssuerSerialKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);
                    break;
                case X509KeyIdentifierClauseType.RawDataKeyIdentifier:
                    result = this.CreateKeyIdentifierClause<X509RawDataKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);
                    break;
            }

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

示例7: CreateKeyIdentifierClause

		protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause (
			SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
		{
			if (token == null)
				throw new ArgumentNullException ("token");
			RsaSecurityToken rt = token as RsaSecurityToken;
			if (rt == null)
				throw new NotSupportedException (String.Format ("Cannot create a key identifier clause from this security token '{0}'", token));
			return new RsaKeyIdentifierClause (rt.Rsa);
		}
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:RsaSecurityTokenParameters.cs

示例8: CreateKeyIdentifierClause

 protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
 {
     if (referenceStyle == SecurityTokenReferenceStyle.Internal)
     {
         return token.CreateKeyIdentifierClause<LocalIdKeyIdentifierClause>();
     }
     else
     {
         throw new NotSupportedException("External references are not supported for credit card tokens");
     }
 }
开发者ID:ssickles,项目名称:archive,代码行数:11,代码来源:CreditCardTokenParameters.cs

示例9: CreateKeyIdentifierClause

		protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause (
			SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
		{
			if (token == null)
				throw new ArgumentNullException ("token");
			if (token is UserNameSecurityToken &&
			    referenceStyle == SecurityTokenReferenceStyle.Internal)
				return new LocalIdKeyIdentifierClause (token.Id);
			// External reference is not supported.
			throw new NotSupportedException (String.Format ("This security token '{0}' with {1} reference mode is not supported.", token, referenceStyle));
		}
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:UserNameSecurityTokenParameters.cs

示例10: MatchesKeyIdentifierClause

 protected internal override bool MatchesKeyIdentifierClause(SecurityToken token, SecurityKeyIdentifierClause keyIdentifierClause, SecurityTokenReferenceStyle referenceStyle)
 {
     if (referenceStyle != SecurityTokenReferenceStyle.Internal)
     {
         return false;
     }
     LocalIdKeyIdentifierClause clause = keyIdentifierClause as LocalIdKeyIdentifierClause;
     if (clause == null)
     {
         return false;
     }
     return (clause.LocalId == token.Id);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:SessionDerivedKeySecurityTokenParameters.cs

示例11: CreateWrappedKeyToken

 private WrappedKeySecurityToken CreateWrappedKeyToken(SecurityToken wrappingToken, SecurityTokenParameters wrappingTokenParameters, SecurityTokenReferenceStyle wrappingTokenReferenceStyle)
 {
     int keyLength = Math.Max(0x80, this.Factory.OutgoingAlgorithmSuite.DefaultSymmetricKeyLength);
     CryptoHelper.ValidateSymmetricKeyLength(keyLength, this.Factory.OutgoingAlgorithmSuite);
     byte[] buffer = new byte[keyLength / 8];
     CryptoHelper.FillRandomBytes(buffer);
     string id = System.ServiceModel.Security.SecurityUtils.GenerateId();
     string defaultAsymmetricKeyWrapAlgorithm = this.Factory.OutgoingAlgorithmSuite.DefaultAsymmetricKeyWrapAlgorithm;
     SecurityKeyIdentifierClause clause = wrappingTokenParameters.CreateKeyIdentifierClause(wrappingToken, wrappingTokenReferenceStyle);
     SecurityKeyIdentifier wrappingTokenReference = new SecurityKeyIdentifier();
     wrappingTokenReference.Add(clause);
     return new WrappedKeySecurityToken(id, buffer, defaultAsymmetricKeyWrapAlgorithm, wrappingToken, wrappingTokenReference);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:SymmetricSecurityProtocol.cs

示例12: Add

 public void Add(SecurityToken token, SecurityTokenReferenceStyle allowedReferenceStyle, SecurityTokenParameters tokenParameters)
 {
     if (token == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("token");
     }
     if ((allowedReferenceStyle == SecurityTokenReferenceStyle.External) && (tokenParameters == null))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.ServiceModel.SR.GetString("ResolvingExternalTokensRequireSecurityTokenParameters"));
     }
     this.EnsureCapacityToAddToken();
     this.tokens[this.tokenCount++] = new SecurityTokenEntry(token, tokenParameters, allowedReferenceStyle);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:SecurityHeaderTokenResolver.cs

示例13: AssertSecurityTokenParameters

		public static void AssertSecurityTokenParameters (
			SecurityTokenInclusionMode protectionTokenInclusionMode,
			SecurityTokenReferenceStyle protectionTokenReferenceStyle,
			bool protectionTokenRequireDerivedKeys,
			SecurityTokenParameters tp, string label)
		{
			Assert.IsNotNull (tp, label + " IsNotNull");
			Assert.AreEqual (protectionTokenInclusionMode,
				tp.InclusionMode, label + ".InclusionMode");
			Assert.AreEqual (protectionTokenReferenceStyle,
				tp.ReferenceStyle, label + ".ReferenceStyle");
			Assert.AreEqual (protectionTokenRequireDerivedKeys,
				tp.RequireDerivedKeys, label + ".RequireDerivedKeys");
		}
开发者ID:nickchal,项目名称:pash,代码行数:14,代码来源:SecurityAssert.cs

示例14: CreateKeyIdentifierClause

        protected internal override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
        {
            SecurityKeyIdentifierClause clause = null;
            switch (this.x509ReferenceStyle)
            {
                case X509KeyIdentifierClauseType.Thumbprint:
                    return base.CreateKeyIdentifierClause<X509ThumbprintKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);

                case X509KeyIdentifierClauseType.IssuerSerial:
                    return base.CreateKeyIdentifierClause<X509IssuerSerialKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);

                case X509KeyIdentifierClauseType.SubjectKeyIdentifier:
                    return base.CreateKeyIdentifierClause<X509SubjectKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);

                case X509KeyIdentifierClauseType.RawDataKeyIdentifier:
                    return base.CreateKeyIdentifierClause<X509RawDataKeyIdentifierClause, LocalIdKeyIdentifierClause>(token, referenceStyle);
            }
            if (referenceStyle == SecurityTokenReferenceStyle.External)
            {
                X509SecurityToken token2 = token as X509SecurityToken;
                if (token2 != null)
                {
                    X509SubjectKeyIdentifierClause clause2;
                    if (X509SubjectKeyIdentifierClause.TryCreateFrom(token2.Certificate, out clause2))
                    {
                        clause = clause2;
                    }
                }
                else
                {
                    X509SubjectKeyIdentifierClause clause3;
                    X509WindowsSecurityToken token3 = token as X509WindowsSecurityToken;
                    if ((token3 != null) && X509SubjectKeyIdentifierClause.TryCreateFrom(token3.Certificate, out clause3))
                    {
                        clause = clause3;
                    }
                }
                if (clause == null)
                {
                    clause = token.CreateKeyIdentifierClause<X509IssuerSerialKeyIdentifierClause>();
                }
                if (clause == null)
                {
                    clause = token.CreateKeyIdentifierClause<X509ThumbprintKeyIdentifierClause>();
                }
                return clause;
            }
            return token.CreateKeyIdentifierClause<LocalIdKeyIdentifierClause>();
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:49,代码来源:X509SecurityTokenParameters.cs

示例15: MatchesKeyIdentifierClause

		protected virtual bool MatchesKeyIdentifierClause (
			SecurityToken token,
			SecurityKeyIdentifierClause keyIdentifierClause,
			SecurityTokenReferenceStyle referenceStyle)
		{
			throw new NotImplementedException ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:SecurityTokenParameters.cs


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