
I am writing a small desktop app that hooks into our company phone system and on a incoming call searches the DDI against the Contact entity and then if it finds a match offers to open the record for the user.
For security reasons we do not want to specify username and password in config files but rather use the default credentials for the logged on user. My issue is that my code works on our development server that does not use ADFS STS but it fails on our live server which does use ADFS STS. My code is below. If I use the username and password from the App Settings it works with the STS but commenting them out and using the CredentialCache causes the following error.
{"An error occurred when processing the security tokens in the message."}
IOrganizationService _service;
OrganizationServiceProxy _serviceProxy;
ClientCredentials clientCredentials = new ClientCredentials();
//clientCredentials.UserName.UserName = ConfigurationManager.AppSettings["username"];
//clientCredentials.UserName.Password = ConfigurationManager.AppSettings["password"];
clientCredentials.Windows.ClientCredential = (NetworkCredential)CredentialCache.DefaultCredentials;
Uri organisationUri = new Uri(String.Format(ConfigurationManager.AppSettings["organisationUri"] + "XRMServices/2011/Organization.svc"));
ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertificatePolicy;
IServiceConfiguration<IOrganizationService> serviceConfiguration = ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(organisationUri);
serviceConfiguration.Authenticate(clientCredentials);
*This post is locked for comments
I have the same question (0)