@SuppressWarnings("unchecked") public void validateLdapConfig(LdapUserAndGroupConfigurationDTO connInfo) throws Exception { CUserAndGroupAuthConfiguration fileConfig = LdapConfigurationUtil.getConfiguration().getUserAndGroupConfig(); Assert.assertEquals(fileConfig.getGroupBaseDn(), connInfo.getGroupBaseDn()); Assert.assertEquals(fileConfig.getGroupIdAttribute(), connInfo.getGroupIdAttribute()); Assert.assertEquals(fileConfig.getGroupMemberAttribute(), connInfo.getGroupMemberAttribute()); Assert.assertEquals(fileConfig.getGroupMemberFormat(), connInfo.getGroupMemberFormat()); Assert.assertEquals(fileConfig.getGroupObjectClass(), connInfo.getGroupObjectClass()); Assert.assertEquals(fileConfig.getUserBaseDn(), connInfo.getUserBaseDn()); Assert.assertEquals(fileConfig.getUserIdAttribute(), connInfo.getUserIdAttribute()); Assert.assertEquals(fileConfig.getUserObjectClass(), connInfo.getUserObjectClass()); Assert.assertEquals(fileConfig.getUserPasswordAttribute(), connInfo.getUserPasswordAttribute()); Assert.assertEquals(fileConfig.getUserRealNameAttribute(), connInfo.getUserRealNameAttribute()); Assert.assertEquals(fileConfig.getEmailAddressAttribute(), connInfo.getEmailAddressAttribute()); Assert.assertEquals(fileConfig.isLdapGroupsAsRoles(), connInfo.isLdapGroupsAsRoles()); Assert.assertEquals(fileConfig.getUserMemberOfAttribute(), connInfo.getUserMemberOfAttribute()); Assert.assertEquals(fileConfig.isGroupSubtree(), connInfo.isGroupSubtree()); Assert.assertEquals(fileConfig.isUserSubtree(), connInfo.isUserSubtree()); }
public LdapAuthConfiguration getLdapAuthConfiguration() { CUserAndGroupAuthConfiguration userAndGroupsConf = readUserAndGroupConfiguration(); LdapAuthConfiguration authConfig = new LdapAuthConfiguration(); authConfig.setEmailAddressAttribute(userAndGroupsConf.getEmailAddressAttribute()); // authConfig.setPasswordEncoding( userAndGroupsConf.getPreferredPasswordEncoding() ); authConfig.setUserBaseDn(StringUtils.defaultString(userAndGroupsConf.getUserBaseDn(), "")); authConfig.setUserIdAttribute(userAndGroupsConf.getUserIdAttribute()); authConfig.setUserObjectClass(userAndGroupsConf.getUserObjectClass()); authConfig.setPasswordAttribute(userAndGroupsConf.getUserPasswordAttribute()); authConfig.setUserRealNameAttribute(userAndGroupsConf.getUserRealNameAttribute()); authConfig.setGroupBaseDn(StringUtils.defaultString(userAndGroupsConf.getGroupBaseDn(), "")); authConfig.setGroupIdAttribute(userAndGroupsConf.getGroupIdAttribute()); // authConfig.setGroupMappings( groupMappings ) authConfig.setGroupMemberAttribute(userAndGroupsConf.getGroupMemberAttribute()); authConfig.setGroupMemberFormat(userAndGroupsConf.getGroupMemberFormat()); authConfig.setGroupObjectClass(userAndGroupsConf.getGroupObjectClass()); authConfig.setUserSubtree(userAndGroupsConf.isUserSubtree()); authConfig.setGroupSubtree(userAndGroupsConf.isGroupSubtree()); authConfig.setUserMemberOfAttribute(userAndGroupsConf.getUserMemberOfAttribute()); authConfig.setLdapGroupsAsRoles(userAndGroupsConf.isLdapGroupsAsRoles()); return authConfig; }