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
- Expr.cs
- InvalidCommandTreeException.cs
- InstanceContextManager.cs
- COAUTHINFO.cs
- TextEffect.cs
- DropTarget.cs
- ExcCanonicalXml.cs
- DbConnectionStringBuilder.cs
- PropertyInfoSet.cs
- OutputBuffer.cs
- QueryableDataSource.cs
- Section.cs
- DataKeyArray.cs
- SubqueryRules.cs
- ScriptHandlerFactory.cs
- log.cs
- IApplicationTrustManager.cs
- QilVisitor.cs
- TraceRecords.cs
- ConvertBinder.cs
- InputReferenceExpression.cs
- InvalidateEvent.cs
- ScalarType.cs
- PartialList.cs
- CompositeScriptReferenceEventArgs.cs
- AuthenticateEventArgs.cs
- AlphabeticalEnumConverter.cs
- EntityContainer.cs
- BitmapFrame.cs
- GetParentChain.cs
- Message.cs
- NativeMethods.cs
- AsnEncodedData.cs
- FormsAuthenticationCredentials.cs
- RegularExpressionValidator.cs
- JapaneseCalendar.cs
- ApplicationManager.cs
- DataObjectFieldAttribute.cs
- ResponseStream.cs
- WebPartChrome.cs
- AttributeTable.cs
- ProfilePropertyNameValidator.cs
- SqlFactory.cs
- DataRecordInfo.cs
- ShapingEngine.cs
- CollectionBuilder.cs
- OdbcConnection.cs
- TextReturnReader.cs
- GatewayIPAddressInformationCollection.cs
- X509CertificateStore.cs
- System.Data.OracleClient_BID.cs
- Imaging.cs
- DoubleConverter.cs
- ServiceTimeoutsBehavior.cs
- XmlBinaryReader.cs
- EventDescriptor.cs
- JsonReaderDelegator.cs
- RowToFieldTransformer.cs
- PlainXmlWriter.cs
- ParameterCollection.cs
- FileLoadException.cs
- _StreamFramer.cs
- ParseNumbers.cs
- Missing.cs
- XmlILStorageConverter.cs
- WebPartHeaderCloseVerb.cs
- InheritanceAttribute.cs
- MD5CryptoServiceProvider.cs
- TableRowGroup.cs
- DataGridViewRowsRemovedEventArgs.cs
- InternalSafeNativeMethods.cs
- BounceEase.cs
- StatusCommandUI.cs
- Label.cs
- JsonDataContract.cs
- LinkTarget.cs
- TypeSystemProvider.cs
- FlowPosition.cs
- XmlCountingReader.cs
- dsa.cs
- RequestUriProcessor.cs
- CommonDialog.cs
- CharEnumerator.cs
- CharacterMetrics.cs
- PrtCap_Base.cs
- TextStore.cs
- TableRow.cs
- CellTreeNode.cs
- NameValueConfigurationCollection.cs
- DataRecordObjectView.cs
- CultureTable.cs
- ExceptionTrace.cs
- EventHandlersStore.cs
- Message.cs
- AdCreatedEventArgs.cs
- MachineKeySection.cs
- FormatConvertedBitmap.cs
- DateTimeUtil.cs
- RunClient.cs
- SystemIPv4InterfaceProperties.cs