Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / LocalIdKeyIdentifierClause.cs / 1 / LocalIdKeyIdentifierClause.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Globalization; public class LocalIdKeyIdentifierClause : SecurityKeyIdentifierClause { readonly string localId; readonly Type[] ownerTypes; public LocalIdKeyIdentifierClause(string localId) : this(localId, (Type[])null) { } public LocalIdKeyIdentifierClause(string localId, Type ownerType) : this(localId, ownerType == null ? (Type[])null : new Type[] { ownerType }) { } public LocalIdKeyIdentifierClause(string localId, byte[] derivationNonce, int derivationLength, Type ownerType) : this(null, derivationNonce, derivationLength, ownerType == null ? (Type[])null : new Type[] { ownerType }) { } internal LocalIdKeyIdentifierClause(string localId, Type[] ownerTypes) : this(localId, null, 0, ownerTypes) { } internal LocalIdKeyIdentifierClause(string localId, byte[] derivationNonce, int derivationLength, Type[] ownerTypes) : base(null, derivationNonce, derivationLength) { if (localId == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("localId"); } if (localId == string.Empty) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.LocalIdCannotBeEmpty)); } this.localId = localId; this.ownerTypes = ownerTypes; } public string LocalId { get { return this.localId; } } public Type OwnerType { get { return (this.ownerTypes == null || this.ownerTypes.Length == 0) ? null : this.ownerTypes[0]; } } public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause) { LocalIdKeyIdentifierClause that = keyIdentifierClause as LocalIdKeyIdentifierClause; // PreSharp Bug: Parameter 'that' to this public method must be validated: A null-dereference can occur here. #pragma warning suppress 56506 return ReferenceEquals(this, that) || (that != null && that.Matches(this.localId, this.OwnerType)); } public bool Matches(string localId, Type ownerType) { if (string.IsNullOrEmpty(localId)) return false; if (this.localId != localId) return false; if (this.ownerTypes == null || ownerType == null) return true; for (int i = 0; i < this.ownerTypes.Length; ++i) { if (this.ownerTypes[i] == null || this.ownerTypes[i] == ownerType) return true; } return false; } public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "LocalIdKeyIdentifierClause(LocalId = '{0}', Owner = '{1}')", this.LocalId, this.OwnerType); } } } // 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
- LifetimeServices.cs
- X509SubjectKeyIdentifierClause.cs
- ParseChildrenAsPropertiesAttribute.cs
- QilInvokeEarlyBound.cs
- ViewGenResults.cs
- TiffBitmapEncoder.cs
- StrokeFIndices.cs
- mansign.cs
- FormDocumentDesigner.cs
- CommonObjectSecurity.cs
- ExpandableObjectConverter.cs
- QueryContext.cs
- DeferredReference.cs
- TransactionOptions.cs
- RecordBuilder.cs
- StyleBamlTreeBuilder.cs
- ButtonField.cs
- CmsInterop.cs
- DNS.cs
- SecurityContext.cs
- AttachedAnnotation.cs
- CloudCollection.cs
- TraceHwndHost.cs
- Activity.cs
- DetailsViewInsertedEventArgs.cs
- UserControlBuildProvider.cs
- CriticalFileToken.cs
- EditorPartCollection.cs
- DataRowComparer.cs
- CodeDOMUtility.cs
- PageContent.cs
- DataTemplate.cs
- BitFlagsGenerator.cs
- NativeMethods.cs
- StorageInfo.cs
- DataError.cs
- BrowsableAttribute.cs
- DescriptionAttribute.cs
- SchemaImporter.cs
- OleDbConnection.cs
- ContentFileHelper.cs
- NamedPipeAppDomainProtocolHandler.cs
- X509PeerCertificateAuthenticationElement.cs
- XamlInt32CollectionSerializer.cs
- ToolStripContentPanelRenderEventArgs.cs
- DataRecordInfo.cs
- DrawListViewColumnHeaderEventArgs.cs
- XslCompiledTransform.cs
- List.cs
- RegexStringValidator.cs
- HierarchicalDataBoundControl.cs
- OleDbInfoMessageEvent.cs
- AttributeData.cs
- StorageBasedPackageProperties.cs
- DataGridView.cs
- SoapObjectReader.cs
- CalendarButton.cs
- Blend.cs
- ControlDesigner.cs
- ProgramNode.cs
- SoapReflectionImporter.cs
- BrowserTree.cs
- ADMembershipUser.cs
- TableLayoutSettingsTypeConverter.cs
- DateTimeOffset.cs
- OleDbErrorCollection.cs
- QueryableDataSourceHelper.cs
- MediaContextNotificationWindow.cs
- SqlDataReader.cs
- DataGridParentRows.cs
- Parser.cs
- ProfileParameter.cs
- SimpleApplicationHost.cs
- ValueExpressions.cs
- LoadedEvent.cs
- ExtentJoinTreeNode.cs
- OrderByQueryOptionExpression.cs
- HtmlTableRow.cs
- TagPrefixAttribute.cs
- Bold.cs
- Hash.cs
- PieceDirectory.cs
- ConstrainedDataObject.cs
- versioninfo.cs
- BackStopAuthenticationModule.cs
- SqlDataSourceQueryEditorForm.cs
- Command.cs
- Vector3DAnimationBase.cs
- SHA512Managed.cs
- _LazyAsyncResult.cs
- RepeaterItemCollection.cs
- SafeEventLogWriteHandle.cs
- CompoundFileIOPermission.cs
- TypeValidationEventArgs.cs
- State.cs
- ProxyWebPartConnectionCollection.cs
- HybridWebProxyFinder.cs
- SqlErrorCollection.cs
- Matrix3D.cs
- AnnotationAuthorChangedEventArgs.cs