mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Pending Microsoft Authentication changes for GeyserConnect
This commit is contained in:
parent
65b68087b8
commit
0fd903e0a0
1 changed files with 22 additions and 1 deletions
|
@ -46,6 +46,10 @@ import java.util.concurrent.*;
|
|||
* It permits user to exit the server while they authorize Geyser to access their Microsoft account.
|
||||
*/
|
||||
public class PendingMicrosoftAuthentication {
|
||||
/**
|
||||
* For GeyserConnect usage.
|
||||
*/
|
||||
private boolean storeServerInformation = false;
|
||||
private final LoadingCache<String, AuthenticationTask> authentications;
|
||||
|
||||
public PendingMicrosoftAuthentication(int timeoutSeconds) {
|
||||
|
@ -53,7 +57,8 @@ public class PendingMicrosoftAuthentication {
|
|||
.build(new CacheLoader<>() {
|
||||
@Override
|
||||
public AuthenticationTask load(@NonNull String userKey) {
|
||||
return new AuthenticationTask(userKey, timeoutSeconds * 1000L);
|
||||
return storeServerInformation ? new ProxyAuthenticationTask(userKey, timeoutSeconds * 1000L)
|
||||
: new AuthenticationTask(userKey, timeoutSeconds * 1000L);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -67,6 +72,11 @@ public class PendingMicrosoftAuthentication {
|
|||
return authentications.get(userKey);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // GeyserConnect
|
||||
public void setStoreServerInformation() {
|
||||
storeServerInformation = true;
|
||||
}
|
||||
|
||||
public class AuthenticationTask {
|
||||
private static final Executor DELAYED_BY_ONE_SECOND = CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS);
|
||||
|
||||
|
@ -159,6 +169,17 @@ public class PendingMicrosoftAuthentication {
|
|||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public final class ProxyAuthenticationTask extends AuthenticationTask {
|
||||
private String server;
|
||||
private int port;
|
||||
|
||||
private ProxyAuthenticationTask(String userKey, long timeoutMs) {
|
||||
super(userKey, timeoutMs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PendingMicrosoftAuthentication
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue