Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Description / ServiceCredentials.cs / 1 / ServiceCredentials.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Description { using System.Collections.Generic; using System.Collections.ObjectModel; using System.ServiceModel.Channels; using System.ServiceModel.Dispatcher; using System.IdentityModel.Selectors; using System.Runtime.Serialization; using System.ServiceModel.Security; using System.Net; using System.Security.Principal; using System.ServiceModel.Security.Tokens; using System.Security.Cryptography.X509Certificates; using System.Web.Security; public class ServiceCredentials : SecurityCredentialsManager, IServiceBehavior { UserNamePasswordServiceCredential userName; X509CertificateInitiatorServiceCredential clientCertificate; X509CertificateRecipientServiceCredential serviceCertificate; WindowsServiceCredential windows; IssuedTokenServiceCredential issuedToken; PeerCredential peer; SecureConversationServiceCredential secureConversation; public ServiceCredentials() { this.userName = new UserNamePasswordServiceCredential(); this.clientCertificate = new X509CertificateInitiatorServiceCredential(); this.serviceCertificate = new X509CertificateRecipientServiceCredential(); this.windows = new WindowsServiceCredential(); this.issuedToken = new IssuedTokenServiceCredential(); this.peer = new PeerCredential(); this.secureConversation = new SecureConversationServiceCredential(); } protected ServiceCredentials(ServiceCredentials other) { if (other == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other"); } this.userName = new UserNamePasswordServiceCredential(other.userName); this.clientCertificate = new X509CertificateInitiatorServiceCredential(other.clientCertificate); this.serviceCertificate = new X509CertificateRecipientServiceCredential(other.serviceCertificate); this.windows = new WindowsServiceCredential(other.windows); this.issuedToken = new IssuedTokenServiceCredential(other.issuedToken); this.peer = new PeerCredential(other.peer); this.secureConversation = new SecureConversationServiceCredential(other.secureConversation); } public UserNamePasswordServiceCredential UserNameAuthentication { get { return this.userName; } } public X509CertificateInitiatorServiceCredential ClientCertificate { get { return this.clientCertificate; } } public X509CertificateRecipientServiceCredential ServiceCertificate { get { return this.serviceCertificate; } } public WindowsServiceCredential WindowsAuthentication { get { return this.windows; } } public IssuedTokenServiceCredential IssuedTokenAuthentication { get { return this.issuedToken; } } public PeerCredential Peer { get { return this.peer; } } public SecureConversationServiceCredential SecureConversationAuthentication { get { return this.secureConversation; } } internal static ServiceCredentials CreateDefaultCredentials() { return new ServiceCredentials(); } public override SecurityTokenManager CreateSecurityTokenManager() { return new ServiceCredentialsSecurityTokenManager(this.Clone()); } protected virtual ServiceCredentials CloneCore() { return new ServiceCredentials(this); } public ServiceCredentials Clone() { ServiceCredentials result = CloneCore(); if (result == null || result.GetType() != this.GetType()) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException(SR.GetString(SR.CloneNotImplementedCorrectly, this.GetType(), (result != null)? result.ToString() : "null"))); } return result; } void IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase) { } void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, Collectionendpoints, BindingParameterCollection parameters) { if (parameters == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parameters"); } // throw if bindingParameters already has a SecurityCredentialsManager SecurityCredentialsManager otherCredentialsManager = parameters.Find (); if (otherCredentialsManager != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.MultipleSecurityCredentialsManagersInServiceBindingParameters, otherCredentialsManager))); } parameters.Add(this); } void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase) { } internal void MakeReadOnly() { this.ClientCertificate.MakeReadOnly(); this.IssuedTokenAuthentication.MakeReadOnly(); this.Peer.MakeReadOnly(); this.SecureConversationAuthentication.MakeReadOnly(); this.ServiceCertificate.MakeReadOnly(); this.UserNameAuthentication.MakeReadOnly(); this.WindowsAuthentication.MakeReadOnly(); } } } // 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
- XsltConvert.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- ProviderSettings.cs
- SoapAttributeAttribute.cs
- PriorityQueue.cs
- SqlDataAdapter.cs
- ElementMarkupObject.cs
- ListBoxAutomationPeer.cs
- HtmlMeta.cs
- TouchesCapturedWithinProperty.cs
- HttpNamespaceReservationInstallComponent.cs
- DiagnosticTraceSource.cs
- MdImport.cs
- TypeGeneratedEventArgs.cs
- OSFeature.cs
- ConfigsHelper.cs
- RelationalExpressions.cs
- SqlDataSourceConnectionPanel.cs
- ProcessInfo.cs
- ClientApiGenerator.cs
- IndentedWriter.cs
- KeyMatchBuilder.cs
- WMIGenerator.cs
- XmlSchemaAny.cs
- HashAlgorithm.cs
- RuntimeHelpers.cs
- COM2ExtendedBrowsingHandler.cs
- BackgroundFormatInfo.cs
- COM2Enum.cs
- UpdatePanelTrigger.cs
- LoginCancelEventArgs.cs
- cookieexception.cs
- ComEventsMethod.cs
- AttributeTableBuilder.cs
- DetailsView.cs
- WebPartConnectionCollection.cs
- PipeStream.cs
- DurableDispatcherAddressingFault.cs
- QuaternionAnimationUsingKeyFrames.cs
- SkewTransform.cs
- Helpers.cs
- filewebrequest.cs
- AnimationTimeline.cs
- CodeDomConfigurationHandler.cs
- OpenTypeLayout.cs
- XhtmlBasicListAdapter.cs
- HttpRuntime.cs
- Script.cs
- DBConcurrencyException.cs
- GetWinFXPath.cs
- HttpGetProtocolReflector.cs
- SoapSchemaMember.cs
- ExpressionParser.cs
- XmlSignatureProperties.cs
- TransformGroup.cs
- StringUtil.cs
- ExpressionBindingCollection.cs
- EnglishPluralizationService.cs
- EmptyReadOnlyDictionaryInternal.cs
- SqlRowUpdatedEvent.cs
- RawStylusActions.cs
- ArraySegment.cs
- ScrollChangedEventArgs.cs
- UnknownBitmapDecoder.cs
- IndicCharClassifier.cs
- CodeDelegateInvokeExpression.cs
- Compilation.cs
- Context.cs
- ValidationError.cs
- remotingproxy.cs
- HasCopySemanticsAttribute.cs
- HttpPostClientProtocol.cs
- URLMembershipCondition.cs
- TimeoutConverter.cs
- GridViewDeletedEventArgs.cs
- CultureSpecificCharacterBufferRange.cs
- MergeEnumerator.cs
- WebBrowserEvent.cs
- ResXBuildProvider.cs
- FamilyTypefaceCollection.cs
- BamlRecords.cs
- FontUnitConverter.cs
- EntityClassGenerator.cs
- BitmapEffectGeneralTransform.cs
- SqlCommandSet.cs
- NavigatorInput.cs
- DocumentViewerBaseAutomationPeer.cs
- ISFTagAndGuidCache.cs
- CodeIdentifier.cs
- ErrorTableItemStyle.cs
- DocComment.cs
- AccessibleObject.cs
- Size3D.cs
- SHA1CryptoServiceProvider.cs
- AssociationEndMember.cs
- AVElementHelper.cs
- CompositionTarget.cs
- TextLineResult.cs
- ActivityDesignerLayoutSerializers.cs
- EntityCollection.cs