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
- SafeFileMappingHandle.cs
- EventMappingSettings.cs
- StreamWithDictionary.cs
- Util.cs
- KeyValuePair.cs
- SpinWait.cs
- AuthenticationSection.cs
- ItemType.cs
- NameValueConfigurationCollection.cs
- SerialStream.cs
- SqlClientWrapperSmiStreamChars.cs
- DesignTimeParseData.cs
- XmlUtil.cs
- SqlDataAdapter.cs
- RequestCachePolicyConverter.cs
- DataGridViewDataErrorEventArgs.cs
- DataListItemCollection.cs
- ResetableIterator.cs
- WCFBuildProvider.cs
- WrappedDispatcherException.cs
- SqlError.cs
- RTLAwareMessageBox.cs
- SqlFlattener.cs
- HttpServerVarsCollection.cs
- GridViewSortEventArgs.cs
- ActivationArguments.cs
- XamlTreeBuilder.cs
- Cursor.cs
- DataSpaceManager.cs
- TypeFieldSchema.cs
- RTLAwareMessageBox.cs
- XmlByteStreamReader.cs
- CatalogPartChrome.cs
- DiagnosticTraceSource.cs
- ValueUnavailableException.cs
- GridViewEditEventArgs.cs
- PathData.cs
- DetailsViewPagerRow.cs
- BaseHashHelper.cs
- InvariantComparer.cs
- EventLog.cs
- DbMetaDataFactory.cs
- ExpressionNode.cs
- FixedDSBuilder.cs
- CodeConstructor.cs
- CatalogPart.cs
- HttpAsyncResult.cs
- RecordConverter.cs
- streamingZipPartStream.cs
- ProxyWebPartManager.cs
- ToolZone.cs
- Label.cs
- ReferenceService.cs
- IntSecurity.cs
- HttpCookie.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- Tablet.cs
- GeneralTransform3D.cs
- CodeParameterDeclarationExpression.cs
- SqlReferenceCollection.cs
- Crypto.cs
- SchemaObjectWriter.cs
- IdnElement.cs
- DefaultBinder.cs
- HtmlTernaryTree.cs
- SecurityHelper.cs
- DataControlField.cs
- WebBrowserNavigatingEventHandler.cs
- BaseCollection.cs
- SimpleHandlerBuildProvider.cs
- Sentence.cs
- VirtualPathUtility.cs
- ResXFileRef.cs
- GeneralTransform3DGroup.cs
- PathParser.cs
- ObservableDictionary.cs
- InstancePersistence.cs
- WebPartManager.cs
- LingerOption.cs
- Code.cs
- HMACRIPEMD160.cs
- FixedElement.cs
- CachedFontFamily.cs
- IncrementalCompileAnalyzer.cs
- RegexEditorDialog.cs
- TransactionProtocol.cs
- FlowLayoutPanel.cs
- XmlCollation.cs
- ResourceExpressionBuilder.cs
- InternalBase.cs
- HtmlInputReset.cs
- XamlWrappingReader.cs
- UniqueID.cs
- FormCollection.cs
- DbMetaDataColumnNames.cs
- LinkUtilities.cs
- StickyNoteAnnotations.cs
- SqlCacheDependencyDatabaseCollection.cs
- loginstatus.cs
- ColorTranslator.cs