本文整理匯總了C#中System.ServiceModel.Security.Tokens.SecurityTokenParameters類的典型用法代碼示例。如果您正苦於以下問題:C# SecurityTokenParameters類的具體用法?C# SecurityTokenParameters怎麽用?C# SecurityTokenParameters使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SecurityTokenParameters類屬於System.ServiceModel.Security.Tokens命名空間,在下文中一共展示了SecurityTokenParameters類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SecurityTokenParameters
protected SecurityTokenParameters(SecurityTokenParameters other)
{
if (other == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other");
_requireDerivedKeys = other._requireDerivedKeys;
}
示例2: SecurityTokenParameters
protected SecurityTokenParameters (SecurityTokenParameters other)
{
inclusion_mode = other.inclusion_mode;
reference_style = other.reference_style;
require_derived_keys = other.require_derived_keys;
issuer_binding_context = other.issuer_binding_context != null ? other.issuer_binding_context.Clone () : null;
}
示例3: SupportingTokenSpecification
public SupportingTokenSpecification(SecurityToken token, ReadOnlyCollection<IAuthorizationPolicy> tokenPolicies, SecurityTokenAttachmentMode attachmentMode, SecurityTokenParameters tokenParameters)
: base(token, tokenPolicies)
{
SecurityTokenAttachmentModeHelper.Validate(attachmentMode);
_tokenAttachmentMode = attachmentMode;
_tokenParameters = tokenParameters;
}
示例4: InitializeNestedTokenParameterSettings
protected override void InitializeNestedTokenParameterSettings(SecurityTokenParameters sp, bool initializeNestedBindings)
{
if (sp is SecureConversationSecurityTokenParameters)
this.InitializeSecureConversationParameters((SecureConversationSecurityTokenParameters)sp, initializeNestedBindings);
else
base.InitializeNestedTokenParameterSettings(sp, initializeNestedBindings);
}
示例5: 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
示例6: 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);
}
示例7: 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");
}
示例8: SupportingTokenProviderSpecification
public SupportingTokenProviderSpecification(SecurityTokenProvider tokenProvider, SecurityTokenAttachmentMode attachmentMode, SecurityTokenParameters tokenParameters)
{
if (tokenProvider == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("tokenProvider");
}
SecurityTokenAttachmentModeHelper.Validate(attachmentMode);
if (tokenParameters == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("tokenParameters");
}
_tokenProvider = tokenProvider;
_tokenAttachmentMode = attachmentMode;
_tokenParameters = tokenParameters;
}
示例9: GetTokensForOutgoingMessages
private void GetTokensForOutgoingMessages(out SecurityToken signingToken, out SecurityToken encryptionToken, out SecurityTokenParameters tokenParameters)
{
lock (this.ThisLock)
{
if (this.requireDerivedKeys)
{
signingToken = this.derivedSignatureToken;
encryptionToken = this.derivedEncryptionToken;
}
else
{
signingToken = encryptionToken = this.outgoingSessionToken;
}
}
tokenParameters = this.Factory.GetTokenParameters();
}
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:16,代碼來源:AcceptorSessionSymmetricMessageSecurityProtocol.cs
示例10: CheckForCookie
void CheckForCookie(SecurityTokenParameters tokenParameters, ServiceEndpoint endpoint)
{
bool cookie = false;
SecureConversationSecurityTokenParameters sc = tokenParameters as SecureConversationSecurityTokenParameters;
if (sc != null && sc.RequireCancellation == false)
cookie = true;
SspiSecurityTokenParameters sspi = tokenParameters as SspiSecurityTokenParameters;
if (sspi != null && sspi.RequireCancellation == false)
cookie = true;
SspiSecurityTokenParameters ssl = tokenParameters as SspiSecurityTokenParameters;
if (ssl != null && ssl.RequireCancellation == false)
cookie = true;
if (cookie)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.RequireNonCookieMode, endpoint.Binding.Name, endpoint.Binding.Namespace)));
}
示例11: SupportingTokenAuthenticatorSpecification
internal SupportingTokenAuthenticatorSpecification(SecurityTokenAuthenticator tokenAuthenticator, SecurityTokenResolver securityTokenResolver, System.ServiceModel.Security.SecurityTokenAttachmentMode attachmentMode, SecurityTokenParameters tokenParameters, bool isTokenOptional)
{
if (tokenAuthenticator == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("tokenAuthenticator");
}
SecurityTokenAttachmentModeHelper.Validate(attachmentMode);
if (tokenParameters == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("tokenParameters");
}
this.tokenAuthenticator = tokenAuthenticator;
this.tokenResolver = securityTokenResolver;
this.tokenAttachmentMode = attachmentMode;
this.tokenParameters = tokenParameters;
this.isTokenOptional = isTokenOptional;
}
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:17,代碼來源:SupportingTokenAuthenticatorSpecification.cs
示例12: AddEndorsingSupportingToken
public void AddEndorsingSupportingToken(SecurityToken token, SecurityTokenParameters parameters)
{
if (token == null)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("token");
}
if (parameters == null)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parameters");
}
base.ThrowIfProcessingStarted();
this.elementContainer.AddEndorsingSupportingToken(token);
if (!(token is ProviderBackedSecurityToken))
{
this.shouldSignToHeader |= !base.RequireMessageProtection && (System.ServiceModel.Security.SecurityUtils.GetSecurityKey<AsymmetricSecurityKey>(token) != null);
}
this.AddParameters(ref this.endorsingTokenParameters, parameters);
}
示例13: AddBasicSupportingToken
public void AddBasicSupportingToken(SecurityToken token, SecurityTokenParameters parameters)
{
if (token == null)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("token");
}
if (parameters == null)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parameters");
}
base.ThrowIfProcessingStarted();
SendSecurityHeaderElement tokenElement = new SendSecurityHeaderElement(token.Id, new TokenElement(token, base.StandardsManager)) {
MarkedForEncryption = true
};
this.elementContainer.AddBasicSupportingToken(tokenElement);
this.hasEncryptedTokens = true;
this.hasSignedTokens = true;
this.AddParameters(ref this.basicSupportingTokenParameters, parameters);
}
示例14: TryImportWsspX509TokenAssertion
public virtual bool TryImportWsspX509TokenAssertion(MetadataImporter importer, XmlElement assertion, out SecurityTokenParameters parameters)
{
parameters = null;
SecurityTokenInclusionMode inclusionMode;
Collection<Collection<XmlElement>> alternatives;
if (IsWsspAssertion(assertion, X509TokenName)
&& TryGetIncludeTokenValue(assertion, out inclusionMode))
{
if (TryGetNestedPolicyAlternatives(importer, assertion, out alternatives))
{
foreach (Collection<XmlElement> alternative in alternatives)
{
X509SecurityTokenParameters x509 = new X509SecurityTokenParameters();
parameters = x509;
if (TryImportWsspRequireDerivedKeysAssertion(alternative, x509)
&& TryImportX509ReferenceStyleAssertion(alternative, x509)
&& TryImportWsspAssertion(alternative, WssX509V3Token10Name, true)
&& alternative.Count == 0)
{
parameters.InclusionMode = inclusionMode;
break;
}
else
{
parameters = null;
}
}
}
else
{
parameters = new X509SecurityTokenParameters();
parameters.RequireDerivedKeys = false;
parameters.InclusionMode = inclusionMode;
}
}
return parameters != null;
}
示例15: TryImportWsspKerberosTokenAssertion
public virtual bool TryImportWsspKerberosTokenAssertion(MetadataImporter importer, XmlElement assertion, out SecurityTokenParameters parameters)
{
parameters = null;
SecurityTokenInclusionMode inclusionMode;
Collection<Collection<XmlElement>> alternatives;
if (IsWsspAssertion(assertion, KerberosTokenName)
&& TryGetIncludeTokenValue(assertion, out inclusionMode))
{
if (TryGetNestedPolicyAlternatives(importer, assertion, out alternatives))
{
foreach (Collection<XmlElement> alternative in alternatives)
{
parameters = new KerberosSecurityTokenParameters();
if (TryImportWsspRequireDerivedKeysAssertion(alternative, parameters)
&& TryImportWsspAssertion(alternative, WssGssKerberosV5ApReqToken11Name, true)
&& alternative.Count == 0)
{
parameters.InclusionMode = inclusionMode;
break;
}
else
{
parameters = null;
}
}
}
else
{
parameters = new KerberosSecurityTokenParameters();
parameters.RequireDerivedKeys = false;
parameters.InclusionMode = inclusionMode;
}
}
return parameters != null;
}