Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / WSFederationHttpSecurity.cs / 1 / WSFederationHttpSecurity.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel { using System.Diagnostics; using System.Net.Security; using System.ServiceModel.Channels; using System.ServiceModel.Security; public sealed class WSFederationHttpSecurity { internal const WSFederationHttpSecurityMode DefaultMode = WSFederationHttpSecurityMode.Message; WSFederationHttpSecurityMode mode; FederatedMessageSecurityOverHttp messageSecurity; internal WSFederationHttpSecurity() : this(DefaultMode, new FederatedMessageSecurityOverHttp()) { } WSFederationHttpSecurity(WSFederationHttpSecurityMode mode, FederatedMessageSecurityOverHttp messageSecurity) { DiagnosticUtility.DebugAssert(WSFederationHttpSecurityModeHelper.IsDefined(mode), string.Format("Invalid WSFederationHttpSecurityMode value: {0}", mode.ToString())); this.mode = mode; this.messageSecurity = messageSecurity == null ? new FederatedMessageSecurityOverHttp() : messageSecurity; } public WSFederationHttpSecurityMode Mode { get { return this.mode; } set { if (!WSFederationHttpSecurityModeHelper.IsDefined(value)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value")); } this.mode = value; } } public FederatedMessageSecurityOverHttp Message { get { return this.messageSecurity; } } internal SecurityBindingElement CreateMessageSecurity(bool isReliableSessionEnabled, MessageSecurityVersion version) { if (this.mode == WSFederationHttpSecurityMode.Message || this.mode == WSFederationHttpSecurityMode.TransportWithMessageCredential) { return this.messageSecurity.CreateSecurityBindingElement(this.Mode == WSFederationHttpSecurityMode.TransportWithMessageCredential, isReliableSessionEnabled, version); } else { return null; } } internal static bool TryCreate(SecurityBindingElement sbe, WSFederationHttpSecurityMode mode, HttpTransportSecurity transportSecurity, bool isReliableSessionEnabled, MessageSecurityVersion version, out WSFederationHttpSecurity security) { security = null; FederatedMessageSecurityOverHttp messageSecurity = null; if (sbe == null) { mode = WSFederationHttpSecurityMode.None; } else { mode &= WSFederationHttpSecurityMode.Message | WSFederationHttpSecurityMode.TransportWithMessageCredential; DiagnosticUtility.DebugAssert(WSFederationHttpSecurityModeHelper.IsDefined(mode), string.Format("Invalid WSFederationHttpSecurityMode value: {0}", mode.ToString())); if (!FederatedMessageSecurityOverHttp.TryCreate(sbe, mode == WSFederationHttpSecurityMode.TransportWithMessageCredential, isReliableSessionEnabled, version, out messageSecurity)) return false; } security = new WSFederationHttpSecurity(mode, messageSecurity); return true; } } } // 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
- CodeChecksumPragma.cs
- InvokeWebServiceDesigner.cs
- CryptographicAttribute.cs
- MenuItemCollection.cs
- MsmqHostedTransportConfiguration.cs
- BaseResourcesBuildProvider.cs
- SmtpCommands.cs
- FrameworkObject.cs
- SchemaCollectionPreprocessor.cs
- BufferManager.cs
- StrokeNodeEnumerator.cs
- SafeWaitHandle.cs
- DesignerToolboxInfo.cs
- ConcurrentStack.cs
- OverrideMode.cs
- SeparatorAutomationPeer.cs
- OpenFileDialog.cs
- SiteOfOriginContainer.cs
- ToolStripItem.cs
- QilFactory.cs
- PermissionListSet.cs
- FieldBuilder.cs
- XmlStreamNodeWriter.cs
- DataServiceRequest.cs
- IntegerValidatorAttribute.cs
- SaveFileDialog.cs
- WpfWebRequestHelper.cs
- AtomMaterializerLog.cs
- SiteMapHierarchicalDataSourceView.cs
- ImageClickEventArgs.cs
- TrackingCondition.cs
- WebPartCancelEventArgs.cs
- Group.cs
- DefaultBinder.cs
- DesignerCapabilities.cs
- EncryptedType.cs
- DeviceContexts.cs
- PageScaling.cs
- AmbientLight.cs
- ServiceThrottlingElement.cs
- Native.cs
- SafeLibraryHandle.cs
- OutputCacheSettings.cs
- Exceptions.cs
- PasswordTextNavigator.cs
- MailMessageEventArgs.cs
- OdbcError.cs
- ByteConverter.cs
- Signature.cs
- CacheChildrenQuery.cs
- PrintingPermissionAttribute.cs
- SqlLiftIndependentRowExpressions.cs
- MediaContext.cs
- WebPartHeaderCloseVerb.cs
- FormsAuthentication.cs
- Highlights.cs
- UriTemplateTableMatchCandidate.cs
- ProcessStartInfo.cs
- EventLogEntryCollection.cs
- TransformerInfo.cs
- remotingproxy.cs
- ChannelAcceptor.cs
- VectorCollection.cs
- IntSecurity.cs
- SqlError.cs
- TokenCreationParameter.cs
- NameValuePair.cs
- NativeMethods.cs
- TriState.cs
- XamlStyleSerializer.cs
- TerminatorSinks.cs
- DataGridViewControlCollection.cs
- MatrixConverter.cs
- dbenumerator.cs
- SByte.cs
- ConstructorNeedsTagAttribute.cs
- DataService.cs
- FixedSOMSemanticBox.cs
- WhitespaceRuleLookup.cs
- AnonymousIdentificationModule.cs
- LockedAssemblyCache.cs
- _SslSessionsCache.cs
- loginstatus.cs
- EventListener.cs
- GenerateScriptTypeAttribute.cs
- storepermissionattribute.cs
- XpsStructure.cs
- QilPatternFactory.cs
- BitmapData.cs
- RunClient.cs
- EndpointNotFoundException.cs
- DynamicDataRouteHandler.cs
- CharConverter.cs
- UIElement3D.cs
- NamespaceInfo.cs
- RowVisual.cs
- ThreadNeutralSemaphore.cs
- TransformCryptoHandle.cs
- NullableConverter.cs
- Size3D.cs