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
- StopStoryboard.cs
- TextPatternIdentifiers.cs
- FloaterBaseParagraph.cs
- IxmlLineInfo.cs
- ArgumentException.cs
- TaskHelper.cs
- MenuItemStyleCollection.cs
- ChannelTerminatedException.cs
- ColorDialog.cs
- HandledMouseEvent.cs
- ServicePointManager.cs
- Inflater.cs
- FontStretch.cs
- TextRangeAdaptor.cs
- XmlNamespaceMapping.cs
- Attributes.cs
- EventOpcode.cs
- ComponentEditorForm.cs
- TTSVoice.cs
- ArraySortHelper.cs
- Context.cs
- ObjectItemAssemblyLoader.cs
- AssemblyGen.cs
- DbTypeMap.cs
- ExpressionBindingCollection.cs
- AncestorChangedEventArgs.cs
- CriticalFileToken.cs
- EntityDataSourceDataSelectionPanel.cs
- ControlsConfig.cs
- TemplatedControlDesigner.cs
- TreeNodeBindingCollection.cs
- ControllableStoryboardAction.cs
- Floater.cs
- StartUpEventArgs.cs
- _AcceptOverlappedAsyncResult.cs
- PasswordRecovery.cs
- tibetanshape.cs
- XPathAxisIterator.cs
- CompatibleIComparer.cs
- DataBoundControlHelper.cs
- CompiledQueryCacheEntry.cs
- SuspendDesigner.cs
- ReadOnlyObservableCollection.cs
- InstanceCreationEditor.cs
- Point3DIndependentAnimationStorage.cs
- AutoResetEvent.cs
- ScrollChrome.cs
- StreamInfo.cs
- TailCallAnalyzer.cs
- InstanceCreationEditor.cs
- DataReaderContainer.cs
- Activation.cs
- FamilyMap.cs
- SplitterEvent.cs
- ThrowHelper.cs
- AssemblyCache.cs
- SpecularMaterial.cs
- AdjustableArrowCap.cs
- SystemInfo.cs
- ServiceChannelManager.cs
- DefaultHttpHandler.cs
- PropertyHelper.cs
- PixelFormats.cs
- CompressStream.cs
- HandlerBase.cs
- Nodes.cs
- NavigationExpr.cs
- XmlRawWriter.cs
- PipelineModuleStepContainer.cs
- VisualBrush.cs
- WmlLinkAdapter.cs
- EncryptedReference.cs
- LicenseContext.cs
- CharacterMetricsDictionary.cs
- StringWriter.cs
- ChangeDirector.cs
- Comparer.cs
- CatalogZoneBase.cs
- MediaElementAutomationPeer.cs
- DbDataAdapter.cs
- CrossAppDomainChannel.cs
- PerformanceCounterPermissionEntry.cs
- DataGridRow.cs
- SupportingTokenDuplexChannel.cs
- CachingHintValidation.cs
- XmlWriterSettings.cs
- DataGridViewCellStyleChangedEventArgs.cs
- Serializer.cs
- ClientRoleProvider.cs
- IndentedWriter.cs
- GifBitmapEncoder.cs
- NotifyParentPropertyAttribute.cs
- ToolStripContentPanel.cs
- BStrWrapper.cs
- InfoCardListRequest.cs
- UnionCodeGroup.cs
- UpdatePanelTrigger.cs
- UriTemplateDispatchFormatter.cs
- GifBitmapDecoder.cs
- AppSettingsReader.cs