Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you handle a Password Change when using WCF and DefaultCredentials?

I have a client that uses a WCF proxy to call a service. Credentials and other functionality work fine normally, but if the user changes their domain password and I restart the app, then I am unable to call the service due to this error:

System.ServiceModel.Security.SecurityNegotiaionException -> The server has rejected the client credentials.

System.Security.Authentication.InvalidCredentialException -> The server has rejected the client credentials.

System.componentmodel.Win32Exception -> The logon attempt failed.

Obviously I know that the user's credentials have changed but how can I refresh the CredentialCache to reflect the new credentials so that the WCF call will succeed?

like image 445
user2112786 Avatar asked Feb 26 '13 20:02

user2112786


1 Answers

The service checks the token in the client context against the AD. The wcf client uses the existing windows token it receives when the user logged into his windows account. If you change the password, the windows session still runs with the old credentials. You have to log in and out of your windows session in order to update the cached credentials.

like image 175
flayn Avatar answered Sep 21 '22 23:09

flayn