Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Configuration / AuthenticationModulesSection.cs / 1 / AuthenticationModulesSection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net.Configuration { using System.Configuration; using System.Collections.Generic; using System.Globalization; using System.Net; using System.Threading; public sealed class AuthenticationModulesSection : ConfigurationSection { public AuthenticationModulesSection() { this.properties.Add(this.authenticationModules); } protected override void PostDeserialize() { // Perf optimization. If the configuration is coming from machine.config // It is safe and we don't need to check for permissions. if (EvaluationContext.IsMachineLevel) return; try { ExceptionHelper.UnmanagedPermission.Demand(); } catch (Exception exception) { throw new ConfigurationErrorsException( SR.GetString(SR.net_config_section_permission, ConfigurationStrings.AuthenticationModulesSectionName), exception); } } [ConfigurationProperty("", IsDefaultCollection = true)] public AuthenticationModuleElementCollection AuthenticationModules { get { return (AuthenticationModuleElementCollection)this[this.authenticationModules]; } } protected override void InitializeDefault() { #if !FEATURE_PAL // Security this.AuthenticationModules.Add( new AuthenticationModuleElement(typeof(NegotiateClient).AssemblyQualifiedName)); this.AuthenticationModules.Add( new AuthenticationModuleElement(typeof(KerberosClient).AssemblyQualifiedName)); this.AuthenticationModules.Add( new AuthenticationModuleElement(typeof(NtlmClient).AssemblyQualifiedName)); this.AuthenticationModules.Add( new AuthenticationModuleElement(typeof(DigestClient).AssemblyQualifiedName)); this.AuthenticationModules.Add( new AuthenticationModuleElement(typeof(BasicClient).AssemblyQualifiedName)); #endif // !FEATURE_PAL // Security } protected override ConfigurationPropertyCollection Properties { get { return this.properties; } } ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); readonly ConfigurationProperty authenticationModules = new ConfigurationProperty(null, typeof(AuthenticationModuleElementCollection), null, ConfigurationPropertyOptions.IsDefaultCollection); } internal sealed class AuthenticationModulesSectionInternal { internal AuthenticationModulesSectionInternal(AuthenticationModulesSection section) { if (section.AuthenticationModules.Count > 0) { this.authenticationModules = new List(section.AuthenticationModules.Count); foreach(AuthenticationModuleElement authenticationModuleElement in section.AuthenticationModules) { Type type = null; try { type = Type.GetType(authenticationModuleElement.Type, true, true); // verify that its of the proper type of object if (!typeof(IAuthenticationModule).IsAssignableFrom(type)) { throw new InvalidCastException(SR.GetString(SR.net_invalid_cast, type.FullName, "IAuthenticationModule")); } } catch (Exception exception) { if (NclUtilities.IsFatal(exception)) throw; throw new ConfigurationErrorsException(SR.GetString(SR.net_config_authenticationmodules), exception); } catch { throw new ConfigurationErrorsException(SR.GetString(SR.net_config_authenticationmodules), new Exception(SR.GetString(SR.net_nonClsCompliantException))); } this.authenticationModules.Add(type); } } } internal List AuthenticationModules { get { List retval = this.authenticationModules; if (retval == null) { retval = new List (0); } return retval; } } internal static object ClassSyncObject { get { if (classSyncObject == null) { object o = new object(); Interlocked.CompareExchange(ref classSyncObject, o, null); } return classSyncObject; } } static internal AuthenticationModulesSectionInternal GetSection() { lock (AuthenticationModulesSectionInternal.ClassSyncObject) { AuthenticationModulesSection section = PrivilegedConfigurationManager.GetSection(ConfigurationStrings.AuthenticationModulesSectionPath) as AuthenticationModulesSection; if (section == null) return null; return new AuthenticationModulesSectionInternal(section); } } List authenticationModules = null; static object classSyncObject = null; } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DefaultWorkflowSchedulerService.cs
- ClusterSafeNativeMethods.cs
- SchemaDeclBase.cs
- LogFlushAsyncResult.cs
- ConstructorExpr.cs
- ContentPresenter.cs
- ObjectFullSpanRewriter.cs
- FontFamily.cs
- HostingEnvironment.cs
- TypeToArgumentTypeConverter.cs
- NumericUpDown.cs
- FileReader.cs
- StateDesigner.cs
- BitmapEffectGeneralTransform.cs
- EnumValidator.cs
- ConstNode.cs
- PathGeometry.cs
- SendActivity.cs
- Collection.cs
- BinaryUtilClasses.cs
- SerializationEventsCache.cs
- WindowsTab.cs
- HierarchicalDataBoundControl.cs
- VersionedStream.cs
- ArraySegment.cs
- DataGridGeneralPage.cs
- UnsafeNativeMethods.cs
- FormViewPageEventArgs.cs
- ShapingEngine.cs
- EventProviderTraceListener.cs
- MultiSelectRootGridEntry.cs
- DesignerAutoFormatCollection.cs
- NetTcpSectionData.cs
- MarshalByRefObject.cs
- SinglePageViewer.cs
- XsltLoader.cs
- PropertyEmitterBase.cs
- DataGridAddNewRow.cs
- PageCache.cs
- ByeMessage11.cs
- EventWaitHandleSecurity.cs
- ToolStripItemTextRenderEventArgs.cs
- RuntimeCompatibilityAttribute.cs
- TextRunCacheImp.cs
- XmlToDatasetMap.cs
- UserControl.cs
- AudioDeviceOut.cs
- invalidudtexception.cs
- IdentitySection.cs
- Accessible.cs
- FrameworkElementFactory.cs
- Registry.cs
- HttpCachePolicy.cs
- EdmToObjectNamespaceMap.cs
- ScrollItemPattern.cs
- BindingOperations.cs
- ByteViewer.cs
- Form.cs
- XmlSchemaAnyAttribute.cs
- Visitor.cs
- MetabaseSettingsIis7.cs
- DoubleLinkList.cs
- XmlSchemaGroupRef.cs
- WizardPanelChangingEventArgs.cs
- SID.cs
- ListMarkerLine.cs
- TimeSpanMinutesConverter.cs
- DesignerListAdapter.cs
- BitmapMetadataBlob.cs
- XPathSelectionIterator.cs
- TextAdaptor.cs
- GridViewAutoFormat.cs
- DataGridViewButtonCell.cs
- CqlQuery.cs
- TemplateKeyConverter.cs
- CompiledRegexRunner.cs
- GridViewDeletedEventArgs.cs
- ProfileParameter.cs
- CodeTypeDelegate.cs
- DesignTimeSiteMapProvider.cs
- App.cs
- UndoManager.cs
- WebDisplayNameAttribute.cs
- OdbcStatementHandle.cs
- ProvidePropertyAttribute.cs
- WorkflowViewElement.cs
- _NTAuthentication.cs
- HostUtils.cs
- HtmlFormParameterReader.cs
- DoubleLinkListEnumerator.cs
- AppDomainShutdownMonitor.cs
- ManagementPath.cs
- _Events.cs
- UnknownWrapper.cs
- IISMapPath.cs
- HttpRequest.cs
- XhtmlBasicPanelAdapter.cs
- DataGridPageChangedEventArgs.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- FixedStringLookup.cs