Because when trying to log into the APEX application, I can enter anything into the username field / password blank and it lets me into the application. So the authentication with AD does not seem to be working?
Tried both %LDAP_USER%@domain and domain\%LDAP_USER%
Use DN Name: Yes
Is it because its the sAMAccountName that contains our login username ian123, CN name just contains the employees name i..e Joe Bloggs
So when I log into Windows on the domain I would enter
It means that the bind succeeded. A bind with an empty password is an anonymous bind. It depends on your LDAP server (AD) configuration if this is supported. You can also add a validation on your login page, to ensure that the password is not empty.
trying to bind with either domain\ or @domain should work, and indeed uses samAccountName. When i perform a bind with this syntax this works. If this doesn't for you, then i can only assume that your "domain" part is incomplete or has too many parts.
"A bind with an empty password is an anonymous bind. It depends on your LDAP server (AD) configuration if this is supported. You can also add a validation on your login page, to ensure that the password is not empty."
I can enter any username and no password and it let's me into the application in APEX? So it looks to me that it cant be using AD at all as for some reason its letting everything through. The LDAP server I am using is MS Active Directory
This is an AD configuration setting thing, which allows or disallows anonymous binds. It isn't on the apex side. Try asking your AD admin why it is so.
Since you require a password anyway in your apex application, make sure the password field is required/add a validation, like Christian suggested.