Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / RoleProviderPrincipal.cs / 2 / RoleProviderPrincipal.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Security { using System; using System.Runtime.CompilerServices; using System.ServiceModel; using System.Security.Principal; using System.ServiceModel.Security; using System.Web.Security; sealed class RoleProviderPrincipal : IPrincipal { static bool defaultRoleProviderSet = false; static object defaultRoleProvider; object roleProvider; ServiceSecurityContext securityContext; public RoleProviderPrincipal(object roleProvider, ServiceSecurityContext securityContext) { this.roleProvider = roleProvider; this.securityContext = securityContext; } public IIdentity Identity { get { return this.securityContext.PrimaryIdentity; } } [MethodImpl(MethodImplOptions.NoInlining)] public bool IsInRole(string role) { object roleProvider = this.roleProvider ?? GetRoleProvider(); RoleProvider rp = roleProvider as RoleProvider; if ( rp != null) { return rp.IsUserInRole(this.securityContext.PrimaryIdentity.Name, role); } return false; } // This method used to be static and had this comment, made instance as part of AH fix [[....]] 8/2008 // Perf benefit: Roles.Enabled call is expensive due to CAS. [MethodImpl(MethodImplOptions.NoInlining)] object GetRoleProvider() { if (!defaultRoleProviderSet) { defaultRoleProvider = Roles.Enabled ? Roles.Provider : null; defaultRoleProviderSet = true; } return defaultRoleProvider; } } } // 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
- ILGenerator.cs
- RectangleGeometry.cs
- HtmlInputFile.cs
- TargetControlTypeAttribute.cs
- CompilerState.cs
- MachineKeySection.cs
- ToolboxItemImageConverter.cs
- ActivityStateQuery.cs
- Dynamic.cs
- ColorPalette.cs
- AssemblyName.cs
- SmuggledIUnknown.cs
- Activation.cs
- SqlDependency.cs
- SafeTokenHandle.cs
- EntityDataSourceDesigner.cs
- DbProviderServices.cs
- ModelVisual3D.cs
- PhysicalOps.cs
- FilteredAttributeCollection.cs
- FragmentQueryProcessor.cs
- MsdtcWrapper.cs
- TimeoutException.cs
- ConnectionManagementSection.cs
- LocatorGroup.cs
- XamlSerializer.cs
- EntitySqlQueryState.cs
- FlowDocumentFormatter.cs
- SQLMembershipProvider.cs
- ToolStripScrollButton.cs
- BuildProviderCollection.cs
- Stylesheet.cs
- WebPartEditorOkVerb.cs
- AsymmetricAlgorithm.cs
- PropertyValueUIItem.cs
- DesignerListAdapter.cs
- PageHandlerFactory.cs
- WebBrowserContainer.cs
- TriggerActionCollection.cs
- XmlValueConverter.cs
- ExpandoObject.cs
- ModifierKeysValueSerializer.cs
- DataGridColumnHeaderAutomationPeer.cs
- SystemResources.cs
- LocalValueEnumerator.cs
- CopyOfAction.cs
- PermissionToken.cs
- Stack.cs
- ListBindingHelper.cs
- SubstitutionList.cs
- TcpChannelHelper.cs
- TerminateSequence.cs
- StrokeNode.cs
- CatalogZoneBase.cs
- Misc.cs
- TableRowGroupCollection.cs
- DictionarySectionHandler.cs
- XPathScanner.cs
- UnaryNode.cs
- ZipIOLocalFileDataDescriptor.cs
- GradientBrush.cs
- TabControlAutomationPeer.cs
- ApplicationSettingsBase.cs
- Table.cs
- ExclusiveHandleList.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- CommandValueSerializer.cs
- HuffModule.cs
- UnhandledExceptionEventArgs.cs
- EntryPointNotFoundException.cs
- XmlProcessingInstruction.cs
- FixedSOMPageElement.cs
- AssemblyInfo.cs
- ColorContext.cs
- Vector3dCollection.cs
- DragDrop.cs
- IResourceProvider.cs
- Win32Native.cs
- Section.cs
- HelpKeywordAttribute.cs
- CompatibleIComparer.cs
- SqlDataReader.cs
- AmbientLight.cs
- HttpFormatExtensions.cs
- TypeConverterHelper.cs
- InvalidOperationException.cs
- HtmlTernaryTree.cs
- ObjectNavigationPropertyMapping.cs
- TailPinnedEventArgs.cs
- SymbolEqualComparer.cs
- StringExpressionSet.cs
- MetadataItemCollectionFactory.cs
- Rotation3D.cs
- Selection.cs
- LinearQuaternionKeyFrame.cs
- OdbcConnectionOpen.cs
- TimeSpan.cs
- CrossAppDomainChannel.cs
- BounceEase.cs
- RadioButton.cs