Namespace: Microsoft.IdentityModel.Protocols.WSTrust
Assembly: Microsoft.IdentityModel (in microsoft.identitymodel.dll)
Usage
Visual Basic |
---|
Dim instance As WSTrustServiceHost |
Syntax
Visual Basic |
---|
Public Class WSTrustServiceHost Inherits ServiceHost |
C# |
---|
public class WSTrustServiceHost : ServiceHost |
C++ |
---|
public ref class WSTrustServiceHost : public ServiceHost |
J# |
---|
public class WSTrustServiceHost extends ServiceHost |
JScript |
---|
public class WSTrustServiceHost extends ServiceHost |
Example
Copy Code | |
---|---|
public class MySecurityTokenServiceConfiguration : SecurityTokenServiceConfiguration { public MySecurityTokenServiceConfiguration () : base(”HelloWorldSTS”) { SecurityTokenService = typeof(MySecurityTokenService); } } // Following code snippet uses WSTrustServiceHost to expose STS for use by // client applications { MySecurityTokenServiceConfiguration config = new MySecurityTokenServiceConfiguration(); // Add the STS endoint information config.TrustEndpoints.Add( new ServiceHostEndpointConfiguration( "http://localhost:6000/SimpleActiveSTS", new WSHttpBinding(), typeof( IWSTrustFeb2005SyncContract ) ) ); // Create the WS-Trust service host with our STS configuration using ( WSTrustServiceHost host = new WSTrustServiceHost( config, new Uri( "http://localhost:6000/SimpleActiveSTS" ) ) ) { host.Open(); Console.WriteLine( "SimpleActiveSTS started, press ENTER to stop ..." ); Console.ReadLine(); |
Remarks
The WSTrustServiceHost class is the Windows® Identity Foundation (WIF) implementation of a Windows Communication Foundation ServiceHost that is intended to be used to integrate a WCF hosting environment with a Security Token Service (STS) built using WIF. The WSTrustServiceHost is a fully functioning ServiceHost which offers both integration with WCF configuration as well as WIF specific features that are configured by modifying the SecurityTokenServiceConfiguration, which is a class provided by WIF.
By default, the WSTrustServiceHost performs the following:
-
It adds WS-Trust endpoints to the ServiceHost based on SecurityTokenServiceConfiguration.TrustEndpoints.
-
It enables metadata over the base addresses if SecurityTokenServiceConfiguration.DisableWsdl is set to false.
-
Thirdly, it configures the service certificate on the ServiceHost service credentials if a WIF configuration section specifies a service certificate. Note that this will override the equivalent service certificate settings in WCF configuration.
-
Fourthly, it integrates WIF token handlers into the security processing pipeline by calling ExtensibleSecurityCredentials.ConfigureServiceHost() on itself.
The WSTrustServiceHost class may be overridden to customize this behavior.
Inheritance Hierarchy
System.ServiceModel.Channels.CommunicationObject
System.ServiceModel.ServiceHostBase
System.ServiceModel.ServiceHost
Microsoft.IdentityModel.Protocols.WSTrust.WSTrustServiceHost