Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / ComIntegration / MessageUtil.cs / 1 / MessageUtil.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.ComIntegration { using System; using System.IdentityModel.Claims; using System.IdentityModel.Policy; using System.Security.Principal; using System.ServiceModel; using System.ServiceModel.Channels; using System.ServiceModel.Security; using System.Transactions; using System.ServiceModel.Transactions; using System.ServiceModel.Diagnostics; using System.EnterpriseServices; static class MessageUtil { public static WindowsIdentity GetMessageIdentity(Message message) { WindowsIdentity callerIdentity = null; SecurityMessageProperty securityProp; securityProp = message.Properties.Security; if (securityProp != null) { ServiceSecurityContext context; context = securityProp.ServiceSecurityContext; if (context != null) { if (context.WindowsIdentity == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.RequiresWindowsSecurity()); } callerIdentity = context.WindowsIdentity; } } if ((callerIdentity == null) || (callerIdentity.IsAnonymous)) { // No security, no identity, must be anonymous. callerIdentity = SecurityUtils.GetAnonymousIdentity(); } return callerIdentity; } public static Transaction GetMessageTransaction(Message message) { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.Transaction = TransactionOption.Disabled; ServiceDomain.Enter( serviceConfig ); try { return TransactionMessageProperty.TryGetTransaction(message); } finally { ServiceDomain.Leave(); } } } } // 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
- SynchronizationScope.cs
- DescendantOverDescendantQuery.cs
- FixedSOMPage.cs
- HtmlFormWrapper.cs
- SpecialNameAttribute.cs
- DocumentScope.cs
- SqlDataReaderSmi.cs
- WebEncodingValidator.cs
- GrammarBuilderPhrase.cs
- PathGradientBrush.cs
- FeatureAttribute.cs
- SplitterCancelEvent.cs
- StylusCollection.cs
- Calendar.cs
- XmlNodeReader.cs
- CommandSet.cs
- FormsAuthenticationTicket.cs
- ContentAlignmentEditor.cs
- Input.cs
- ClientConfigurationSystem.cs
- HtmlTableCellCollection.cs
- DefaultDiscoveryService.cs
- HeaderUtility.cs
- ScalarRestriction.cs
- SafeHandle.cs
- CodeSubDirectoriesCollection.cs
- SqlGatherProducedAliases.cs
- PeerNameRecordCollection.cs
- ColorConvertedBitmapExtension.cs
- Size.cs
- EncryptedPackageFilter.cs
- ValidatingPropertiesEventArgs.cs
- KeyPullup.cs
- InvalidPrinterException.cs
- ToolStripControlHost.cs
- TaskHelper.cs
- HttpWebRequest.cs
- EncryptedPackage.cs
- DetailsViewCommandEventArgs.cs
- _AutoWebProxyScriptHelper.cs
- WebRequest.cs
- ReservationNotFoundException.cs
- PropertyReferenceExtension.cs
- DataGridViewCellFormattingEventArgs.cs
- EnvelopeVersion.cs
- CreateDataSourceDialog.cs
- DropTarget.cs
- HandlerFactoryWrapper.cs
- Debug.cs
- COM2Properties.cs
- PointHitTestParameters.cs
- StateManagedCollection.cs
- TreeNodeSelectionProcessor.cs
- XmlLoader.cs
- BufferedGraphics.cs
- DataControlPagerLinkButton.cs
- SettingsSection.cs
- EventWaitHandle.cs
- WebScriptServiceHost.cs
- ForceCopyBuildProvider.cs
- Messages.cs
- Vector3DAnimationUsingKeyFrames.cs
- unitconverter.cs
- SortDescriptionCollection.cs
- LocationReferenceValue.cs
- ServiceProviders.cs
- DataGridViewAdvancedBorderStyle.cs
- DataTableMapping.cs
- CodeExpressionCollection.cs
- WindowsTreeView.cs
- BaseComponentEditor.cs
- ImageMap.cs
- RegistrationProxy.cs
- EventMap.cs
- SizeAnimation.cs
- SystemEvents.cs
- SafeCryptHandles.cs
- TickBar.cs
- Brushes.cs
- Point.cs
- WinEventTracker.cs
- LineBreakRecord.cs
- webbrowsersite.cs
- MailMessage.cs
- SqlBinder.cs
- DeferrableContentConverter.cs
- DbSource.cs
- ApplicationHost.cs
- Camera.cs
- RelatedImageListAttribute.cs
- CellNormalizer.cs
- QilVisitor.cs
- SQLDateTime.cs
- XPathItem.cs
- PipeSecurity.cs
- TableDetailsCollection.cs
- CodeDefaultValueExpression.cs
- Helpers.cs
- Int16.cs
- ToolStripStatusLabel.cs