I'm writing an client application to consume an existing web service
which requires password digest authentication. I tried to use
UserNameToken in WSE 3.0 but found every time the authentication will
fail. After debugging the code I found out the hashing algorithm for
the web service is a little bit different, it's something like:
Base64(SHA-1(Nonce + Created + SHA-1(password)))
Note the password is hashed as an byte[] before it was combined with
nonce and created. However in UserNameToken I can only pass password
as a string. Even if I hash the password and convert to a string then
pass to UserNameToken it will produce a totally different password
digest.
My question is, is there any way to get around this within WSE? The
algorithm for hashing the password cannot be changed as it's already
in production. I don't want to re-write the whole thing to produce the
soap header as WSE already did it except for this one.
BigJohn - 19 Nov 2007 15:16 GMT
Not sure if this is what you are looking for, but for a WSE Service call
where a UsernameTokenManager is available in the service, here is what I have
had working in the client:
On the WSE 3.0 Settings ... wizard, set up a policy in the Policy tab named
"APPPolicy". The name is essential.
In the application:
Imports Microsoft.Web.Services3.Security
Imports Microsoft.Web.Services3.Security.Tokens
...
Dim wsAPP As New WebReferenceName.ServiceWSE
' Define username token
Dim wsToken As New Tokens.UsernameToken(strID, strPSW,
PasswordOption.SendPlainText)
' Assign token to service container
wsApp.SetClientCredential(wsToken)
wsApp.SetPolicy("APPPolicy")
' call needed function/method from service
dim strResults as String = wsApp.GetData(Data_Parameters)
Of course this is all wrapped in a Try/Catch block.
Hopefully this helps. Good luck