public async Task <IActionResult> AuthenticateDomainUser([FromBody] DomainAuthenticationModel DomainAuthenticationModel) { AuthenticationRepository AuthenticationRepo = new AuthenticationRepository(); AuthenticatedDashboardUserModel dnu = new AuthenticatedDashboardUserModel(); try { dnu = AuthenticationRepo.AuthenticateDomainUsers(DomainAuthenticationModel); } catch { return(StatusCode(500)); } return(Ok(dnu)); }
public AuthenticatedDashboardUserModel AuthenticateDomainUsers(DomainAuthenticationModel DomainAuthenticationModel) { AuthenticatedDashboardUserModel AuthModel = new AuthenticatedDashboardUserModel(); if (DomainAuthenticationModel.Domain == "sudo" & DomainAuthenticationModel.UserName == "sudo" & DomainAuthenticationModel.Password == "sudo") { AuthModel.Roles = "Admin"; AuthModel.UserName = "******"; AuthModel.isAuthenticated = true; return(AuthModel); } else { // This is where you would implement your AD AUTHENTICATION methods. For now I will just return a false AuthModel.Roles = null; AuthModel.UserName = null; AuthModel.isAuthenticated = false; return(AuthModel); } }