Created
September 24, 2012 09:17
-
-
Save gitssk/3775086 to your computer and use it in GitHub Desktop.
MSAD Authentication using Spring LDAP - email as userid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LdapContextSource cs = new LdapContextSource(); | |
cs.setUrl("ldap://127.0.0.1:389"); | |
cs.setBase("OU=XX,DC=YY,DC=com"); | |
cs.setUserDn("CN=appCN,OU=XX,DC=YY,DC=com"); | |
cs.setPassword("appPassword"); | |
cs.afterPropertiesSet(); | |
LdapTemplate lt = new LdapTemplate(cs); | |
AndFilter filter = new AndFilter(); | |
filter.and(new EqualsFilter("mail", "userEmail@somedomain")); | |
System.out.println(lt.authenticate(DistinguishedName.EMPTY_PATH, filter.toString(), userPassword)); //true means valid login |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment