mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 04:20:55 +00:00
24 lines
577 B
C#
24 lines
577 B
C#
using Novell.Directory.Ldap;
|
|
|
|
namespace CartriX.Server.Controllers
|
|
{
|
|
public class CheckDomain
|
|
{
|
|
public bool Authenticate(string username, string password)
|
|
{
|
|
try
|
|
{
|
|
using (var conn = new LdapConnection())
|
|
{
|
|
conn.Connect("your-domain.local", 389);
|
|
conn.Bind($"{username}@your-domain.local", password);
|
|
return true;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |