Started implementing the Replay Center.

Expanded and generalized the ApiClient.
This commit is contained in:
Marius Metzger
2015-01-29 22:58:22 +01:00
parent 4659abc98e
commit f67e681825
9 changed files with 247 additions and 31 deletions

View File

@@ -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>() {
{