How to get the current user’s Active Directory details in C#

The “pre Windows 2000” name i.e. DOMAIN\SomeBody, the Somebody portion is known as sAMAccountName. So try: using(DirectoryEntry de = new DirectoryEntry(“LDAP://MyDomainController”)) { using(DirectorySearcher adSearch = new DirectorySearcher(de)) { adSearch.Filter = “(sAMAccountName=someuser)”; SearchResult adSearchResult = adSearch.FindOne(); } } someuser@somedomain.com.au is the UserPrincipalName, but it isn’t a required field.

Understanding Django-LDAP authentication

This page might have what you are looking for: https://pypi.python.org/pypi/django-auth-ldap concerning the LDAP backend. You are lucky that one exists, so you don’t have to code an auth backend yourself 🙂 Basically django.contrib.auth.models already has a User object that contains everything you need about the user. So you don’t need to create a new models.py. … Read more

When to use LDAP over a database?

LDAP can be considered a database. But I’m assuming that you mean SQL databases. LDAP data stores are for systems with high number of reads compared to writes. While other databases such as SQL stores are designed for transactional data usage (high read and writes). This is why LDAP is a directory protocol. It’s well … Read more

LDAP Authentication using Java

Following Code authenticates from LDAP using pure Java JNDI. The Principle is:- First Lookup the user using a admin or DN user. The user object needs to be passed to LDAP again with the user credential No Exception means – Authenticated Successfully. Else Authentication Failed. Code Snippet public static boolean authenticateJndi(String username, String password) throws … Read more

Why doesn’t ldapsearch over ssl/tls work?

First, replace -h my.server.com -p 3269 with -H ldaps://my.server.com:3269 as suggested by @dearlbry. Then, in /etc/openldap/ldap.conf (or /etc/ldap/ldap.conf on my Ubuntu 13.04), disable certificate verification by adding this : HOST my.server.com PORT 3269 TLS_REQCERT ALLOW You can also create a ldaprc file in the current directory with the same content if you don’t want to … Read more

How do I clone an OpenLDAP database

The problem with SourceRebels’ answer is that slapcat(8) does not guarantee that the data is ordered for ldapadd(1)/ldapmodify(1). From man slapcat (from OpenLDAP 2.3) : The LDIF generated by this tool is suitable for use with slapadd(8). As the entries are in database order, not superior first order, they cannot be loaded with ldapadd(1) without … Read more

How to save the LDAP SSL Certificate from OpenSSL

Copy everything between —–BEGIN CERTIFICATE—– and —–END CERTIFICATE—– (including these delimiters) and paste it in a new text file (usually with the extension .pem or .crt). You can use your favourite (plain) text editor for this, for example Notepad, Gedit, Vim, Emacs (depending on the system you’re using). Alternatively, you can pipe the output to … Read more

How to get all the AD groups for a particular user?

You should use System.DirectoryServices.AccountManagement. It’s much easier. Here is a nice code project article giving you an overview on all the classes in this DLL. As you pointed out, your current approach doesn’t find out the primary group. Actually, it’s much worse than you thought. There are some more cases that it doesn’t work, like … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)