diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/provider/AuthProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/provider/AuthProvider.java index 03cd0462..019a1d75 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/provider/AuthProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/provider/AuthProvider.java @@ -1,5 +1,6 @@ package pro.gravit.launchserver.auth.provider; +import pro.gravit.launcher.events.request.GetAvailabilityAuthRequestEvent; import pro.gravit.launcher.request.auth.AuthRequest; import pro.gravit.launchserver.LaunchServer; import pro.gravit.launchserver.auth.AuthException; @@ -12,6 +13,13 @@ public abstract class AuthProvider implements AutoCloseable { private static boolean registredProv = false; protected transient LaunchServer srv = null; + public GetAvailabilityAuthRequestEvent.AuthAvailability.AuthType getFirstAuthType() { + return GetAvailabilityAuthRequestEvent.AuthAvailability.AuthType.PASSWORD; + } + public GetAvailabilityAuthRequestEvent.AuthAvailability.AuthType getSecondAuthType() { + return GetAvailabilityAuthRequestEvent.AuthAvailability.AuthType.NONE; + } + public static AuthProviderResult authError(String message) throws AuthException { throw new AuthException(message); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/GetAvailabilityAuthResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/GetAvailabilityAuthResponse.java index 9ed8d242..79e63047 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/GetAvailabilityAuthResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/GetAvailabilityAuthResponse.java @@ -19,7 +19,7 @@ public String getType() { public void execute(ChannelHandlerContext ctx, Client client) { List list = new ArrayList<>(); for (AuthProviderPair pair : server.config.auth) { - list.add(new GetAvailabilityAuthRequestEvent.AuthAvailability(pair.name, pair.displayName)); + list.add(new GetAvailabilityAuthRequestEvent.AuthAvailability(pair.name, pair.displayName, pair.provider.getFirstAuthType(), pair.provider.getSecondAuthType())); } sendResult(new GetAvailabilityAuthRequestEvent(list)); } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/GetAvailabilityAuthRequestEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/GetAvailabilityAuthRequestEvent.java index 28df28df..684d0485 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/GetAvailabilityAuthRequestEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/GetAvailabilityAuthRequestEvent.java @@ -11,10 +11,33 @@ public static class AuthAvailability { public final String name; @LauncherNetworkAPI public final String displayName; + @LauncherNetworkAPI + public final AuthType firstType; + @LauncherNetworkAPI + public final AuthType secondType; - public AuthAvailability(String name, String displayName) { + public AuthAvailability(String name, String displayName, AuthType firstType, AuthType secondType) { this.name = name; this.displayName = displayName; + this.firstType = firstType; + this.secondType = secondType; + } + + + public enum AuthType + { + @LauncherNetworkAPI + PASSWORD, + @LauncherNetworkAPI + KEY, + @LauncherNetworkAPI + TOTP, + @LauncherNetworkAPI + OAUTH, + @LauncherNetworkAPI + NONE, + @LauncherNetworkAPI + OTHER } }