Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / Security / Principal / GenericPrincipal.cs / 1 / 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; [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"); 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; [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"); 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
- MasterPageBuildProvider.cs
- TcpSocketManager.cs
- ObjectStateEntryDbDataRecord.cs
- ADRoleFactory.cs
- StrongNameKeyPair.cs
- GatewayDefinition.cs
- TableItemStyle.cs
- UTF7Encoding.cs
- RequestTimeoutManager.cs
- DataDocumentXPathNavigator.cs
- RegexGroup.cs
- BitmapMetadataBlob.cs
- XmlSecureResolver.cs
- UTF7Encoding.cs
- TableParaClient.cs
- XhtmlTextWriter.cs
- TextFormatterImp.cs
- LineUtil.cs
- SortedList.cs
- DataKey.cs
- FormViewModeEventArgs.cs
- DataGridBoundColumn.cs
- EventRoute.cs
- MD5.cs
- ReleaseInstanceMode.cs
- VScrollBar.cs
- LinkDesigner.cs
- PropertyChangingEventArgs.cs
- XmlAutoDetectWriter.cs
- RepeaterItemCollection.cs
- TranslateTransform3D.cs
- ParentQuery.cs
- ProxyGenerationError.cs
- ImmutableCollection.cs
- Translator.cs
- StaticTextPointer.cs
- CodeLabeledStatement.cs
- SqlStream.cs
- FormsAuthenticationCredentials.cs
- ServiceOperationParameter.cs
- StyleBamlTreeBuilder.cs
- HttpModuleActionCollection.cs
- ASCIIEncoding.cs
- QilIterator.cs
- ParseElementCollection.cs
- BooleanExpr.cs
- BrushValueSerializer.cs
- HttpHandlersSection.cs
- DoubleMinMaxAggregationOperator.cs
- EntitySqlQueryState.cs
- GridSplitter.cs
- filewebresponse.cs
- DataGridColumn.cs
- CodeIdentifiers.cs
- GroupDescription.cs
- Transactions.cs
- MemoryMappedViewStream.cs
- EventDescriptorCollection.cs
- JavascriptXmlWriterWrapper.cs
- ReadOnlyCollection.cs
- SapiInterop.cs
- SdlChannelSink.cs
- ClientScriptManagerWrapper.cs
- DbProviderConfigurationHandler.cs
- StateFinalizationActivity.cs
- CreateParams.cs
- TreeViewTemplateSelector.cs
- EdmItemCollection.cs
- HostedElements.cs
- BulletedList.cs
- HMACSHA1.cs
- Solver.cs
- PenLineJoinValidation.cs
- Exceptions.cs
- X509SecurityToken.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- DataGridViewHitTestInfo.cs
- PictureBox.cs
- PrinterSettings.cs
- SystemIcmpV6Statistics.cs
- DrawToolTipEventArgs.cs
- ResXResourceSet.cs
- ClientSponsor.cs
- StylusPlugInCollection.cs
- InsufficientExecutionStackException.cs
- CompositeControl.cs
- ColorDialog.cs
- DataSourceControlBuilder.cs
- CapabilitiesRule.cs
- GatewayIPAddressInformationCollection.cs
- DataGridViewRowHeaderCell.cs
- HatchBrush.cs
- CanonicalXml.cs
- SqlEnums.cs
- XmlSchemaSimpleContent.cs
- SelectorAutomationPeer.cs
- entityreference_tresulttype.cs
- Rect3DValueSerializer.cs
- BitArray.cs
- NullRuntimeConfig.cs