本文整理汇总了C#中System.ServiceModel.Security.SecurityProtocolCorrelationState类的典型用法代码示例。如果您正苦于以下问题:C# SecurityProtocolCorrelationState类的具体用法?C# SecurityProtocolCorrelationState怎么用?C# SecurityProtocolCorrelationState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SecurityProtocolCorrelationState类属于System.ServiceModel.Security命名空间,在下文中一共展示了SecurityProtocolCorrelationState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BeginSecureOutgoingMessage
public override IAsyncResult BeginSecureOutgoingMessage(Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState, AsyncCallback callback, object state)
{
if (message == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
}
this.CommunicationObject.ThrowIfClosedOrNotOpen();
string actor = string.Empty; // message.Version.Envelope.UltimateDestinationActor;
try
{
if (this.SecurityProtocolFactory.ActAsInitiator)
{
return this.BeginSecureOutgoingMessageAtInitiatorCore(message, actor, timeout, callback, state);
}
else
{
SecureOutgoingMessageAtResponder(ref message, actor);
return new CompletedAsyncResult<Message>(message, callback, state);
}
}
catch (Exception exception)
{
// Always immediately rethrow fatal exceptions.
if (Fx.IsFatal(exception)) throw;
base.OnSecureOutgoingMessageFailure(message);
throw;
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:29,代码来源:TransportSecurityProtocol.cs
示例2: EndSecureOutgoingMessage
public override void EndSecureOutgoingMessage(IAsyncResult result, out Message message, out SecurityProtocolCorrelationState newCorrelationState)
{
if (result == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("result");
}
newCorrelationState = null;
try
{
if (result is CompletedAsyncResult<Message>)
{
message = CompletedAsyncResult<Message>.End(result);
}
else
{
message = this.EndSecureOutgoingMessageAtInitiatorCore(result);
}
base.OnOutgoingMessageSecured(message);
}
catch (Exception exception)
{
if (Fx.IsFatal(exception))
{
throw;
}
base.OnSecureOutgoingMessageFailure(null);
throw;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:TransportSecurityProtocol.cs
示例3: BeginSecureOutgoingMessage
public override IAsyncResult BeginSecureOutgoingMessage(Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState, AsyncCallback callback, object state)
{
IAsyncResult result;
if (message == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
}
base.CommunicationObject.ThrowIfClosedOrNotOpen();
string actor = string.Empty;
try
{
if (base.SecurityProtocolFactory.ActAsInitiator)
{
return this.BeginSecureOutgoingMessageAtInitiatorCore(message, actor, timeout, callback, state);
}
this.SecureOutgoingMessageAtResponder(ref message, actor);
result = new CompletedAsyncResult<Message>(message, callback, state);
}
catch (Exception exception)
{
if (Fx.IsFatal(exception))
{
throw;
}
base.OnSecureOutgoingMessageFailure(message);
throw;
}
return result;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:TransportSecurityProtocol.cs
示例4: SecureOutgoingMessageCore
protected override SecurityProtocolCorrelationState SecureOutgoingMessageCore(ref Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
{
SecurityToken token;
SecurityToken token2;
SecurityTokenParameters parameters;
this.GetTokensForOutgoingMessages(out token, out token2, out parameters);
this.SetUpDelayedSecurityExecution(ref message, token, token2, parameters, correlationState);
return null;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:AcceptorSessionSymmetricMessageSecurityProtocol.cs
示例5: BeginSecureOutgoingMessageCore
protected override IAsyncResult BeginSecureOutgoingMessageCore(Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState, AsyncCallback callback, object state)
{
SecurityToken token;
SecurityToken token2;
SecurityTokenParameters parameters;
this.GetTokensForOutgoingMessages(out token, out token2, out parameters);
this.SetUpDelayedSecurityExecution(ref message, token, token2, parameters, correlationState);
return new CompletedAsyncResult<Message>(message, callback, state);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:AcceptorSessionSymmetricMessageSecurityProtocol.cs
示例6: EndSecureOutgoingMessageCore
protected override void EndSecureOutgoingMessageCore(IAsyncResult result, out Message message, out SecurityProtocolCorrelationState newCorrelationState)
{
if (result is CompletedAsyncResult<Message, SecurityProtocolCorrelationState>)
{
message = CompletedAsyncResult<Message, SecurityProtocolCorrelationState>.End(result, out newCorrelationState);
}
else
{
message = MessageSecurityProtocol.GetOneTokenAndSetUpSecurityAsyncResult.End(result, out newCorrelationState);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:SymmetricSecurityProtocol.cs
示例7: BeginSecureOutgoingMessageCore
protected override IAsyncResult BeginSecureOutgoingMessageCore(Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState, AsyncCallback callback, object state)
{
SecurityToken token;
SecurityToken token2;
SecurityToken token3;
SecurityTokenParameters parameters;
IList<SupportingTokenSpecification> list;
this.GetTokensForOutgoingMessages(out token, out token2, out token3, out parameters);
TimeoutHelper helper = new TimeoutHelper(timeout);
if (base.TryGetSupportingTokens(this.Factory, base.Target, base.Via, message, helper.RemainingTime(), false, out list))
{
SecurityProtocolCorrelationState state2 = this.CreateCorrelationStateIfRequired();
this.SetUpDelayedSecurityExecution(ref message, token, token2, token3, parameters, list, state2);
return new CompletedAsyncResult<Message, SecurityProtocolCorrelationState>(message, state2, callback, state);
}
return new SecureOutgoingMessageAsyncResult(message, this, token, token2, token3, parameters, helper.RemainingTime(), callback, state);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:InitiatorSessionSymmetricMessageSecurityProtocol.cs
示例8: BeginSecureOutgoingMessageCore
protected override IAsyncResult BeginSecureOutgoingMessageCore(Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState, AsyncCallback callback, object state)
{
SecurityToken token;
SecurityTokenParameters parameters;
IList<SupportingTokenSpecification> list;
SecurityToken token2;
SecurityProtocolCorrelationState state2;
TimeoutHelper helper = new TimeoutHelper(timeout);
if (this.TryGetTokenSynchronouslyForOutgoingSecurity(message, correlationState, false, helper.RemainingTime(), out token, out parameters, out token2, out list, out state2))
{
this.SetUpDelayedSecurityExecution(ref message, token2, token, parameters, list, base.GetSignatureConfirmationCorrelationState(correlationState, state2));
return new CompletedAsyncResult<Message, SecurityProtocolCorrelationState>(message, state2, callback, state);
}
if (!this.Factory.ActAsInitiator)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("ProtocolMustBeInitiator", new object[] { base.GetType().ToString() })));
}
return new SecureOutgoingMessageAsyncResult(message, this, this.GetTokenProvider(), this.Factory.ApplyConfidentiality, this.initiatorTokenAuthenticator, correlationState, helper.RemainingTime(), callback, state);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:SymmetricSecurityProtocol.cs
示例9: BeginSecureOutgoingMessage
public override IAsyncResult BeginSecureOutgoingMessage(Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState, AsyncCallback callback, object state)
{
IAsyncResult result;
try
{
base.CommunicationObject.ThrowIfClosedOrNotOpen();
this.ValidateOutgoingState(message);
if (!this.RequiresOutgoingSecurityProcessing && (message.Properties.Security == null))
{
return new CompletedAsyncResult<Message>(message, callback, state);
}
result = this.BeginSecureOutgoingMessageCore(message, timeout, correlationState, callback, state);
}
catch (Exception exception)
{
if (Fx.IsFatal(exception))
{
throw;
}
base.OnSecureOutgoingMessageFailure(message);
throw;
}
return result;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:MessageSecurityProtocol.cs
示例10: End
internal static Message End(IAsyncResult result, out SecurityProtocolCorrelationState newCorrelationState)
{
GetTwoTokensAndSetUpSecurityAsyncResult self = AsyncResult.End<GetTwoTokensAndSetUpSecurityAsyncResult>(result);
newCorrelationState = self.newCorrelationState;
return self.message;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:6,代码来源:MessageSecurityProtocol.cs
示例11: GetSignatureConfirmationCorrelationState
internal SecurityProtocolCorrelationState GetSignatureConfirmationCorrelationState(SecurityProtocolCorrelationState oldCorrelationState, SecurityProtocolCorrelationState newCorrelationState)
{
if (this.factory.ActAsInitiator)
{
return newCorrelationState;
}
else
{
return oldCorrelationState;
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:MessageSecurityProtocol.cs
示例12: SecureOutgoingMessageCore
protected abstract SecurityProtocolCorrelationState SecureOutgoingMessageCore(ref Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState);
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:1,代码来源:MessageSecurityProtocol.cs
示例13: CheckSignatureConfirmation
protected void CheckSignatureConfirmation(ReceiveSecurityHeader securityHeader, SecurityProtocolCorrelationState[] correlationStates)
{
SignatureConfirmations receivedConfirmations = securityHeader.GetSentSignatureConfirmations();
SignatureConfirmations sentSignatures = null;
if (correlationStates != null)
{
for (int i = 0; i < correlationStates.Length; ++i)
{
if (correlationStates[i].SignatureConfirmations != null)
{
sentSignatures = correlationStates[i].SignatureConfirmations;
break;
}
}
}
if (sentSignatures == null)
{
if (receivedConfirmations != null && receivedConfirmations.Count > 0)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.GetString(SR.FoundUnexpectedSignatureConfirmations)));
}
return;
}
bool allSignaturesConfirmed = false;
if (receivedConfirmations != null && sentSignatures.Count == receivedConfirmations.Count)
{
bool[] matchingSigIndexes = new bool[sentSignatures.Count];
for (int i = 0; i < sentSignatures.Count; ++i)
{
byte[] sentSignature;
bool wasSentSigEncrypted;
sentSignatures.GetConfirmation(i, out sentSignature, out wasSentSigEncrypted);
for (int j = 0; j < receivedConfirmations.Count; ++j)
{
byte[] receivedSignature;
bool wasReceivedSigEncrypted;
if (matchingSigIndexes[j])
{
continue;
}
receivedConfirmations.GetConfirmation(j, out receivedSignature, out wasReceivedSigEncrypted);
if ((wasReceivedSigEncrypted == wasSentSigEncrypted) && CryptoHelper.IsEqual(receivedSignature, sentSignature))
{
matchingSigIndexes[j] = true;
break;
}
}
}
int k;
for (k = 0; k < matchingSigIndexes.Length; ++k)
{
if (!matchingSigIndexes[k])
{
break;
}
}
if (k == matchingSigIndexes.Length)
{
allSignaturesConfirmed = true;
}
}
if (!allSignaturesConfirmed)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.GetString(SR.NotAllSignaturesConfirmed)));
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:66,代码来源:MessageSecurityProtocol.cs
示例14: ConfigureReceiveSecurityHeader
protected ReceiveSecurityHeader ConfigureReceiveSecurityHeader(Message message, string actor, SecurityProtocolCorrelationState[] correlationStates, SecurityStandardsManager standardsManager, out IList<SupportingTokenAuthenticatorSpecification> supportingAuthenticators)
{
MessageSecurityProtocolFactory factory = this.MessageSecurityProtocolFactory;
MessageDirection direction = factory.ActAsInitiator ? MessageDirection.Output : MessageDirection.Input;
ReceiveSecurityHeader securityHeader = CreateSecurityHeader(message, actor, direction, standardsManager);
string action = message.Headers.Action;
supportingAuthenticators = GetSupportingTokenAuthenticatorsAndSetExpectationFlags(this.factory, message, securityHeader);
if (factory.RequireIntegrity || securityHeader.ExpectSignedTokens)
{
securityHeader.RequiredSignatureParts = factory.GetIncomingSignatureParts(action);
}
if (factory.RequireConfidentiality || securityHeader.ExpectBasicTokens)
{
securityHeader.RequiredEncryptionParts = factory.GetIncomingEncryptionParts(action);
}
securityHeader.ExpectEncryption = factory.RequireConfidentiality || securityHeader.ExpectBasicTokens;
securityHeader.ExpectSignature = factory.RequireIntegrity || securityHeader.ExpectSignedTokens;
securityHeader.SetRequiredProtectionOrder(factory.MessageProtectionOrder);
// On the receiving side if protectTokens is enabled
// 1. If we are service, we make sure that the client always signs the primary token( can be any token type)else we throw.
// But currently the service can sign the primary token in reply only if the primary token is an issued token
// 2. If we are client, we do not care if the service signs the primary token or not. Otherwise it will be impossible to have a wcf client /service talk to each other unless we
// either use a symmetric binding with issued tokens or asymmetric bindings with both the intiator and recipient parameters being issued tokens( later one is rare).
securityHeader.RequireSignedPrimaryToken = !factory.ActAsInitiator && factory.SecurityBindingElement.ProtectTokens;
if (factory.ActAsInitiator && factory.DoRequestSignatureConfirmation && HasCorrelationState(correlationStates))
{
securityHeader.MaintainSignatureConfirmationState = true;
securityHeader.ExpectSignatureConfirmation = true;
}
else if (!factory.ActAsInitiator && factory.DoRequestSignatureConfirmation)
{
securityHeader.MaintainSignatureConfirmationState = true;
}
else
{
securityHeader.MaintainSignatureConfirmationState = false;
}
return securityHeader;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:43,代码来源:MessageSecurityProtocol.cs
示例15: HasCorrelationState
bool HasCorrelationState(SecurityProtocolCorrelationState[] correlationState)
{
if (correlationState == null || correlationState.Length == 0)
{
return false;
}
else if (correlationState.Length == 1 && correlationState[0] == null)
{
return false;
}
else
{
return true;
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:MessageSecurityProtocol.cs
示例16: GetCorrelationToken
protected SecurityToken GetCorrelationToken(SecurityProtocolCorrelationState correlationState)
{
if (correlationState == null || correlationState.Token == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.GetString(SR.CannotFindCorrelationStateForApplyingSecurity)));
}
return correlationState.Token;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:MessageSecurityProtocol.cs
示例17: ConfigureSendSecurityHeader
protected SendSecurityHeader ConfigureSendSecurityHeader(Message message, string actor, IList<SupportingTokenSpecification> supportingTokens, SecurityProtocolCorrelationState correlationState)
{
MessageSecurityProtocolFactory factory = this.MessageSecurityProtocolFactory;
SendSecurityHeader securityHeader = CreateSendSecurityHeader(message, actor, factory);
securityHeader.SignThenEncrypt = factory.MessageProtectionOrder != MessageProtectionOrder.EncryptBeforeSign;
// If ProtectTokens is enabled then we make sure that both the client side and the service side sign the primary token
// ( if it is an issued token, the check exists in sendsecurityheader)in the primary signature while sending a message.
securityHeader.ShouldProtectTokens = factory.SecurityBindingElement.ProtectTokens;
securityHeader.EncryptPrimarySignature = factory.MessageProtectionOrder == MessageProtectionOrder.SignBeforeEncryptAndEncryptSignature;
if (factory.DoRequestSignatureConfirmation && correlationState != null)
{
if (factory.ActAsInitiator)
{
securityHeader.MaintainSignatureConfirmationState = true;
securityHeader.CorrelationState = correlationState;
}
else if (correlationState.SignatureConfirmations != null)
{
securityHeader.AddSignatureConfirmations(correlationState.SignatureConfirmations);
}
}
string action = message.Headers.Action;
if (this.factory.ApplyIntegrity)
{
securityHeader.SignatureParts = this.factory.GetOutgoingSignatureParts(action);
}
if (factory.ApplyConfidentiality)
{
securityHeader.EncryptionParts = this.factory.GetOutgoingEncryptionParts(action);
}
AddSupportingTokens(securityHeader, supportingTokens);
return securityHeader;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:36,代码来源:MessageSecurityProtocol.cs
示例18: SetUpDelayedSecurityExecution
void SetUpDelayedSecurityExecution(ref Message message, SecurityToken signingToken, SecurityToken encryptionToken,
SecurityTokenParameters tokenParameters, SecurityProtocolCorrelationState correlationState)
{
string actor = string.Empty;
SendSecurityHeader securityHeader = ConfigureSendSecurityHeader(message, actor, null, correlationState);
if (this.Factory.ApplyIntegrity)
{
securityHeader.SetSigningToken(signingToken, tokenParameters);
}
if (Factory.ApplyConfidentiality)
{
securityHeader.SetEncryptionToken(encryptionToken, tokenParameters);
}
message = securityHeader.SetupExecution();
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:AcceptorSessionSymmetricMessageSecurityProtocol.cs
示例19: VerifyIncomingMessageCore
protected override SecurityProtocolCorrelationState VerifyIncomingMessageCore(ref Message message, string actor, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
{
SessionSymmetricMessageSecurityProtocolFactory factory = this.Factory;
IList<SupportingTokenAuthenticatorSpecification> supportingAuthenticators;
ReceiveSecurityHeader securityHeader = ConfigureReceiveSecurityHeader(message, string.Empty, correlationStates, (this.requireDerivedKeys) ? this.sessionStandardsManager : null, out supportingAuthenticators);
securityHeader.ConfigureSymmetricBindingServerReceiveHeader(this.sessionTokenAuthenticator, this.Factory.SecurityTokenParameters, supportingAuthenticators);
securityHeader.ConfigureOutOfBandTokenResolver(MergeOutOfBandResolvers(supportingAuthenticators, this.sessionResolverList));
// do not enforce key derivation requirement for Cancel messages due to WSE interop
securityHeader.EnforceDerivedKeyRequirement = (message.Headers.Action != factory.StandardsManager.SecureConversationDriver.CloseAction.Value);
ProcessSecurityHeader(securityHeader, ref message, null, timeout, correlationStates);
SecurityToken signingToken = securityHeader.SignatureToken;
SecurityContextSecurityToken signingSct = (signingToken as SecurityContextSecurityToken);
if (signingSct == null || signingSct.ContextId != sessionId)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(SR.GetString(SR.NoSessionTokenPresentInMessage)));
}
AttachRecipientSecurityProperty(message, signingToken, false, securityHeader.BasicSupportingTokens, securityHeader.EndorsingSupportingTokens, securityHeader.SignedEndorsingSupportingTokens,
securityHeader.SignedSupportingTokens, securityHeader.SecurityTokenAuthorizationPoliciesMapping);
return GetCorrelationState(null, securityHeader);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:20,代码来源:AcceptorSessionSymmetricMessageSecurityProtocol.cs
示例20: ProcessSecurityHeader
protected void ProcessSecurityHeader(ReceiveSecurityHeader securityHeader, ref Message message,
SecurityToken requiredSigningToken, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
{
TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);
securityHeader.ReplayDetectionEnabled = this.factory.DetectReplays;
securityHeader.SetTimeParameters(this.factory.NonceCache, this.factory.ReplayWindow, this.factory.MaxClockSkew);
securityHeader.Process(timeoutHelper.RemainingTime(), SecurityUtils.GetChannelBindingFromMessage(message), this.factory.ExtendedProtectionPolicy);
if (this.factory.AddTimestamp && securityHeader.Timestamp == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(SR.GetString(SR.RequiredTimestampMissingInSecurityHeader)));
}
if (requiredSigningToken != null && requiredSigningToken != securityHeader.SignatureToken)
{
throw TraceUtility.ThrowHelperError(new MessageSecurityException(SR.GetString(SR.ReplyWasNotSignedWithRequiredSigningToken)), message);
}
if (this.DoAutomaticEncryptionMatch)
{
SecurityUtils.EnsureExpectedSymmetricMatch(securityHeader.SignatureToken, securityHeader.EncryptionToken, message);
}
if (securityHeader.MaintainSignatureConfirmationState && this.factory.ActAsInitiator)
{
CheckSignatureConfirmation(securityHeader, correlationStates);
}
message = securityHeader.ProcessedMessage;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:MessageSecurityProtocol.cs
注:本文中的System.ServiceModel.Security.SecurityProtocolCorrelationState类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论