Implement AuthMeBungee autologin (#1402)

* Implement AuthMeBungee autologin

There is a failing test due to cyclic dependency injection, @ljacqu could you take a quick look at this?

* Try to fix recursive dependency injection

* Fix codestyle

* Fix the subchannel name, again...

* Split BungeeService into BungeeSender and BungeeReceiver
This commit is contained in:
Gabriele C
2017-11-09 11:19:24 +01:00
committed by GitHub
parent 7e079d0b9c
commit b7c3d4b42e
24 changed files with 241 additions and 179 deletions
@@ -19,9 +19,9 @@ import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.SyncProcessManager;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.service.bungeecord.BungeeService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.SessionService;
import fr.xephi.authme.service.bungeecord.BungeeSender;
import fr.xephi.authme.service.bungeecord.MessageType;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.EmailSettings;
@@ -76,7 +76,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
private SessionService sessionService;
@Inject
private BungeeService bungeeService;
private BungeeSender bungeeSender;
AsynchronousLogin() {
}
@@ -226,7 +226,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
auth.setLastLogin(System.currentTimeMillis());
auth.setLastIp(ip);
dataSource.updateSession(auth);
bungeeService.sendAuthMeBungeecordMessage(MessageType.REFRESH_SESSION, player.getName());
bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_SESSION, player.getName());
// Successful login, so reset the captcha & temp ban count
final String name = player.getName();
@@ -252,7 +252,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
playerCache.updatePlayer(auth);
dataSource.setLogged(name);
sessionService.grantSession(name);
bungeeService.sendAuthMeBungeecordMessage(MessageType.LOGIN, name);
bungeeSender.sendAuthMeBungeecordMessage(MessageType.LOGIN, name);
// As the scheduling executes the Task most likely after the current
// task, we schedule it in the end