Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / X509ClientCertificateAuthenticationElement.cs / 1 / X509ClientCertificateAuthenticationElement.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System; using System.ServiceModel; using System.Configuration; using System.ServiceModel.Channels; using System.ServiceModel.Security; using System.Xml; using System.Security.Cryptography.X509Certificates; using System.IdentityModel.Selectors; public sealed partial class X509ClientCertificateAuthenticationElement : ConfigurationElement { public X509ClientCertificateAuthenticationElement() { } [ConfigurationProperty(ConfigurationStrings.CustomCertificateValidatorType, DefaultValue = "")] [StringValidator(MinLength = 0)] public string CustomCertificateValidatorType { get { return (string)base[ConfigurationStrings.CustomCertificateValidatorType]; } set { if (String.IsNullOrEmpty(value)) { value = String.Empty; } base[ConfigurationStrings.CustomCertificateValidatorType] = value; } } [ConfigurationProperty(ConfigurationStrings.CertificateValidationMode, DefaultValue = X509ClientCertificateAuthentication.DefaultCertificateValidationMode)] [ServiceModelEnumValidator(typeof(X509CertificateValidationModeHelper))] public X509CertificateValidationMode CertificateValidationMode { get { return (X509CertificateValidationMode)base[ConfigurationStrings.CertificateValidationMode]; } set { base[ConfigurationStrings.CertificateValidationMode] = value; } } [ConfigurationProperty(ConfigurationStrings.RevocationMode, DefaultValue = X509ClientCertificateAuthentication.DefaultRevocationMode)] [StandardRuntimeEnumValidator(typeof(X509RevocationMode))] public X509RevocationMode RevocationMode { get { return (X509RevocationMode)base[ConfigurationStrings.RevocationMode]; } set { base[ConfigurationStrings.RevocationMode] = value; } } [ConfigurationProperty(ConfigurationStrings.TrustedStoreLocation, DefaultValue = X509ClientCertificateAuthentication.DefaultTrustedStoreLocation)] [StandardRuntimeEnumValidator(typeof(StoreLocation))] public StoreLocation TrustedStoreLocation { get { return (StoreLocation)base[ConfigurationStrings.TrustedStoreLocation]; } set { base[ConfigurationStrings.TrustedStoreLocation] = value; } } [ConfigurationProperty(ConfigurationStrings.IncludeWindowsGroups, DefaultValue = SspiSecurityTokenProvider.DefaultExtractWindowsGroupClaims)] public bool IncludeWindowsGroups { get { return (bool)base[ConfigurationStrings.IncludeWindowsGroups]; } set { base[ConfigurationStrings.IncludeWindowsGroups] = value; } } [ConfigurationProperty(ConfigurationStrings.MapClientCertificateToWindowsAccount, DefaultValue = X509ClientCertificateAuthentication.DefaultMapCertificateToWindowsAccount)] public bool MapClientCertificateToWindowsAccount { get { return (bool)base[ConfigurationStrings.MapClientCertificateToWindowsAccount]; } set { base[ConfigurationStrings.MapClientCertificateToWindowsAccount] = value; } } public void Copy(X509ClientCertificateAuthenticationElement from) { if (this.IsReadOnly()) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigReadOnly))); } if (null == from) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("from"); } this.CertificateValidationMode = from.CertificateValidationMode; this.RevocationMode = from.RevocationMode; this.TrustedStoreLocation = from.TrustedStoreLocation; this.IncludeWindowsGroups = from.IncludeWindowsGroups; this.MapClientCertificateToWindowsAccount = from.MapClientCertificateToWindowsAccount; this.CustomCertificateValidatorType = from.CustomCertificateValidatorType; } internal void ApplyConfiguration(X509ClientCertificateAuthentication cert) { if (cert == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("cert"); } cert.CertificateValidationMode = this.CertificateValidationMode; cert.RevocationMode = this.RevocationMode; cert.TrustedStoreLocation = this.TrustedStoreLocation; cert.IncludeWindowsGroups = this.IncludeWindowsGroups; cert.MapClientCertificateToWindowsAccount = this.MapClientCertificateToWindowsAccount; if (!string.IsNullOrEmpty(this.CustomCertificateValidatorType)) { Type validatorType = System.Type.GetType(this.CustomCertificateValidatorType, true); if (!typeof(X509CertificateValidator).IsAssignableFrom(validatorType)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException( SR.GetString(SR.ConfigInvalidCertificateValidatorType, this.CustomCertificateValidatorType, typeof(X509CertificateValidator).ToString()))); } cert.CustomCertificateValidator = (X509CertificateValidator)Activator.CreateInstance(validatorType); } } } } // 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
- ReadOnlyHierarchicalDataSourceView.cs
- FloatAverageAggregationOperator.cs
- ScrollContentPresenter.cs
- OdbcUtils.cs
- BaseProcessor.cs
- DoubleSumAggregationOperator.cs
- EdmValidator.cs
- XPathAncestorQuery.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- HtmlInputCheckBox.cs
- ActivationServices.cs
- Link.cs
- TableDetailsCollection.cs
- ScriptReferenceBase.cs
- PanelContainerDesigner.cs
- ToolStripRenderEventArgs.cs
- WmlCalendarAdapter.cs
- ScriptingAuthenticationServiceSection.cs
- Int32Rect.cs
- PackageDigitalSignature.cs
- HijriCalendar.cs
- Boolean.cs
- DataGridSortCommandEventArgs.cs
- ExternalException.cs
- ActivityValidator.cs
- GradientStop.cs
- OdbcConnectionStringbuilder.cs
- TextParagraph.cs
- FixedSOMPageConstructor.cs
- TypeDescriptionProviderAttribute.cs
- LoginView.cs
- Keywords.cs
- ToolZone.cs
- InstancePersistenceException.cs
- EntityDataSourceEntityTypeFilterItem.cs
- SQLDateTime.cs
- DetailsViewAutoFormat.cs
- SafeMemoryMappedFileHandle.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- InstanceLockLostException.cs
- hebrewshape.cs
- XmlAttributeOverrides.cs
- CLRBindingWorker.cs
- ServiceTimeoutsElement.cs
- WindowsComboBox.cs
- MemoryStream.cs
- RowToParametersTransformer.cs
- SymbolPair.cs
- EmptyReadOnlyDictionaryInternal.cs
- SchemaNamespaceManager.cs
- ImportStoreException.cs
- Constraint.cs
- TextOutput.cs
- SemanticAnalyzer.cs
- ArcSegment.cs
- GlyphingCache.cs
- DesignerCapabilities.cs
- PartBasedPackageProperties.cs
- TypePropertyEditor.cs
- XmlQueryStaticData.cs
- ScrollContentPresenter.cs
- _SSPIWrapper.cs
- ComponentEditorForm.cs
- WaitForChangedResult.cs
- RadioButton.cs
- DbProviderFactories.cs
- SqlErrorCollection.cs
- MappingItemCollection.cs
- RewritingSimplifier.cs
- HttpCookieCollection.cs
- WindowsClientElement.cs
- GenericTypeParameterBuilder.cs
- TabPanel.cs
- ParagraphVisual.cs
- EditorPart.cs
- Expression.cs
- ProfileService.cs
- AttributeQuery.cs
- LocalizedNameDescriptionPair.cs
- VectorAnimation.cs
- LostFocusEventManager.cs
- StringSource.cs
- Stylus.cs
- TTSEngineProxy.cs
- LinearGradientBrush.cs
- HttpVersion.cs
- MarshalByRefObject.cs
- FormViewCommandEventArgs.cs
- XmlAnyAttributeAttribute.cs
- CaseInsensitiveHashCodeProvider.cs
- TextTabProperties.cs
- OperandQuery.cs
- CodeGenerator.cs
- VisualBasic.cs
- SelectionEditingBehavior.cs
- AssemblyAssociatedContentFileAttribute.cs
- XmlTypeMapping.cs
- ListViewInsertEventArgs.cs
- QueryModel.cs
- XmlAttribute.cs