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
- SymLanguageVendor.cs
- WindowsGraphics.cs
- BulletedList.cs
- UIElementParagraph.cs
- DataContractSet.cs
- ExtensionWindowResizeGrip.cs
- HtmlShimManager.cs
- BufferedGraphicsContext.cs
- TextBoxDesigner.cs
- GenericWebPart.cs
- InertiaExpansionBehavior.cs
- MessageQueuePermissionAttribute.cs
- RenderCapability.cs
- NamespaceInfo.cs
- TextMessageEncodingElement.cs
- BitmapMetadata.cs
- Size3DValueSerializer.cs
- DriveNotFoundException.cs
- BasicCellRelation.cs
- TextAnchor.cs
- ToolCreatedEventArgs.cs
- WebConfigurationHost.cs
- SearchExpression.cs
- AddInBase.cs
- WebPartActionVerb.cs
- CustomTrackingQuery.cs
- AnnotationComponentManager.cs
- ReliableChannelBinder.cs
- QilXmlReader.cs
- DependencyObject.cs
- GenericRootAutomationPeer.cs
- ItemType.cs
- Transactions.cs
- UsernameTokenFactoryCredential.cs
- QilGeneratorEnv.cs
- EventMappingSettingsCollection.cs
- GridSplitter.cs
- IriParsingElement.cs
- SQLMembershipProvider.cs
- ScrollItemProviderWrapper.cs
- SiteMapHierarchicalDataSourceView.cs
- DisplayInformation.cs
- EventLogReader.cs
- RequestTimeoutManager.cs
- MetadataProperty.cs
- PermissionRequestEvidence.cs
- Point4DValueSerializer.cs
- FormatException.cs
- Point3DAnimation.cs
- LookupNode.cs
- SecurityTokenProvider.cs
- WorkflowRuntimeEndpoint.cs
- HttpListenerRequest.cs
- LayoutUtils.cs
- DataGridCellClipboardEventArgs.cs
- Utils.cs
- ObjectConverter.cs
- Util.cs
- TransformGroup.cs
- HtmlInputRadioButton.cs
- DataGridViewCheckBoxCell.cs
- OdbcFactory.cs
- CorrelationRequestContext.cs
- BuildProvider.cs
- XmlWellformedWriterHelpers.cs
- Camera.cs
- UnsafeNativeMethods.cs
- StylusButton.cs
- SecurityTokenTypes.cs
- LookupTables.cs
- HttpFileCollection.cs
- CalendarTable.cs
- ILGenerator.cs
- CultureSpecificStringDictionary.cs
- Visitor.cs
- XmlSchemaParticle.cs
- FormatConvertedBitmap.cs
- CodeMemberMethod.cs
- ImpersonationContext.cs
- PropertyGridCommands.cs
- XmlSchemaComplexType.cs
- PaperSize.cs
- StrokeCollectionDefaultValueFactory.cs
- SqlStream.cs
- SerializationEventsCache.cs
- ContextDataSource.cs
- AuthenticationManager.cs
- DataSourceControlBuilder.cs
- ControlParameter.cs
- AxisAngleRotation3D.cs
- FontWeights.cs
- ArraySegment.cs
- ManagementOperationWatcher.cs
- XPathDocument.cs
- ServiceNotStartedException.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- LinqDataSourceValidationException.cs
- SortedSetDebugView.cs
- ContextMenu.cs
- DataGridViewLinkCell.cs