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
- List.cs
- ImageMapEventArgs.cs
- ExcCanonicalXml.cs
- BitSet.cs
- CanonicalXml.cs
- XPathNode.cs
- ByteStorage.cs
- ToolBarPanel.cs
- StorageEndPropertyMapping.cs
- ObjectSet.cs
- TextOutput.cs
- QuinticEase.cs
- IDQuery.cs
- HttpVersion.cs
- ActionItem.cs
- UnsafeNativeMethods.cs
- HandoffBehavior.cs
- TypeToStringValueConverter.cs
- ServiceReference.cs
- CodeChecksumPragma.cs
- SizeConverter.cs
- WindowsListViewItem.cs
- AesCryptoServiceProvider.cs
- ColumnMapCopier.cs
- PropertyGeneratedEventArgs.cs
- CommonObjectSecurity.cs
- XmlSchemaAttribute.cs
- MessagePartDescriptionCollection.cs
- ActivationArguments.cs
- PnrpPermission.cs
- InputLangChangeEvent.cs
- RecommendedAsConfigurableAttribute.cs
- recordstate.cs
- FrameworkTextComposition.cs
- CollectionViewGroupRoot.cs
- OutputCacheProfile.cs
- DocumentPageHost.cs
- PenThreadWorker.cs
- XamlParser.cs
- NetworkInterface.cs
- DataBoundLiteralControl.cs
- ConnectivityStatus.cs
- DragDrop.cs
- CharAnimationUsingKeyFrames.cs
- CLSCompliantAttribute.cs
- EnvironmentPermission.cs
- ChangeBlockUndoRecord.cs
- HTMLTagNameToTypeMapper.cs
- TextElementCollection.cs
- GetPageNumberCompletedEventArgs.cs
- CriticalHandle.cs
- SqlRemoveConstantOrderBy.cs
- JsonEncodingStreamWrapper.cs
- DetailsView.cs
- ProviderSettingsCollection.cs
- LookupNode.cs
- DragDeltaEventArgs.cs
- DataGridViewCellValidatingEventArgs.cs
- MultiBindingExpression.cs
- MatrixUtil.cs
- SqlPersonalizationProvider.cs
- SafeCryptoHandles.cs
- GeneralTransform3DGroup.cs
- Descriptor.cs
- GenericTypeParameterBuilder.cs
- DataGridCheckBoxColumn.cs
- SmiGettersStream.cs
- TextPatternIdentifiers.cs
- ItemCheckEvent.cs
- MultipartIdentifier.cs
- PageCache.cs
- TextElementEnumerator.cs
- BitmapDownload.cs
- Registry.cs
- TagNameToTypeMapper.cs
- SpotLight.cs
- HttpListenerTimeoutManager.cs
- CompiledRegexRunnerFactory.cs
- TreeViewHitTestInfo.cs
- Reference.cs
- CommonServiceBehaviorElement.cs
- DecoderNLS.cs
- RawStylusActions.cs
- GeneralTransformCollection.cs
- ConvertEvent.cs
- HttpHandlerAction.cs
- Geometry.cs
- ComponentEvent.cs
- DeleteHelper.cs
- SequentialOutput.cs
- XsltArgumentList.cs
- Matrix.cs
- QilUnary.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- _IPv6Address.cs
- CheckoutException.cs
- DefaultTextStore.cs
- StylusButton.cs
- XPathNavigatorReader.cs
- Brush.cs