// validates the user against the LDAP System and returns its propertues as a Dictionary public IActionResult CheckUserInLdapAndReturnAttributes(string username, string password) { var validCredentials = LdapHelper.ValidateCredentials(username, password); if (!validCredentials) { return(new BadRequestObjectResult("Wrong credentials")); } var ldapUserAttributes = LdapHelper.GetLdapUser(username); if (ldapUserAttributes == null) { return(new NotFoundObjectResult("User Not Found in LDAP")); } if (CheckIfUserAllreadyRegistered(ldapUserAttributes)) { return(new BadRequestObjectResult("User Allready Registered")); } return(new OkObjectResult(ldapUserAttributes)); }
// checks if the LDAP credentials of the user are valid private bool CheckIfLdapCredentialsAreValid(string rzName, string rzPassword) { return(LdapHelper.ValidateCredentials(rzName, rzPassword)); }