简体   繁体   English

通过Web应用程序从外部PC验证AD用户凭据

[英]Validate AD User Credential from External PC via Web Application

Is there a way to validate the user credential that the user key in from two textbox (username, password) against the Active Directory User Lisst of the network of the web server? 有没有一种方法可以针对Web服务器网络的Active Directory用户权限,从两个文本框(用户名,密码)验证用户凭据的用户凭据?

For example I have a user account, User1 and the password is U1. 例如,我有一个用户帐户User1,密码为U1。 The User1 is included in the domain for example DomainServer so it would be DomainServer\\User1. User1包含在域中,例如DomainServer,因此它将是DomainServer \\ User1。

Now I need to create a web application that will allow me to login using my user credential. 现在,我需要创建一个Web应用程序,该应用程序将允许我使用用户凭据进行登录。 I need to validate if the username I key in exist in the network of the web server and if the password is correct. 我需要验证输入的用户名是否存在于Web服务器的网络中以及密码是否正确。 Assuming that i accesses that web application via External Machine (machine not included in the web server network) for example a machine from Internet Cafe. 假设我通过外部计算机(Web服务器网络中未包含的计算机)(例如,来自Internet Cafe的计算机)访问该Web应用程序。 Lets assume that the web application was hosted and the URL is www.company.com\\ValidateCrendential 假设托管了Web应用程序,URL为www.company.com \\ ValidateCrendential

Thanks in advance guys! 在此先感谢大家!

If you web server is in domain then you can use LDAP to validate the user credentials. 如果您的Web服务器在域中,则可以使用LDAP验证用户凭据。

    public bool Authenticate(string userName,string password, string domain)
{
    bool authentic = false;
    try
    {
        DirectoryEntry entry = new DirectoryEntry("LDAP://" + domain,userName, password);
        object nativeObject = entry.NativeObject;
        authentic = true;
    }
    catch (DirectoryServicesCOMException) { }
    return authentic;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Web应用程序/ WebAPI验证Azure AD中的用户凭据 - How to validate user credentials in Azure AD with Web application / WebAPI 从外部Web应用程序登录Prestashop用户 - Login a prestashop user from external web application 通过Azure Functions对Azure AD中的用户进行身份验证(验证用户名和密码) - Authenticate User In Azure AD (validate username & password) via Azure Functions 在.NET MVC中使用LDAP /网络凭据验证用户 - Validate User With LDAP/Network Credential in .NET MVC 通过Asp.Net MVC应用程序中托管的SignalR集线器从外部服务向Web客户端发送通知 - Send notification to web client from external service via SignalR hub hosted in Asp.Net MVC Application 如何通过用户凭证访问AD FS声明? - How to access AD FS claims by User's credential? 从外部Web应用程序返回值 - Return Value from External Web Application 通过LAN将Android应用程序连接到PC应用程序 - Connect Android Application to PC Application via LAN Azure AD 在 Web API 中使用来自客户端应用程序的令牌 - Azure AD using token from client application in Web API 使用AD身份验证从Azure Web App获取用户 - Obtain user from Azure Web App using AD authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM