Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8002247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:18:02+00:00 2026-06-04T16:18:02+00:00

I need to query a WS Trust 1.4 service using .NET to enable a

  • 0

I need to query a WS Trust 1.4 service using .NET to enable a SAML 2.0 Authentication scenario.

EDIT: To be more precise I need to support an User Interaction Challenge on the client side which is defined in WS Trust 1.4.

I looked into WIF which provides direct access to WS Trust via the WSTrustChannelFactory (see trustChannelFactory.TrustVersion in the codesnippet…) but it seems that there is only support for WS-Trust 1.3 and Feb2005?

            WSTrustChannelFactory trustChannelFactory = new WSTrustChannelFactory(getBinding(), "http:/localhost...");

            trustChannelFactory.TrustVersion = TrustVersion.WSTrust13;
            WSTrustChannel channel = (WSTrustChannel)trustChannelFactory.CreateChannel();

            RequestSecurityToken rst = new RequestSecurityToken();

            RequestSecurityTokenResponse rstr = null;
            SecurityToken token = channel.Issue(rst, out rstr);

Does anybody know how to implement such a direct WS-Trust Query using .NET?

I cannot use a WSHttpFederation Binding since we need to work with SAML 2.0 and have to retrieve the SAMl 2.0 Authentication Requests from the Application Server before passing them to the IdP.

I could of course roll my own client-side WS-Trust 1.4. implementation, but perhaps there is an easier way…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:18:05+00:00Added an answer on June 4, 2026 at 4:18 pm

    I extended the WIF WS Trust implementation using .NET Extension methods. Here you can see the first part (Issue Request with RST and SAML Authn Request) as an example on how to reuse the things which are already defined in WIF. I used a IL Disassembler to see how things are done inside WIF which was pretty helpful on the way…

    internal static RequestSecurityTokenResponseWithSAML2Assertion Issue(this WSTrustChannel pThis,
            string pSAML2AuthnRequest,
            Func<ProfileSelectionChallengeType, wsTrust14.ChoiceSelectedType> pProfileSelectionCallback)
        {
            if (pThis != null)
            {
                if (pThis.ChannelFactory != null &&
                    pThis.ChannelFactory.Endpoint != null &&
                    pThis.ChannelFactory.Endpoint.Binding != null)
                {
                    // Create RST Request
                    RequestSecurityToken rst = new RequestSecurityToken("http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue");
                    rst.TokenType = "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0";
    
                    // we use WS Trust 1.4 but .NET WIF only provides support for WS Trust 1.3
                    // so we add the needed Challenge support and reuse most of the WIF stuff
                    if (pThis.TrustVersion != System.ServiceModel.Security.TrustVersion.WSTrust13)
                    {
                        throw new Exception("Given WS Trust Version not supported!");
                    }
    
                    // create a WS Trust 1.3 SOAP Message
                    Message issueRequest = Message.CreateMessage(pThis.ChannelFactory.Endpoint.Binding.MessageVersion,
                        "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue",
                        new WSTrustRequestBodyWriter(rst,
                            pThis.WSTrustRequestSerializer,
                            pThis.WSTrustSerializationContext));
    
                    // add SAML Authn Request to the WS Trust request
                    XmlDocument messageAsXml = issueRequest.serializeToXml();
                    messageAsXml = SAMLSupport.addSAMLAuthenticationRequest(messageAsXml, pSAML2AuthnRequest);
                    issueRequest = issueRequest.generateFromXml(messageAsXml);
    
                    // invoke the WS Trust service on the STS
                    Message responseMessage = pThis.Issue(issueRequest);
    
                    // check what we received as answer...
                    var response = pThis.parseAndHandleResponse(responseMessage, pProfileSelectionCallback);
                    return response;
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to query my SQL server from Access using an ADO connection (for example),
I need to query AD to determine if a users account is disabled. Using
Using C#.Net and MYSQL I want to use a CASE Statement like SQL Query
I need to turn this on/enable it. I found some info on the net
I need query (to be more specific, it is view, not query) that will
Using VB.Net and Sql Server Query Select cCustomerCode,cCustomerName from cms_Customer where cCustomerName like '%['
I need query which will check user supplied date range is in between the
I need to query a node to determine if it has a parent node
I need a query which can do the following operation. I have a table
I need a query that will return a table where each column is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.