Hari
Hari

Reputation: 477

WSSE Security header

Hope somebody can help me out.

I am trying to call this Web Service
https://link.hertz.com/AuthenticationWebservice/authenticateAdmin?wsdl

I have been said that I need to pass the following info for authentication with the web service:

username => "webServiceUserName"
password => "webServicePassword"
WSS-Password Type => "PasswordDigest"

I am using an asp.net 4.0 application and unable to figure out how to pass WSS-Password type to my web service call.

I have added this service url as a Service reference in my asp.net application and I am using the following code in my asp.net page:

service1.AuthenticateAdminClient myClient = new service1.AuthenticateAdminClient();
myClient.ClientCredentials.UserName.UserName = "webServiceUserName";
wsClient.ClientCredentials.UserName.Password = "webServicePassword";

myClient.authenticateAdminCredentials(myUserName, myPassword, myDomain);

thanks in advance,

Hari

Upvotes: 2

Views: 5359

Answers (1)

sasjaq
sasjaq

Reputation: 771

We used this example and it works for us. We just changed for "genericity" this one in SecurityHeader:

        if (PasswordType == PasswordType.Digest)
        {
            writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest");
            writer.WriteString(ComputePasswordDigest(SystemPassword, nonce, created));
        }
        else if (PasswordType == PasswordType.Text)
        {
            writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
            writer.WriteString(SystemPassword);
        }

Upvotes: 2

Related Questions