Search in sources :

Example 1 with GenericLdapConfig

use of io.kamax.mxisd.config.ldap.generic.GenericLdapConfig in project mxisd by kamax-io.

the class LdapAuthTest method multiDNs.

@Test
public void multiDNs() {
    MatrixConfig mxCfg = new MatrixConfig();
    mxCfg.setDomain(domain);
    mxCfg.build();
    LdapConfig cfg = new GenericLdapConfig();
    cfg.getConnection().setHost(host);
    cfg.getConnection().setPort(65001);
    cfg.getConnection().setBaseDNs(dnList);
    cfg.getConnection().setBindDn(mxisdCn);
    cfg.getConnection().setBindPassword(mxisdPw);
    LdapConfig.UID uid = new LdapConfig.UID();
    uid.setType(idType);
    uid.setValue(idAttribute);
    cfg.getAttribute().setUid(uid);
    cfg.build();
    LdapAuthProvider p = new LdapAuthProvider(cfg, mxCfg);
    BackendAuthResult result = p.authenticate(MatrixID.from(userId, domain).valid(), userPw);
    assertFalse(result.isSuccess());
}
Also used : GenericLdapConfig(io.kamax.mxisd.config.ldap.generic.GenericLdapConfig) LdapConfig(io.kamax.mxisd.config.ldap.LdapConfig) BackendAuthResult(io.kamax.mxisd.auth.provider.BackendAuthResult) MatrixConfig(io.kamax.mxisd.config.MatrixConfig) GenericLdapConfig(io.kamax.mxisd.config.ldap.generic.GenericLdapConfig) LdapAuthProvider(io.kamax.mxisd.backend.ldap.LdapAuthProvider) Test(org.junit.Test)

Example 2 with GenericLdapConfig

use of io.kamax.mxisd.config.ldap.generic.GenericLdapConfig in project mxisd by kamax-io.

the class LdapAuthTest method singleDn.

@Test
public void singleDn() {
    LdapConfig cfg = new GenericLdapConfig();
    cfg.getConnection().setHost(host);
    cfg.getConnection().setPort(65001);
    cfg.getConnection().setBaseDn(dnList.get(0));
    cfg.getConnection().setBindDn(mxisdCn);
    cfg.getConnection().setBindPassword(mxisdPw);
    cfg.build();
    LdapConfig.UID uid = new LdapConfig.UID();
    uid.setType(idType);
    uid.setValue(idAttribute);
    cfg.getAttribute().setUid(uid);
    MatrixConfig mxCfg = new MatrixConfig();
    mxCfg.setDomain(domain);
    mxCfg.build();
    LdapAuthProvider p = new LdapAuthProvider(cfg, mxCfg);
    BackendAuthResult result = p.authenticate(MatrixID.from(userId, domain).valid(), userPw);
    assertFalse(result.isSuccess());
}
Also used : GenericLdapConfig(io.kamax.mxisd.config.ldap.generic.GenericLdapConfig) LdapConfig(io.kamax.mxisd.config.ldap.LdapConfig) BackendAuthResult(io.kamax.mxisd.auth.provider.BackendAuthResult) GenericLdapConfig(io.kamax.mxisd.config.ldap.generic.GenericLdapConfig) MatrixConfig(io.kamax.mxisd.config.MatrixConfig) LdapAuthProvider(io.kamax.mxisd.backend.ldap.LdapAuthProvider) Test(org.junit.Test)

Aggregations

BackendAuthResult (io.kamax.mxisd.auth.provider.BackendAuthResult)2 LdapAuthProvider (io.kamax.mxisd.backend.ldap.LdapAuthProvider)2 MatrixConfig (io.kamax.mxisd.config.MatrixConfig)2 LdapConfig (io.kamax.mxisd.config.ldap.LdapConfig)2 GenericLdapConfig (io.kamax.mxisd.config.ldap.generic.GenericLdapConfig)2 Test (org.junit.Test)2