Started implementing the Replay Center.
Expanded and generalized the ApiClient.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package eu.crushedpixel.replaymod.online.authentication;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,6 +21,10 @@ public class AuthenticationHandler {
|
||||
public static boolean isAuthenticated() {
|
||||
return authkey != null;
|
||||
}
|
||||
|
||||
public static String getKey() {
|
||||
return authkey;
|
||||
}
|
||||
|
||||
public static int authenticate(String username, String password) {
|
||||
try {
|
||||
@@ -33,6 +36,18 @@ public class AuthenticationHandler {
|
||||
return NO_CONNECTION;
|
||||
}
|
||||
}
|
||||
|
||||
public static int logout() {
|
||||
try {
|
||||
boolean success = ReplayMod.apiClient.logout(authkey);
|
||||
authkey = null;
|
||||
return SUCCESS;
|
||||
} catch(ApiException e) {
|
||||
return INVALID;
|
||||
} catch(Exception e) {
|
||||
return NO_CONNECTION;
|
||||
}
|
||||
}
|
||||
|
||||
private static final List<String> PREMIUM_USERS = new ArrayList<String>() {
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user