Abc.ServiceModel.WsTrust 1.0.1

dotnet add package Abc.ServiceModel.WsTrust --version 1.0.1
                    
NuGet\Install-Package Abc.ServiceModel.WsTrust -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Abc.ServiceModel.WsTrust" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Abc.ServiceModel.WsTrust" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Abc.ServiceModel.WsTrust" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Abc.ServiceModel.WsTrust --version 1.0.1
                    
#r "nuget: Abc.ServiceModel.WsTrust, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Abc.ServiceModel.WsTrust@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Abc.ServiceModel.WsTrust&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Abc.ServiceModel.WsTrust&version=1.0.1
                    
Install as a Cake Tool

Abc.ServiceModel.WsTrust alternate text is missing from this package README image

Overview

Implementation WS-Trust support for .NET core.

Configuring IdentityServer

This repo contains an extension method for the IdentityServer builder object to register all the necessary services in DI, e.g.:

builder.Services.AddScoped<IRelyingPartyStore, InMemoryRelyingPartyStore>();
builder.Services.AddScoped<SecurityTokenService, sts.AppSecurityTokenService>();
builder.Services.AddWsTrust();

Defaults

You can configure global defaults in the WsTrustOptions class, e.g.:

  • default token type (SAML 1.1 or SAML 2.0)
  • default hashing and digest algorithms
  • default SAML name identifier format
  • default encryption and keywrap algorithms
  • default WS-Trust version
  • default mappings from "short" claim types to WS-* claim types
  • specify SecurityTokenHandlers
var cert = new X509Certificate2(Path.Combine(Directory.GetCurrentDirectory(), "idsrvtest.pfx"), "idsrv3test");
var signingKey = new X509SecurityKey(cert, cert.GetSerialNumberString());

builder.Services.Configure<WsTrustOptions>(options => {
    options.Issuer = "urn:issuer";
    options.SigningKey = signingKey;
});

Relying party configuration

The following relying party settings are used by the WS-Trust endpoint:

builder.Services.AddSingleton<IEnumerable<RelyingParty>>(s =>
{
    return new List<RelyingParty>()
    {
        new RelyingParty()
        {
            AppliesTo = "urn:VISSDEV:DIT:WS",
            EncryptionKey = signingKey,
            RequiresEncryptedToken = false,
        },
        new RelyingParty()
        {
            AppliesTo = "https://localhost:44335/ws2007FederationNoSct",
            EncryptionKey = signingKey,
            RequiresEncryptedToken = true,
        },
        new RelyingParty()
        {
            AppliesTo = "https://localhost:44335/ws2007FederationNoSctbearer",
            EncryptionKey = signingKey,
            RequiresEncryptedToken = false,
        },

    };
});

Configure ServiceModel

builder.Services.AddTransient(s =>
{
    var identityConfiguration = new IdentityConfiguration(s.GetRequiredService<IEnumerable<CoreWCF.IdentityModel.Tokens.SecurityTokenHandler>>());
    identityConfiguration.IssuerNameRegistry = new CoreWCF.IdentityModel.Tokens.StsIssuerNameRegistry();

    var x509SecurityTokenHandler = new sts.AppX509SecurityTokenHandler();
    var usernameSecurityTokenHandler = new sts.AppUserNameSecurityTokenHandler();

    identityConfiguration.SecurityTokenHandlers.AddOrReplace(x509SecurityTokenHandler);
    identityConfiguration.SecurityTokenHandlers.AddOrReplace(usernameSecurityTokenHandler);
    identityConfiguration.SecurityTokenHandlers.AddOrReplace(new CoreWCF.IdentityModel.Tokens.SamlSecurityTokenHandler(new sts.AppSamlSecurityTokenHandler()));
    identityConfiguration.SecurityTokenHandlers.AddOrReplace(new CoreWCF.IdentityModel.Tokens.Saml2SecurityTokenHandler(new sts.AppSaml2SecurityTokenHandler()));

    return identityConfiguration;
});
app.UseServiceModel(serviceBuilder =>
{
    serviceBuilder.AddService<WsTrustService>(options => {
        options.DebugBehavior.IncludeExceptionDetailInFaults = true; 
    });
    serviceBuilder.AddServiceEndpoint<WsTrustService, IWsTrust13AsyncContract>(CreateCertificateBinding(SecurityAlgorithmSuite.Basic256), "/trust/13/certificatemixed", e => ConfigureEndpoint(e));
    serviceBuilder.AddServiceEndpoint<WsTrustService, IWsTrust13AsyncContract>(CreateUsernameBinding(SecurityAlgorithmSuite.Basic256), "/trust/13/usernamemixed", e => ConfigureEndpoint(e));
    serviceBuilder.AddServiceEndpoint<WsTrustService, IWsTrustFeb2005AsyncContract>(CreateCertificateBinding(SecurityAlgorithmSuite.Basic256), "/trust/2005/certificatemixed", e => ConfigureEndpoint(e));
    serviceBuilder.AddServiceEndpoint<WsTrustService, IWsTrustFeb2005AsyncContract>(CreateUsernameBinding(SecurityAlgorithmSuite.Basic256), "/trust/2005/usernamemixed", e => ConfigureEndpoint(e));
    serviceBuilder.ConfigureServiceHostBase<WsTrustService>(host => ChangeHostBehavior(host));

    var serviceMetadataBehavior = app.Services.GetRequiredService<ServiceMetadataBehavior>();
    serviceMetadataBehavior.HttpsGetEnabled = true;
});
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 120 10/22/2026
1.0.0 194 6/15/2026
0.2.2-dev07 143 6/15/2026