I’ve upgraded sharepoint 2010 app to 2016, it has 3 custom endpoints, and one of them is this one:
namespace AuthenticationWebService { [BasicHttpBindingServiceMetadataExchangeEndpoint] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] [ServiceContract] public class AuthenticationService { [OperationContract] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] public bool AuthenticateUser(string userName, string password) { return IsValidCredentials(userName, password); } internal static bool IsValidCredentials(string userName, string password) { bool isValid = false; if (userName.IndexOf(@"\") > 0) { userName = userName.Substring(userName.IndexOf(@"\") + 1); } string domain = SPContext.Current.Site.RootWeb.AllProperties["Authentication_Domain"].ToString(); using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, domain)) { isValid = pc.ValidateCredentials(userName, password); } return isValid; } } }
Simple really, just authenticates user in a few forms in order to confirm given action. This code was written for 2010 Sharepoint, and migrated to 2016 via visual studio upgrade.
Problem is, I can’t seem to properly call this endpoint in 2016, the same requests that work in 2010 gives me “400 bad request” in 2016. Any ideas?