Picketlink and Active Directory (ldap store)
arthurgregorio Feb 20, 2015 1:48 PMI'm using picketlink for safety in my application and now need to plug it in AD (SAMBA 4, not M$ AD). My setup is as follows:
public class SecurityConfiguration { @Inject private EntityManagerContextInitializer contextInitializer; private static final String BASE_DN = "DC=pti,DC=local"; private static final String LDAP_URL = "ldap://ptidc0-teste.pti"; private static final String BIND_DN = "CN=userbind,CN=users,DC=pti,DC=local"; /** * * @param event */ public void configureIdentityManager(@Observes SecurityConfigurationEvent event) { final SecurityConfigurationBuilder builder = event.getBuilder(); System.setProperty("com.sun.jndi.ldap.connect.pool.authentication", "simple"); System.setProperty("com.sun.jndi.ldap.connect.pool.maxsize", "10"); System.setProperty("com.sun.jndi.ldap.connect.pool.prefsize", "5"); System.setProperty("com.sun.jndi.ldap.connect.pool.timeout", "300000"); System.setProperty("com.sun.jndi.ldap.connect.pool.debug", "all"); final Properties properties = new Properties(); // ldap properties properties.put("com.sun.jndi.ldap.connect.pool", "true"); // ldap properties builder.idmConfig() .named("default") .stores() .jpa() .supportCredentials(false) .supportGlobalRelationship( Grant.class, GroupMembership.class) .supportType( Role.class, Group.class) .addContextInitializer(this.contextInitializer) .ldap() .activeDirectory(true) .connectionProperties(properties) .baseDN(BASE_DN) .bindDN(BIND_DN) .bindCredential("secret") .url(LDAP_URL) .supportCredentials(true) .mapping(User.class) .objectClasses( "user", "person", "organizationalPerson") .attribute("userName", "sAMAccountName", true) .attribute("name", CN) .attribute("email", EMAIL); }
However, when I try to authenticate the result is always invalid and the picketlink seems that does not send the user's full name. It does bind correctly, but instead of sending the full name of the user, sends only sAMAccountName=test1 followed by the password. The correct thing to send is: CN=test1,CN=Users,DC=pti,DC=local and then the password.
The way this, the only answer I have is: Simple Bind Failed: NT_STATUS_LOGON_FAILURE
Any help?