question

BalaGubba-4182 avatar image
0 Votes"
BalaGubba-4182 asked AgaveJoe edited

EncodingType attribute in nonce

Hello Everyone,

We have an asp.net web application (.Net 4.6) that needs to consume few services which are exposed through an enterprise integration platform. The enterprise platform requires all clients to send the security header that matches the basic security profile username token specification:

http://docs.oasis-open.org/wss-m/wss/v1.1.1/os/wss-UsernameTokenProfile-v1.1.1-os.html

http://www.ws-i.org/Profiles/BasicSecurityProfile-1.0.html#Nonce/@EncodingType_Attribute_Mandatory

To consume these web services, our asp.net web application created a proxy class by importing the wsdl. And then on the proxy class, we add the user credentials...as an example it is shown below:

proxyStatusClient.RequestSoapContext.Security.Tokens.Add(token);
proxyStatusClient.SetClientCredential<UsernameToken>(token);

This generates the soap header to have the user credentials along with the nonce element however nonce element does not have the encodingtype attribute which is mandatory for the enterprise platform.


<wsse:Username>test</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">test</wsse:Password>;

         <wsse:Nonce>rqgwyErTk7l5l7t1DqhdK</wsse:Nonce>
            
         <wsu:Created>2013-05-31T17:49:07.888Z</wsu:Created>


Since encodingtype attribute is missing on Nonce, platform rejects the request.

We could obviously fix the issue by modifying the security header before sending the request to the platform, however we would like to avoid tampering the headers which are generated by .Net.

Any ideas why this is happening and what should be done at configuration level to allow .Net generate the nonce element with encodingtype attribute?

Thanks
Bala

dotnet-aspnet-generaldotnet-aspnet-core-security
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @BalaGubba-4182 ,
The EncodingType flag is according to the WSSE Username and Token Security Spec 1.1. However,.NET does not meet that spec.
Best regards,
Yijing Sun

0 Votes 0 ·

Thanks Yijing for your prompt response. Are there any plans for .Net to support this?

Really appreciate this update because the services owner is not willing to change their services or use a workaround from their side.

0 Votes 0 ·

Hi @BalaGubba-4182 ,
Is there a possible that you don't use nonce? In the specification of UsernameToken WSS document its written that Nonce and Created are not required.Is it possible that you can complete the configuration on the server?
Best regards,
Yijing Sun

0 Votes 0 ·
Show more comments

1 Answer

AgaveJoe avatar image
0 Votes"
AgaveJoe answered AgaveJoe edited

I'm a little confused by your initial post. I'm guessing you used Visual Studio's service reference utility or the ServiceModel Metadata Utility Tool to generate a SOAP client in code. This process generates a partial class and you get to extend the partial class however you like without touching the generated code.

If you know what's wrong and you know how to fix the problem then simply fix the problem.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.