const string LDAP_PATH = "EX://ldap.pjwstk.edu.pl"; const string LDAP_DOMAIN = "ldap.pjwstk.edu.pl"; using (var context = new PrincipalContext(ContextType.Domain, LDAP_DOMAIN, "pgago", "xxx")) { if (context.ValidateCredentials("pgago", "xxx")) { using (var de = new DirectoryEntry(LDAP_PATH)) using (var ds = new DirectorySearcher(de)) { var identities = new List { new ClaimsIdentity("custom auth type") }; } } }