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
- ThicknessConverter.cs
- DesignerToolboxInfo.cs
- Util.cs
- AvTraceFormat.cs
- DiscoveryClientBindingElement.cs
- PropertyEntry.cs
- RegexParser.cs
- ContainerSelectorBehavior.cs
- MemoryRecordBuffer.cs
- ObjectComplexPropertyMapping.cs
- FileNotFoundException.cs
- Translator.cs
- MachineKeyConverter.cs
- DataGridViewRowHeaderCell.cs
- CodeTypeDeclarationCollection.cs
- httpserverutility.cs
- SchemaNames.cs
- TextEditorThreadLocalStore.cs
- UnaryExpression.cs
- BamlBinaryWriter.cs
- MultipleViewProviderWrapper.cs
- SoapFault.cs
- TailPinnedEventArgs.cs
- SoapMessage.cs
- _LazyAsyncResult.cs
- SQLDecimalStorage.cs
- CanExecuteRoutedEventArgs.cs
- ExpressionBindingCollection.cs
- NegationPusher.cs
- SessionStateItemCollection.cs
- EncodingInfo.cs
- InternalCompensate.cs
- WriteableBitmap.cs
- complextypematerializer.cs
- StateInitialization.cs
- SvcMapFileLoader.cs
- NextPreviousPagerField.cs
- SplitterPanelDesigner.cs
- Byte.cs
- WebPartConnectionsDisconnectVerb.cs
- MailWebEventProvider.cs
- _ScatterGatherBuffers.cs
- InputLanguageEventArgs.cs
- ExpressionTable.cs
- RootProfilePropertySettingsCollection.cs
- AliasExpr.cs
- VariableQuery.cs
- PageParserFilter.cs
- CreateUserErrorEventArgs.cs
- ResourceManagerWrapper.cs
- EncryptedKey.cs
- BrowserTree.cs
- CodeTypeMember.cs
- XPathParser.cs
- ActivityExecutorDelegateInfo.cs
- ResourceType.cs
- AssemblyCollection.cs
- isolationinterop.cs
- DeflateStreamAsyncResult.cs
- DatatypeImplementation.cs
- ValidatorCompatibilityHelper.cs
- ScriptReferenceEventArgs.cs
- BamlTreeNode.cs
- AuthStoreRoleProvider.cs
- TextBox.cs
- ScaleTransform3D.cs
- DayRenderEvent.cs
- StylusPointPropertyId.cs
- AnnotationResourceChangedEventArgs.cs
- DataGridViewCellLinkedList.cs
- EdmSchemaAttribute.cs
- HttpDebugHandler.cs
- SqlGatherProducedAliases.cs
- Lazy.cs
- PathGeometry.cs
- ColorConverter.cs
- TextTreeNode.cs
- NullableIntSumAggregationOperator.cs
- ConfigurationPropertyCollection.cs
- SqlReferenceCollection.cs
- DataGridViewRowPostPaintEventArgs.cs
- CommandField.cs
- EDesignUtil.cs
- SecureUICommand.cs
- XmlHierarchicalEnumerable.cs
- PassportAuthenticationEventArgs.cs
- DataExpression.cs
- WinEventHandler.cs
- InternalRelationshipCollection.cs
- ArrayElementGridEntry.cs
- Localizer.cs
- SelectingProviderEventArgs.cs
- BulletDecorator.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- SynthesizerStateChangedEventArgs.cs
- TransformerInfo.cs
- SapiRecoInterop.cs
- MailMessageEventArgs.cs
- StylusSystemGestureEventArgs.cs
- SynchronizedInputPattern.cs