[FIX] Хуки авторизации распространяются и на серверную авторизацию

This commit is contained in:
Gravit 2019-03-23 10:34:46 +07:00
parent 9145243b8c
commit 0c5227b5ab
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -56,7 +56,9 @@ public void reply() throws Exception {
else pair = server.config.getAuthProviderPair(auth_id); else pair = server.config.getAuthProviderPair(auth_id);
if(pair == null) requestError("Auth type not found"); if(pair == null) requestError("Auth type not found");
AuthProvider provider = pair.provider; AuthProvider provider = pair.provider;
AuthResponse.AuthContext context = new AuthResponse.AuthContext(session, login, password.length(), null, client, null, ip, true);
try { try {
server.authHookManager.preHook(context, clientData);
result = provider.auth(login, password, ip); result = provider.auth(login, password, ip);
if (!VerifyHelper.isValidUsername(result.username)) { if (!VerifyHelper.isValidUsername(result.username)) {
AuthProvider.authError(String.format("Illegal result: '%s'", result.username)); AuthProvider.authError(String.format("Illegal result: '%s'", result.username));
@ -77,6 +79,7 @@ public void reply() throws Exception {
} }
clientData.type = Client.Type.SERVER; clientData.type = Client.Type.SERVER;
clientData.username = result.username; clientData.username = result.username;
server.authHookManager.postHook(context, clientData);
} catch (AuthException | HWIDException e) { } catch (AuthException | HWIDException e) {
requestError(e.getMessage()); requestError(e.getMessage());
return; return;