diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/AuthCoreProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/AuthCoreProvider.java index 0d9b176a..be0b576a 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/AuthCoreProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/AuthCoreProvider.java @@ -23,6 +23,7 @@ public abstract class AuthCoreProvider implements AutoCloseable { private static boolean registredProviders = false; public static void registerProviders() { if (!registredProviders) { + providers.register("reject", RejectAuthCoreProvider.class); registredProviders = true; } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/RejectAuthCoreProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/RejectAuthCoreProvider.java new file mode 100644 index 00000000..41500f72 --- /dev/null +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/RejectAuthCoreProvider.java @@ -0,0 +1,51 @@ +package pro.gravit.launchserver.auth.core; + +import pro.gravit.launcher.request.auth.AuthRequest; +import pro.gravit.launchserver.LaunchServer; +import pro.gravit.launchserver.auth.AuthException; +import pro.gravit.launchserver.socket.response.auth.AuthResponse; + +import java.io.IOException; +import java.util.UUID; + +public class RejectAuthCoreProvider extends AuthCoreProvider { + @Override + public User getUserByUsername(String username) { + return null; + } + + @Override + public User getUserByUUID(UUID uuid) { + return null; + } + + @Override + public void verifyAuth(AuthResponse.AuthContext context) throws AuthException { + throw new AuthException("Please configure AuthCoreProvider"); + } + + @Override + public PasswordVerifyReport verifyPassword(User user, AuthRequest.AuthPasswordInterface password) { + return PasswordVerifyReport.FAILED; + } + + @Override + public void init(LaunchServer server) { + + } + + @Override + protected boolean updateAuth(User user) throws IOException { + return false; + } + + @Override + protected boolean updateServerID(User user, String serverID) throws IOException { + return false; + } + + @Override + public void close() throws IOException { + + } +} diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/AuthHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/AuthHandler.java index 4b850eb9..52baf2c2 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/AuthHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/AuthHandler.java @@ -18,6 +18,7 @@ public static UUID authError(String message) throws AuthException { throw new AuthException(message); } + @SuppressWarnings("deprecation") public static void registerHandlers() { if (!registredHandl) { providers.register("null", NullAuthHandler.class); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/HibernateAuthHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/HibernateAuthHandler.java index 0491e7c6..7bf7af8d 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/HibernateAuthHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/handler/HibernateAuthHandler.java @@ -5,6 +5,7 @@ import java.util.UUID; +@Deprecated public class HibernateAuthHandler extends CachedAuthHandler implements RequiredDAO { @Override protected Entry fetchEntry(String username) { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index 51c42d4a..fdd2310e 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -156,6 +156,10 @@ public void verify() { throw new NullPointerException("AuthProviderPair`s count should be at least one"); } + if(dao != null) { + logger.warn("DAO deprecated and may be remove in future release"); + } + boolean isOneDefault = false; for (AuthProviderPair pair : auth.values()) { if (pair.isDefault) {