Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Principal / GenericPrincipal.cs / 1305376 / GenericPrincipal.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //[....] // // // GenericPrincipal.cs // namespace System.Security.Principal { using System.Runtime.Remoting; using System; using System.Security.Util; using System.Globalization; using System.Diagnostics.Contracts; [Serializable] [System.Runtime.InteropServices.ComVisible(true)] public class GenericPrincipal : IPrincipal { private IIdentity m_identity; private string[] m_roles; public GenericPrincipal (IIdentity identity, string[] roles) { if (identity == null) throw new ArgumentNullException("identity"); Contract.EndContractBlock(); m_identity = identity; if (roles != null) { m_roles = new string[roles.Length]; for (int i = 0; i < roles.Length; ++i) { m_roles[i] = roles[i]; } } else { m_roles = null; } } public virtual IIdentity Identity { get { return m_identity; } } public virtual bool IsInRole (string role) { if (role == null || m_roles == null) return false; for (int i = 0; i < m_roles.Length; ++i) { if (m_roles[i] != null && String.Compare(m_roles[i], role, StringComparison.OrdinalIgnoreCase) == 0) return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //[....] // // // GenericPrincipal.cs // namespace System.Security.Principal { using System.Runtime.Remoting; using System; using System.Security.Util; using System.Globalization; using System.Diagnostics.Contracts; [Serializable] [System.Runtime.InteropServices.ComVisible(true)] public class GenericPrincipal : IPrincipal { private IIdentity m_identity; private string[] m_roles; public GenericPrincipal (IIdentity identity, string[] roles) { if (identity == null) throw new ArgumentNullException("identity"); Contract.EndContractBlock(); m_identity = identity; if (roles != null) { m_roles = new string[roles.Length]; for (int i = 0; i < roles.Length; ++i) { m_roles[i] = roles[i]; } } else { m_roles = null; } } public virtual IIdentity Identity { get { return m_identity; } } public virtual bool IsInRole (string role) { if (role == null || m_roles == null) return false; for (int i = 0; i < m_roles.Length; ++i) { if (m_roles[i] != null && String.Compare(m_roles[i], role, StringComparison.OrdinalIgnoreCase) == 0) return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RightsManagementEncryptedStream.cs
- X509Utils.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- SqlClientPermission.cs
- BlockUIContainer.cs
- MultiPropertyDescriptorGridEntry.cs
- HideDisabledControlAdapter.cs
- HttpAsyncResult.cs
- FixedPageProcessor.cs
- MemberPathMap.cs
- XmlElement.cs
- Light.cs
- ErrorWrapper.cs
- SmtpSection.cs
- SymbolMethod.cs
- __Error.cs
- WebPartCatalogCloseVerb.cs
- CodeArgumentReferenceExpression.cs
- XslCompiledTransform.cs
- HttpRequestMessageProperty.cs
- TemplateControl.cs
- ColorDialog.cs
- CharAnimationBase.cs
- StaticSiteMapProvider.cs
- TextParagraph.cs
- ProxyWebPart.cs
- HttpServerVarsCollection.cs
- MarkupCompiler.cs
- BulletedListDesigner.cs
- ProfilePropertyNameValidator.cs
- ComponentDispatcher.cs
- versioninfo.cs
- EdmPropertyAttribute.cs
- SystemThemeKey.cs
- DoubleLinkList.cs
- RightsManagementEncryptedStream.cs
- TrustManager.cs
- ToolboxItem.cs
- MemoryRecordBuffer.cs
- XmlWellformedWriterHelpers.cs
- ExitEventArgs.cs
- CardSpaceException.cs
- TypeConverterHelper.cs
- Grant.cs
- Point3DAnimationBase.cs
- CodeMemberField.cs
- LifetimeServices.cs
- Brush.cs
- URLAttribute.cs
- StructuredType.cs
- HWStack.cs
- RecognizedPhrase.cs
- JavaScriptSerializer.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- SizeConverter.cs
- CanonicalFormWriter.cs
- ToolStripCollectionEditor.cs
- Gdiplus.cs
- CreateUserWizardAutoFormat.cs
- TableSectionStyle.cs
- WebControlAdapter.cs
- SqlDataSourceStatusEventArgs.cs
- ServiceOperationHelpers.cs
- ReaderContextStackData.cs
- TaskFormBase.cs
- DeclarativeConditionsCollection.cs
- AbstractSvcMapFileLoader.cs
- ClientConvert.cs
- ImageAutomationPeer.cs
- SoapEnvelopeProcessingElement.cs
- TemplateControl.cs
- SoapHeaderException.cs
- RoutedCommand.cs
- DefinitionBase.cs
- TdsParserStaticMethods.cs
- WhitespaceReader.cs
- HttpCacheVary.cs
- DispatcherExceptionEventArgs.cs
- FixedFlowMap.cs
- BasePropertyDescriptor.cs
- FigureParagraph.cs
- SqlConnectionManager.cs
- DescendantQuery.cs
- OpCopier.cs
- XmlWhitespace.cs
- DataControlFieldHeaderCell.cs
- Identity.cs
- UnsafeNativeMethods.cs
- ExpressionPrefixAttribute.cs
- PointKeyFrameCollection.cs
- KerberosReceiverSecurityToken.cs
- MatrixAnimationUsingKeyFrames.cs
- FlowDocumentFormatter.cs
- WindowsStartMenu.cs
- RNGCryptoServiceProvider.cs
- StylusEventArgs.cs
- DataKeyCollection.cs
- ParenthesizePropertyNameAttribute.cs
- DelegateTypeInfo.cs
- GZipDecoder.cs