This commit is contained in:
Maxime Dor
2017-09-24 01:49:56 +02:00
parent df81dda22d
commit 597fc95cef
2 changed files with 16 additions and 21 deletions

View File

@@ -31,7 +31,6 @@ import io.kamax.mxisd.controller.v1.io.RequestTokenResponse;
import io.kamax.mxisd.controller.v1.remote.RemoteIdentityAPIv1; import io.kamax.mxisd.controller.v1.remote.RemoteIdentityAPIv1;
import io.kamax.mxisd.exception.*; import io.kamax.mxisd.exception.*;
import io.kamax.mxisd.lookup.ThreePidValidation; import io.kamax.mxisd.lookup.ThreePidValidation;
import io.kamax.mxisd.lookup.strategy.LookupStrategy;
import io.kamax.mxisd.matrix.IdentityServerUtils; import io.kamax.mxisd.matrix.IdentityServerUtils;
import io.kamax.mxisd.notification.NotificationManager; import io.kamax.mxisd.notification.NotificationManager;
import io.kamax.mxisd.storage.IStorage; import io.kamax.mxisd.storage.IStorage;
@@ -72,18 +71,16 @@ public class SessionMananger {
private SessionConfig cfg; private SessionConfig cfg;
private MatrixConfig mxCfg; private MatrixConfig mxCfg;
private IStorage storage; private IStorage storage;
private LookupStrategy lookup;
private NotificationManager notifMgr; private NotificationManager notifMgr;
// FIXME export into central class, set version // FIXME export into central class, set version
private CloseableHttpClient client = HttpClients.custom().setUserAgent("mxisd").build(); private CloseableHttpClient client = HttpClients.custom().setUserAgent("mxisd").build();
@Autowired @Autowired
public SessionMananger(SessionConfig cfg, MatrixConfig mxCfg, IStorage storage, LookupStrategy lookup, NotificationManager notifMgr) { public SessionMananger(SessionConfig cfg, MatrixConfig mxCfg, IStorage storage, NotificationManager notifMgr) {
this.cfg = cfg; this.cfg = cfg;
this.mxCfg = mxCfg; this.mxCfg = mxCfg;
this.storage = storage; this.storage = storage;
this.lookup = lookup;
this.notifMgr = notifMgr; this.notifMgr = notifMgr;
} }
@@ -96,10 +93,6 @@ public class SessionMananger {
return StringUtils.equalsIgnoreCase(cfg.getMatrixCfg().getDomain(), domain); return StringUtils.equalsIgnoreCase(cfg.getMatrixCfg().getDomain(), domain);
} }
private boolean isKnownLocal(ThreePid tpid) {
return lookup.findLocal(tpid.getMedium(), tpid.getAddress()).isPresent();
}
private ThreePidSession getSession(String sid, String secret) { private ThreePidSession getSession(String sid, String secret) {
Optional<IThreePidSessionDao> dao = storage.getThreePidSession(sid); Optional<IThreePidSessionDao> dao = storage.getThreePidSession(sid);
if (!dao.isPresent() || !StringUtils.equals(dao.get().getSecret(), secret)) { if (!dao.isPresent() || !StringUtils.equals(dao.get().getSecret(), secret)) {

View File

@@ -91,20 +91,22 @@ threepid:
local: 'classpath:email/validate-local-template.eml' local: 'classpath:email/validate-local-template.eml'
remote: 'classpath:email/validate-remote-template.eml' remote: 'classpath:email/validate-remote-template.eml'
session.policy.validation: session:
enabled: true policy:
forLocal: validation:
enabled: true
toLocal: true # This should not be changed unless you know exactly the implications!
toRemote:
enabled: true enabled: true
server: 'root' forLocal:
forRemote: enabled: true
enabled: true toLocal: true
toLocal: false toRemote:
toRemote: enabled: true
enabled: true server: 'root'
server: 'root' forRemote:
enabled: true
toLocal: false
toRemote:
enabled: true
server: 'root'
view: view:
session: session: