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.exception.*;
import io.kamax.mxisd.lookup.ThreePidValidation;
import io.kamax.mxisd.lookup.strategy.LookupStrategy;
import io.kamax.mxisd.matrix.IdentityServerUtils;
import io.kamax.mxisd.notification.NotificationManager;
import io.kamax.mxisd.storage.IStorage;
@@ -72,18 +71,16 @@ public class SessionMananger {
private SessionConfig cfg;
private MatrixConfig mxCfg;
private IStorage storage;
private LookupStrategy lookup;
private NotificationManager notifMgr;
// FIXME export into central class, set version
private CloseableHttpClient client = HttpClients.custom().setUserAgent("mxisd").build();
@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.mxCfg = mxCfg;
this.storage = storage;
this.lookup = lookup;
this.notifMgr = notifMgr;
}
@@ -96,10 +93,6 @@ public class SessionMananger {
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) {
Optional<IThreePidSessionDao> dao = storage.getThreePidSession(sid);
if (!dao.isPresent() || !StringUtils.equals(dao.get().getSecret(), secret)) {

View File

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