Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / Tokens / SecureConversationSecurityTokenParameters.cs / 1 / SecureConversationSecurityTokenParameters.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Security.Tokens { using System.IdentityModel.Tokens; using System.ServiceModel.Channels; using System.IdentityModel.Selectors; using System.ServiceModel; using System.ServiceModel.Security; using System.Text; using System.Globalization; public class SecureConversationSecurityTokenParameters : SecurityTokenParameters { internal const bool defaultRequireCancellation = true; SecurityBindingElement bootstrapSecurityBindingElement; ChannelProtectionRequirements bootstrapProtectionRequirements; bool requireCancellation; BindingContext issuerBindingContext; protected SecureConversationSecurityTokenParameters(SecureConversationSecurityTokenParameters other) : base(other) { this.requireCancellation = other.requireCancellation; if (other.bootstrapSecurityBindingElement != null) this.bootstrapSecurityBindingElement = (SecurityBindingElement)other.bootstrapSecurityBindingElement.Clone(); if (other.bootstrapProtectionRequirements != null) this.bootstrapProtectionRequirements = new ChannelProtectionRequirements(other.bootstrapProtectionRequirements); if (other.issuerBindingContext != null) this.issuerBindingContext = other.issuerBindingContext.Clone(); } public SecureConversationSecurityTokenParameters() : this(null, defaultRequireCancellation, null) { // empty } public SecureConversationSecurityTokenParameters(SecurityBindingElement bootstrapSecurityBindingElement) : this(bootstrapSecurityBindingElement, defaultRequireCancellation, null) { // empty } public SecureConversationSecurityTokenParameters(SecurityBindingElement bootstrapSecurityBindingElement, bool requireCancellation) : this(bootstrapSecurityBindingElement, requireCancellation, null) { // empty } public SecureConversationSecurityTokenParameters(SecurityBindingElement bootstrapSecurityBindingElement, bool requireCancellation, ChannelProtectionRequirements bootstrapProtectionRequirements) : base() { this.bootstrapSecurityBindingElement = bootstrapSecurityBindingElement; if (bootstrapProtectionRequirements != null) this.bootstrapProtectionRequirements = new ChannelProtectionRequirements(bootstrapProtectionRequirements); else { this.bootstrapProtectionRequirements = new ChannelProtectionRequirements(); this.bootstrapProtectionRequirements.IncomingEncryptionParts.AddParts(new MessagePartSpecification(true)); this.bootstrapProtectionRequirements.IncomingSignatureParts.AddParts(new MessagePartSpecification(true)); this.bootstrapProtectionRequirements.OutgoingEncryptionParts.AddParts(new MessagePartSpecification(true)); this.bootstrapProtectionRequirements.OutgoingSignatureParts.AddParts(new MessagePartSpecification(true)); } this.requireCancellation = requireCancellation; } internal protected override bool HasAsymmetricKey { get { return false; } } public SecurityBindingElement BootstrapSecurityBindingElement { get { return this.bootstrapSecurityBindingElement; } set { this.bootstrapSecurityBindingElement = value; } } public ChannelProtectionRequirements BootstrapProtectionRequirements { get { return this.bootstrapProtectionRequirements; } } internal BindingContext IssuerBindingContext { get { return this.issuerBindingContext; } set { if (value != null) { value = value.Clone(); } this.issuerBindingContext = value; } } ISecurityCapabilities BootstrapSecurityCapabilities { get { return this.bootstrapSecurityBindingElement.GetIndividualProperty(); } } public bool RequireCancellation { get { return this.requireCancellation; } set { this.requireCancellation = value; } } internal protected override bool SupportsClientAuthentication { get { return this.BootstrapSecurityCapabilities == null ? false : this.BootstrapSecurityCapabilities.SupportsClientAuthentication; } } internal protected override bool SupportsServerAuthentication { get { return this.BootstrapSecurityCapabilities == null ? false : this.BootstrapSecurityCapabilities.SupportsServerAuthentication; } } internal protected override bool SupportsClientWindowsIdentity { get { return this.BootstrapSecurityCapabilities == null ? false : this.BootstrapSecurityCapabilities.SupportsClientWindowsIdentity; } } protected override SecurityTokenParameters CloneCore() { return new SecureConversationSecurityTokenParameters(this); } internal protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityTokenReferenceStyle referenceStyle) { if (token is GenericXmlSecurityToken) return base.CreateGenericXmlTokenKeyIdentifierClause(token, referenceStyle); else return this.CreateKeyIdentifierClause (token, referenceStyle); } protected internal override void InitializeSecurityTokenRequirement(SecurityTokenRequirement requirement) { requirement.TokenType = ServiceModelSecurityTokenTypes.SecureConversation; requirement.KeyType = SecurityKeyType.SymmetricKey; requirement.RequireCryptographicToken = true; requirement.Properties[ServiceModelSecurityTokenRequirement.SupportSecurityContextCancellationProperty] = this.RequireCancellation; requirement.Properties[ServiceModelSecurityTokenRequirement.SecureConversationSecurityBindingElementProperty] = this.BootstrapSecurityBindingElement; requirement.Properties[ServiceModelSecurityTokenRequirement.IssuerBindingContextProperty] = this.IssuerBindingContext.Clone(); requirement.Properties[ServiceModelSecurityTokenRequirement.IssuedSecurityTokenParametersProperty] = this.Clone(); } public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine(base.ToString()); sb.AppendLine(String.Format(CultureInfo.InvariantCulture, "RequireCancellation: {0}", this.requireCancellation.ToString())); if (this.bootstrapSecurityBindingElement == null) { sb.AppendLine(String.Format(CultureInfo.InvariantCulture, "BootstrapSecurityBindingElement: null")); } else { sb.AppendLine(String.Format(CultureInfo.InvariantCulture, "BootstrapSecurityBindingElement:")); sb.AppendLine(" " + this.BootstrapSecurityBindingElement.ToString().Trim().Replace("\n", "\n ")); } return sb.ToString().Trim(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlRetyper.cs
- VisualStyleRenderer.cs
- ExtensionSimplifierMarkupObject.cs
- VisualBasicImportReference.cs
- XmlILTrace.cs
- InvalidFilterCriteriaException.cs
- QueryCacheManager.cs
- ImageDrawing.cs
- EventProxy.cs
- SQLMoney.cs
- XhtmlConformanceSection.cs
- DesignerView.Commands.cs
- ImageFormatConverter.cs
- TextParaLineResult.cs
- HotCommands.cs
- TriggerCollection.cs
- sqlstateclientmanager.cs
- StylusButtonEventArgs.cs
- ChangePassword.cs
- PrimitiveDataContract.cs
- RectAnimation.cs
- DataGridViewCellStyleBuilderDialog.cs
- ContentElementAutomationPeer.cs
- DesignerRegionMouseEventArgs.cs
- RegistrationServices.cs
- FileClassifier.cs
- SizeValueSerializer.cs
- _Events.cs
- GridPatternIdentifiers.cs
- PolicyLevel.cs
- ComponentResourceManager.cs
- WrappedIUnknown.cs
- ServiceInfoCollection.cs
- peersecuritysettings.cs
- TaiwanLunisolarCalendar.cs
- ContainerSelectorBehavior.cs
- AutomationPatternInfo.cs
- CellIdBoolean.cs
- MinMaxParagraphWidth.cs
- VectorAnimationUsingKeyFrames.cs
- CodeBinaryOperatorExpression.cs
- SequentialUshortCollection.cs
- Peer.cs
- DataGridViewSelectedCellCollection.cs
- HttpRequestBase.cs
- XmlSchemaObjectCollection.cs
- DeploymentExceptionMapper.cs
- MarshalDirectiveException.cs
- PolicyStatement.cs
- ScrollProperties.cs
- Rotation3DAnimation.cs
- DbExpressionVisitor.cs
- RequiredAttributeAttribute.cs
- __Filters.cs
- PresentationTraceSources.cs
- TemplateParser.cs
- StreamGeometryContext.cs
- OneToOneMappingSerializer.cs
- OleDbConnectionFactory.cs
- SimpleHandlerBuildProvider.cs
- ColumnPropertiesGroup.cs
- Point.cs
- HtmlUtf8RawTextWriter.cs
- ActivityInterfaces.cs
- QueryReaderSettings.cs
- RadialGradientBrush.cs
- FieldReference.cs
- CheckBox.cs
- DataServices.cs
- EncryptedPackage.cs
- RawKeyboardInputReport.cs
- CellParagraph.cs
- HtmlForm.cs
- SqlDataAdapter.cs
- FieldDescriptor.cs
- SHA256Managed.cs
- DiscoveryClientReferences.cs
- DataTableNewRowEvent.cs
- DataRecordInfo.cs
- PageAsyncTask.cs
- SystemColors.cs
- OleDbFactory.cs
- MappedMetaModel.cs
- DbConnectionHelper.cs
- WebPartZoneCollection.cs
- PartialList.cs
- SessionSymmetricTransportSecurityProtocolFactory.cs
- PublisherMembershipCondition.cs
- ChameleonKey.cs
- XmlNodeList.cs
- FrameDimension.cs
- SafeUserTokenHandle.cs
- LocalizationComments.cs
- XmlQueryType.cs
- MembershipUser.cs
- ModifyActivitiesPropertyDescriptor.cs
- ExeConfigurationFileMap.cs
- AuthenticationServiceManager.cs
- XmlSignificantWhitespace.cs
- AsyncStreamReader.cs