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
- CmsInterop.cs
- ViewGenerator.cs
- SerialErrors.cs
- WebException.cs
- DATA_BLOB.cs
- WorkItem.cs
- VersionValidator.cs
- TypeUtil.cs
- StorageMappingItemCollection.cs
- Utility.cs
- XmlNamespaceDeclarationsAttribute.cs
- PathNode.cs
- OptimizerPatterns.cs
- ObjectMemberMapping.cs
- DefaultObjectMappingItemCollection.cs
- ToolZoneDesigner.cs
- TreeViewItemAutomationPeer.cs
- TextMetrics.cs
- CopyNamespacesAction.cs
- OletxTransactionHeader.cs
- EntityDesignerUtils.cs
- MD5CryptoServiceProvider.cs
- PEFileEvidenceFactory.cs
- XPathDocumentBuilder.cs
- ThrowHelper.cs
- ListenerHandler.cs
- KnownBoxes.cs
- OdbcErrorCollection.cs
- CallbackHandler.cs
- UrlPath.cs
- ImagingCache.cs
- BaseDataListComponentEditor.cs
- ADMembershipProvider.cs
- CatalogPartCollection.cs
- AppearanceEditorPart.cs
- ObjectStateEntry.cs
- DataGridViewCellStateChangedEventArgs.cs
- SafeCryptoHandles.cs
- SingleConverter.cs
- ExpressionBuilder.cs
- JoinCqlBlock.cs
- Parser.cs
- SHA256.cs
- OleDbCommand.cs
- LifetimeManager.cs
- CodeDOMProvider.cs
- SchemaObjectWriter.cs
- RecognizerBase.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- RelationshipEntry.cs
- ToolStripComboBox.cs
- AnonymousIdentificationSection.cs
- DesignerActionTextItem.cs
- UpWmlPageAdapter.cs
- KeyConverter.cs
- TraversalRequest.cs
- ContainsSearchOperator.cs
- AppDomainFactory.cs
- GorillaCodec.cs
- WorkBatch.cs
- RoleServiceManager.cs
- CollectionView.cs
- RadialGradientBrush.cs
- VisualStateChangedEventArgs.cs
- PageAsyncTask.cs
- UnionExpr.cs
- ListBoxItem.cs
- UnsafeNativeMethods.cs
- _SafeNetHandles.cs
- WebPartExportVerb.cs
- RoleManagerSection.cs
- TraceRecord.cs
- CommandID.cs
- Documentation.cs
- HTMLTagNameToTypeMapper.cs
- SecurityManager.cs
- ServiceDescriptionImporter.cs
- WebPartCancelEventArgs.cs
- WebPartDescription.cs
- RegexRunner.cs
- XmlDictionary.cs
- Compiler.cs
- ClientScriptManager.cs
- SettingsPropertyWrongTypeException.cs
- PeerEndPoint.cs
- XmlSchemaInfo.cs
- columnmapfactory.cs
- KeyBinding.cs
- DataListCommandEventArgs.cs
- TreeView.cs
- BaseValidator.cs
- ReflectionTypeLoadException.cs
- RegexReplacement.cs
- GlyphElement.cs
- DeflateStream.cs
- ExtractedStateEntry.cs
- PropertyOrder.cs
- EasingKeyFrames.cs
- CodeEntryPointMethod.cs
- Transform.cs