Search in sources :

Example 1 with MatrixConfig

use of io.kamax.mxisd.config.MatrixConfig in project mxisd by kamax-io.

the class RestDirectoryProviderTest method before.

@Before
public void before() {
    MatrixConfig mxCfg = new MatrixConfig();
    mxCfg.setDomain(domain);
    mxCfg.build();
    RestBackendConfig cfg = new RestBackendConfig();
    cfg.setEnabled(true);
    cfg.setHost("http://localhost:65000");
    cfg.getEndpoints().setDirectory(endpoint);
    cfg.build();
    p = new RestDirectoryProvider(cfg, mxCfg);
}
Also used : MatrixConfig(io.kamax.mxisd.config.MatrixConfig) RestBackendConfig(io.kamax.mxisd.config.rest.RestBackendConfig) Before(org.junit.Before)

Example 2 with MatrixConfig

use of io.kamax.mxisd.config.MatrixConfig in project mxisd by kamax-io.

the class RestThreePidProviderTest method before.

@Before
public void before() {
    MatrixConfig mxCfg = new MatrixConfig();
    mxCfg.setDomain("example.org");
    mxCfg.build();
    RestBackendConfig cfg = new RestBackendConfig();
    cfg.setEnabled(true);
    cfg.setHost("http://localhost:65000");
    cfg.getEndpoints().getIdentity().setSingle(lookupSinglePath);
    cfg.getEndpoints().getIdentity().setBulk(lookupBulkPath);
    cfg.build();
    p = new RestThreePidProvider(cfg, mxCfg);
    lookupSingleRequest = new SingleLookupRequest();
    lookupSingleRequest.setType(ThreePidMedium.Email.getId());
    lookupSingleRequest.setThreePid("john.doe@example.org");
    ThreePidMapping m1 = new ThreePidMapping();
    m1.setMedium(ThreePidMedium.Email.getId());
    m1.setValue("john.doe@example.org");
    ThreePidMapping m2 = new ThreePidMapping();
    m1.setMedium(ThreePidMedium.PhoneNumber.getId());
    m1.setValue("123456789");
    lookupBulkList = new ArrayList<>();
    lookupBulkList.add(m1);
    lookupBulkList.add(m2);
}
Also used : ThreePidMapping(io.kamax.mxisd.lookup.ThreePidMapping) MatrixConfig(io.kamax.mxisd.config.MatrixConfig) SingleLookupRequest(io.kamax.mxisd.lookup.SingleLookupRequest) RestBackendConfig(io.kamax.mxisd.config.rest.RestBackendConfig) Before(org.junit.Before)

Example 3 with MatrixConfig

use of io.kamax.mxisd.config.MatrixConfig in project mxisd by kamax-io.

the class WordpressStoreSupplier method accept.

@Override
public void accept(Mxisd m) {
    WordpressConfig wpCfg = m.getConfig().getWordpress();
    MatrixConfig mxCfg = m.getConfig().getMatrix();
    if (m.getConfig().getWordpress().isEnabled()) {
        WordpressRestBackend restBackend = new WordpressRestBackend(wpCfg, m.getHttpClient());
        WordressSqlBackend sqlBackend = new WordressSqlBackend(wpCfg);
        AuthProviders.register(() -> new WordpressAuthProvider(restBackend));
        DirectoryProviders.register(() -> new WordpressDirectoryProvider(wpCfg, sqlBackend, mxCfg));
        ThreePidProviders.register(() -> new WordpressThreePidProvider(mxCfg, wpCfg, sqlBackend));
    }
}
Also used : MatrixConfig(io.kamax.mxisd.config.MatrixConfig) WordpressConfig(io.kamax.mxisd.config.wordpress.WordpressConfig)

Example 4 with MatrixConfig

use of io.kamax.mxisd.config.MatrixConfig 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 5 with MatrixConfig

use of io.kamax.mxisd.config.MatrixConfig in project mxisd by kamax-io.

the class RestDirectoryProviderTest method before.

@Before
public void before() {
    MatrixConfig mxCfg = new MatrixConfig();
    mxCfg.setDomain(domain);
    mxCfg.build();
    RestBackendConfig cfg = new RestBackendConfig();
    cfg.setEnabled(true);
    cfg.setHost("http://localhost:65000");
    cfg.getEndpoints().setDirectory(endpoint);
    cfg.build();
    p = new RestDirectoryProvider(cfg, mxCfg);
}
Also used : MatrixConfig(io.kamax.mxisd.config.MatrixConfig) RestBackendConfig(io.kamax.mxisd.config.rest.RestBackendConfig) RestDirectoryProvider(io.kamax.mxisd.backend.rest.RestDirectoryProvider) Before(org.junit.Before)

Aggregations

MatrixConfig (io.kamax.mxisd.config.MatrixConfig)8 RestBackendConfig (io.kamax.mxisd.config.rest.RestBackendConfig)4 Before (org.junit.Before)4 BackendAuthResult (io.kamax.mxisd.auth.provider.BackendAuthResult)2 LdapAuthProvider (io.kamax.mxisd.backend.ldap.LdapAuthProvider)2 LdapConfig (io.kamax.mxisd.config.ldap.LdapConfig)2 GenericLdapConfig (io.kamax.mxisd.config.ldap.generic.GenericLdapConfig)2 SingleLookupRequest (io.kamax.mxisd.lookup.SingleLookupRequest)2 ThreePidMapping (io.kamax.mxisd.lookup.ThreePidMapping)2 Test (org.junit.Test)2 RestDirectoryProvider (io.kamax.mxisd.backend.rest.RestDirectoryProvider)1 RestThreePidProvider (io.kamax.mxisd.backend.rest.RestThreePidProvider)1 WordpressConfig (io.kamax.mxisd.config.wordpress.WordpressConfig)1