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
- SrgsDocumentParser.cs
- C14NUtil.cs
- AbstractExpressions.cs
- BitmapEffectDrawingContent.cs
- SessionStateUtil.cs
- MatrixKeyFrameCollection.cs
- ConfigurationPermission.cs
- HtmlElementEventArgs.cs
- storepermissionattribute.cs
- UnicastIPAddressInformationCollection.cs
- SoapReflectionImporter.cs
- CacheAxisQuery.cs
- WebPartHelpVerb.cs
- ParameterReplacerVisitor.cs
- DispatcherExceptionFilterEventArgs.cs
- EventSchemaTraceListener.cs
- UrlMappingCollection.cs
- DataSourceExpression.cs
- ManipulationDevice.cs
- ArrayWithOffset.cs
- RemotingSurrogateSelector.cs
- Material.cs
- CompilerTypeWithParams.cs
- TableStyle.cs
- RequestSecurityTokenResponseCollection.cs
- OracleSqlParser.cs
- MetafileHeaderWmf.cs
- FileDialogCustomPlace.cs
- ExceptionTranslationTable.cs
- ItemContainerGenerator.cs
- ConnectionConsumerAttribute.cs
- Transform.cs
- PeerResolverMode.cs
- SrgsRulesCollection.cs
- ProxyGenerationError.cs
- CopyNamespacesAction.cs
- ManipulationInertiaStartingEventArgs.cs
- ProofTokenCryptoHandle.cs
- FaultHandlingFilter.cs
- TextViewElement.cs
- SafeRegistryKey.cs
- StorageInfo.cs
- WindowsToolbar.cs
- EdmType.cs
- FileDocument.cs
- OAVariantLib.cs
- PointLight.cs
- ColorAnimationUsingKeyFrames.cs
- ProbeDuplexCD1AsyncResult.cs
- Pool.cs
- DesignerTransactionCloseEvent.cs
- ScrollBarRenderer.cs
- XPathSelectionIterator.cs
- PathGradientBrush.cs
- UserValidatedEventArgs.cs
- CodeCommentStatementCollection.cs
- SQLString.cs
- GeometryValueSerializer.cs
- HttpDebugHandler.cs
- TypeSemantics.cs
- StreamInfo.cs
- ContentValidator.cs
- DiagnosticsConfigurationHandler.cs
- BufferedStream.cs
- SafeBuffer.cs
- COMException.cs
- GenericAuthenticationEventArgs.cs
- String.cs
- HtmlButton.cs
- HttpDictionary.cs
- XsdValidatingReader.cs
- _NativeSSPI.cs
- TypeRefElement.cs
- ExtentJoinTreeNode.cs
- BufferedWebEventProvider.cs
- ResXFileRef.cs
- NameTable.cs
- SqlTopReducer.cs
- InfiniteIntConverter.cs
- AutomationPeer.cs
- BitmapEffectDrawing.cs
- ResourceReferenceKeyNotFoundException.cs
- Point4DValueSerializer.cs
- SafeCryptHandles.cs
- OutputCacheProfile.cs
- IndexedString.cs
- AccessorTable.cs
- DoubleSumAggregationOperator.cs
- FormCollection.cs
- StreamingContext.cs
- XPathSingletonIterator.cs
- InplaceBitmapMetadataWriter.cs
- OdbcReferenceCollection.cs
- SmiSettersStream.cs
- ServiceHandle.cs
- EventRoute.cs
- WindowsClaimSet.cs
- _NegotiateClient.cs
- DataServiceHostFactory.cs
- ObjectFactoryCodeDomTreeGenerator.cs