Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / ServiceCredentialsElement.cs / 1 / ServiceCredentialsElement.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System.Configuration; using System.ServiceModel; using System.ServiceModel.Description; using System.Globalization; using System.Net.Security; using System.ServiceModel.Security; using System.Security.Cryptography.X509Certificates; public partial class ServiceCredentialsElement : BehaviorExtensionElement { public ServiceCredentialsElement() { } [ConfigurationProperty(ConfigurationStrings.Type, DefaultValue = "")] [StringValidator(MinLength = 0)] public string Type { get { return (string)base[ConfigurationStrings.Type]; } set { if (String.IsNullOrEmpty(value)) { value = String.Empty; } base[ConfigurationStrings.Type] = value; } } [ConfigurationProperty(ConfigurationStrings.ClientCertificate)] public X509InitiatorCertificateServiceElement ClientCertificate { get { return (X509InitiatorCertificateServiceElement)base[ConfigurationStrings.ClientCertificate]; } } [ConfigurationProperty(ConfigurationStrings.ServiceCertificate)] public X509RecipientCertificateServiceElement ServiceCertificate { get { return (X509RecipientCertificateServiceElement)base[ConfigurationStrings.ServiceCertificate]; } } [ConfigurationProperty(ConfigurationStrings.UserNameAuthentication)] public UserNameServiceElement UserNameAuthentication { get { return (UserNameServiceElement)base[ConfigurationStrings.UserNameAuthentication]; } } [ConfigurationProperty(ConfigurationStrings.WindowsAuthentication)] public WindowsServiceElement WindowsAuthentication { get { return (WindowsServiceElement)base[ConfigurationStrings.WindowsAuthentication]; } } [ConfigurationProperty(ConfigurationStrings.Peer)] public PeerCredentialElement Peer { get { return (PeerCredentialElement)base[ConfigurationStrings.Peer]; } } [ConfigurationProperty(ConfigurationStrings.IssuedTokenAuthentication)] public IssuedTokenServiceElement IssuedTokenAuthentication { get { return (IssuedTokenServiceElement)base[ConfigurationStrings.IssuedTokenAuthentication]; } } [ConfigurationProperty(ConfigurationStrings.SecureConversationAuthentication)] public SecureConversationServiceElement SecureConversationAuthentication { get { return (SecureConversationServiceElement)base[ConfigurationStrings.SecureConversationAuthentication]; } } public override void CopyFrom(ServiceModelExtensionElement from) { base.CopyFrom(from); ServiceCredentialsElement source = (ServiceCredentialsElement)from; #pragma warning suppress 56506 //[....]; base.CopyFrom() checks for 'from' being null this.ClientCertificate.Copy(source.ClientCertificate); this.ServiceCertificate.Copy(source.ServiceCertificate); this.UserNameAuthentication.Copy(source.UserNameAuthentication); this.WindowsAuthentication.Copy(source.WindowsAuthentication); this.Peer.Copy(source.Peer); this.IssuedTokenAuthentication.Copy(source.IssuedTokenAuthentication); this.SecureConversationAuthentication.Copy(source.SecureConversationAuthentication); this.Type = source.Type; } protected internal override object CreateBehavior() { ServiceCredentials behavior; if (string.IsNullOrEmpty(this.Type)) { behavior = new ServiceCredentials(); } else { Type credentialsType = System.Type.GetType(this.Type, true); if (!typeof(ServiceCredentials).IsAssignableFrom(credentialsType)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException( SR.GetString(SR.ConfigInvalidServiceCredentialsType, this.Type, credentialsType.AssemblyQualifiedName))); } behavior = (ServiceCredentials)Activator.CreateInstance(credentialsType); } ApplyConfiguration(behavior); return behavior; } protected internal void ApplyConfiguration(ServiceCredentials behavior) { if (behavior == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("behavior"); } PropertyInformationCollection propertyInfo = this.ElementInformation.Properties; if (propertyInfo[ConfigurationStrings.UserNameAuthentication].ValueOrigin != PropertyValueOrigin.Default) { this.UserNameAuthentication.ApplyConfiguration(behavior.UserNameAuthentication); } if (propertyInfo[ConfigurationStrings.WindowsAuthentication].ValueOrigin != PropertyValueOrigin.Default) { this.WindowsAuthentication.ApplyConfiguration(behavior.WindowsAuthentication); } if (propertyInfo[ConfigurationStrings.ClientCertificate].ValueOrigin != PropertyValueOrigin.Default) { this.ClientCertificate.ApplyConfiguration(behavior.ClientCertificate); } if (propertyInfo[ConfigurationStrings.ServiceCertificate].ValueOrigin != PropertyValueOrigin.Default) { this.ServiceCertificate.ApplyConfiguration(behavior.ServiceCertificate); } if (propertyInfo[ConfigurationStrings.Peer].ValueOrigin != PropertyValueOrigin.Default) { this.Peer.ApplyConfiguration(behavior.Peer); } if (propertyInfo[ConfigurationStrings.IssuedTokenAuthentication].ValueOrigin != PropertyValueOrigin.Default) { this.IssuedTokenAuthentication.ApplyConfiguration(behavior.IssuedTokenAuthentication); } if (propertyInfo[ConfigurationStrings.SecureConversationAuthentication].ValueOrigin != PropertyValueOrigin.Default) { this.SecureConversationAuthentication.ApplyConfiguration(behavior.SecureConversationAuthentication); } } public override Type BehaviorType { get { return typeof(ServiceCredentials); } } } } // 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
- DoubleAnimationUsingPath.cs
- ICollection.cs
- GlobalizationSection.cs
- BufferModesCollection.cs
- NetStream.cs
- SqlConnectionFactory.cs
- VisualCollection.cs
- TimeSpanOrInfiniteConverter.cs
- ExpressionBinding.cs
- WebPartDeleteVerb.cs
- BmpBitmapDecoder.cs
- DesignerEventService.cs
- PartDesigner.cs
- KeyPressEvent.cs
- HierarchicalDataBoundControl.cs
- CompatibleComparer.cs
- TraceProvider.cs
- sitestring.cs
- XmlLinkedNode.cs
- XmlDocument.cs
- ObjectSet.cs
- _NativeSSPI.cs
- ToolStripLabel.cs
- SqlServices.cs
- DropDownList.cs
- AnimationClock.cs
- WindowsStatusBar.cs
- RayHitTestParameters.cs
- httpserverutility.cs
- CodeSnippetStatement.cs
- templategroup.cs
- TemplateNameScope.cs
- CustomValidator.cs
- OdbcConnectionFactory.cs
- TabRenderer.cs
- SoapSchemaImporter.cs
- FormViewCommandEventArgs.cs
- FlowchartDesignerCommands.cs
- ClientBuildManager.cs
- SessionConnectionReader.cs
- WebServiceTypeData.cs
- HttpModuleAction.cs
- AutomationIdentifierGuids.cs
- HMACSHA384.cs
- Set.cs
- _NTAuthentication.cs
- IUnknownConstantAttribute.cs
- EventLogEntry.cs
- UndirectedGraph.cs
- CompressedStack.cs
- recordstatescratchpad.cs
- EntityContainerEntitySetDefiningQuery.cs
- ParallelSeparator.xaml.cs
- PropertyGeneratedEventArgs.cs
- ValidationErrorCollection.cs
- Debugger.cs
- ObjectHelper.cs
- SmtpCommands.cs
- LinearKeyFrames.cs
- LoginUtil.cs
- FontStyle.cs
- TypeElementCollection.cs
- DeclaredTypeElement.cs
- MergeExecutor.cs
- FileRecordSequence.cs
- ElapsedEventArgs.cs
- DataGridViewCheckBoxCell.cs
- ProtectedConfigurationSection.cs
- GC.cs
- HelpOperationInvoker.cs
- Header.cs
- MatchingStyle.cs
- ErrorWrapper.cs
- ConsumerConnectionPoint.cs
- DetailsViewRowCollection.cs
- SafeMemoryMappedViewHandle.cs
- ParameterReplacerVisitor.cs
- Configuration.cs
- Relationship.cs
- XmlTextEncoder.cs
- CoTaskMemSafeHandle.cs
- EntityKeyElement.cs
- TdsRecordBufferSetter.cs
- SqlPersonalizationProvider.cs
- VerticalAlignConverter.cs
- ObjRef.cs
- ScrollProviderWrapper.cs
- OleDbParameterCollection.cs
- MatrixTransform.cs
- VirtualDirectoryMapping.cs
- ManagedWndProcTracker.cs
- sqlcontext.cs
- XmlJsonWriter.cs
- WebEventTraceProvider.cs
- RotateTransform3D.cs
- DbMetaDataColumnNames.cs
- InheritanceRules.cs
- XmlSignificantWhitespace.cs
- Quad.cs
- PartitionedDataSource.cs