A lot of changes
This commit is contained in:
@@ -16,6 +16,7 @@ import de.sebse.fuplanner.services.kvv.types.LoginTokenKVV;
|
||||
import de.sebse.fuplanner.tools.CustomAccountManager;
|
||||
import de.sebse.fuplanner.tools.NetworkCallbackCollector;
|
||||
import de.sebse.fuplanner.tools.Preferences;
|
||||
import de.sebse.fuplanner.tools.logging.Logger;
|
||||
import de.sebse.fuplanner.tools.network.HTTPService;
|
||||
import de.sebse.fuplanner.tools.network.NetworkCallback;
|
||||
import de.sebse.fuplanner.tools.network.NetworkError;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ModulesAnnouncements extends PartModules<ArrayList<Announcement>> {
|
||||
errorCallback.onError(new NetworkError(101204, 500, "Currently running in offline mode!"));
|
||||
return;
|
||||
}
|
||||
super.get(String.format("https://kvv.imp.fu-berlin.de/direct/announcement/site/%s.json?n=999999&d=999999999&_validateSession=", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
super.get(String.format("https://mycampus.imp.fu-berlin.de/direct/announcement/site/%s.json?n=999999&d=999999999&_validateSession=", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
String body = response.getParsed();
|
||||
if (body == null) {
|
||||
errorCallback.onError(new NetworkError(101201, 403, "No announcements retrieved!"));
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ModulesAssignments extends PartModules<AssignmentList> {
|
||||
errorCallback.onError(new NetworkError(101304, 500, "Currently running in offline mode!"));
|
||||
return;
|
||||
}
|
||||
get(String.format("https://kvv.imp.fu-berlin.de/direct/assignment/site/%s.json?_validateSession=", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
get(String.format("https://mycampus.imp.fu-berlin.de/direct/assignment/site/%s.json?_validateSession=", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
String body = response.getParsed();
|
||||
if (body == null) {
|
||||
errorCallback.onError(new NetworkError(101301, 403, "No assignments retrieved!"));
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ModulesEvents extends PartModules<EventList> {
|
||||
errorCallback.onError(new NetworkError(101404, 500, "Currently running in offline mode!"));
|
||||
return;
|
||||
}
|
||||
get(String.format("https://kvv.imp.fu-berlin.de/direct/calendar/site/%s.json?detailed=true&_validateSession=", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
get(String.format("https://mycampus.imp.fu-berlin.de/direct/calendar/site/%s.json?detailed=true&_validateSession=", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
String body = response.getParsed();
|
||||
if (body == null) {
|
||||
errorCallback.onError(new NetworkError(101401, 403, "No events retrieved!"));
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ModulesGradebook extends PartModules<ArrayList<Grade>> {
|
||||
errorCallback.onError(new NetworkError(101504, 500, "Currently running in offline mode!"));
|
||||
return;
|
||||
}
|
||||
super.get(String.format("https://kvv.imp.fu-berlin.de/direct/gradebook/site/%s.json", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
super.get(String.format("https://mycampus.imp.fu-berlin.de/direct/gradebook/site/%s.json", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
String body = response.getParsed();
|
||||
if (body == null) {
|
||||
errorCallback.onError(new NetworkError(101501, 403, "No gradebook retrieved!"));
|
||||
|
||||
@@ -196,7 +196,7 @@ public class ModulesList extends HTTPService {
|
||||
callback.onResponse(modules);
|
||||
return;
|
||||
}
|
||||
get("https://kvv.imp.fu-berlin.de/direct/membership.json?_validateSession=", mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
get("https://mycampus.imp.fu-berlin.de/direct/membership.json?_validateSession=", mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
String body = response.getParsed();
|
||||
if (body == null) {
|
||||
errorCallback.onError(new NetworkError(101111, 403, "No membership list retrieved!"));
|
||||
@@ -228,7 +228,7 @@ public class ModulesList extends HTTPService {
|
||||
if (--latch[0] == 0) successCallback.onResponse(modules);
|
||||
continue;
|
||||
}
|
||||
get(String.format("https://kvv.imp.fu-berlin.de/direct/site/%s.json?_validateSession=", courseId), mLogin.getLoginTokenKVV().getCookies(), response1 -> {
|
||||
get(String.format("https://mycampus.imp.fu-berlin.de/direct/site/%s.json?_validateSession=", courseId), mLogin.getLoginTokenKVV().getCookies(), response1 -> {
|
||||
String body1 = response1.getParsed();
|
||||
if (body1 == null) {
|
||||
errorCallback.onError(new NetworkError(101113, 403, "No site retrieved!"));
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ModulesResources extends PartModules<ArrayList<Resource>> {
|
||||
errorCallback.onError(new NetworkError(101604, 500, "Currently running in offline mode!"));
|
||||
return;
|
||||
}
|
||||
get(String.format("https://kvv.imp.fu-berlin.de/direct/content/site/%s.json?_validateSession=", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
get(String.format("https://mycampus.imp.fu-berlin.de/direct/content/site/%s.json?_validateSession=", ID), mLogin.getLoginTokenKVV().getCookies(), response -> {
|
||||
String body = response.getParsed();
|
||||
if (body == null) {
|
||||
errorCallback.onError(new NetworkError(101601, 403, "No resources retrieved!"));
|
||||
|
||||
@@ -33,7 +33,7 @@ public class KVVLogin extends HTTPService {
|
||||
callback.onResponse(token);
|
||||
return;
|
||||
}
|
||||
get(String.format("https://kvv.imp.fu-berlin.de/direct/profile/%s.json", token.getUsername()), token.getCookies(), response -> {
|
||||
get(String.format("https://mycampus.imp.fu-berlin.de/direct/profile/%s.json", token.getUsername()), token.getCookies(), response -> {
|
||||
String body = response.getParsed();
|
||||
if (body == null) {
|
||||
errorCallback.onError(new NetworkError(100172, 403, "Testing login failed!"));
|
||||
@@ -87,7 +87,7 @@ public class KVVLogin extends HTTPService {
|
||||
}
|
||||
|
||||
private void step0(String username, final NetworkCallback<Boolean> callback, final NetworkErrorCallback errorCallback) {
|
||||
get(String.format("https://kvv.imp.fu-berlin.de/direct/profile/%s", username), null, result -> {
|
||||
get(String.format("https://mycampus.imp.fu-berlin.de/direct/profile/%s", username), null, result -> {
|
||||
callback.onResponse(true);
|
||||
}, error -> {
|
||||
if (error.networkResponse.statusCode == 500) {
|
||||
@@ -99,11 +99,11 @@ public class KVVLogin extends HTTPService {
|
||||
}
|
||||
|
||||
/*
|
||||
1= GET https://kvv.imp.fu-berlin.de/Shibboleth.sso/Login?entityID=https://identity.fu-berlin.de/idp-fub
|
||||
1= GET https://mycampus.imp.fu-berlin.de/Shibboleth.sso/Login?entityID=https://identity.fu-berlin.de/idp-fub
|
||||
-> Location-Header: https://identity.fu-berlin.de/idp-fub/profile/SAML2/Redirect/SSO?SAMLResponse=[SAMLResponse]&RelayState=[RelayState]
|
||||
*/
|
||||
private void step1(final NetworkCallback<HashMap<String, String>> callback, final NetworkErrorCallback errorCallback) {
|
||||
get("https://kvv.imp.fu-berlin.de/Shibboleth.sso/Login?entityID=https://identity.fu-berlin.de/idp-fub", null, response -> {
|
||||
get("https://mycampus.imp.fu-berlin.de/Shibboleth.sso/Login?entityID=https://identity.fu-berlin.de/idp-fub", null, response -> {
|
||||
String location = response.getHeaders().get("Location");
|
||||
if (location==null) {
|
||||
errorCallback.onError(new NetworkError(100111, -1, "Error on getting SAML request!"));
|
||||
@@ -116,7 +116,7 @@ public class KVVLogin extends HTTPService {
|
||||
}
|
||||
|
||||
/*
|
||||
5= POST https://kvv.imp.fu-berlin.de/Shibboleth.sso/SAML2/POST
|
||||
5= POST https://mycampus.imp.fu-berlin.de/Shibboleth.sso/SAML2/POST
|
||||
+ Body: SAMLResponse=[SAML-RESPONSE]
|
||||
+ Header: Content-Type: application/x-www-form-urlencoded
|
||||
-> Set-Cookie: _shibsession_[SESS-NR]: [SESS-VALUE]
|
||||
@@ -124,7 +124,7 @@ public class KVVLogin extends HTTPService {
|
||||
private void step5(String SAMLResponse, final NetworkCallback<HashMap<String, String>> callback, final NetworkErrorCallback errorCallback) {
|
||||
HashMap<String, String> body = new HashMap<>();
|
||||
body.put("SAMLResponse", SAMLResponse);
|
||||
post("https://kvv.imp.fu-berlin.de/Shibboleth.sso/SAML2/POST", null, body, response -> {
|
||||
post("https://mycampus.imp.fu-berlin.de/Shibboleth.sso/SAML2/POST", null, body, response -> {
|
||||
String cookies = response.getHeaders().get("Set-Cookie");
|
||||
if (cookies ==null) {
|
||||
errorCallback.onError(new NetworkError(100151, -1, "Error on starting KVV session!"));
|
||||
@@ -147,14 +147,14 @@ public class KVVLogin extends HTTPService {
|
||||
|
||||
|
||||
/*
|
||||
6= https://kvv.imp.fu-berlin.de/sakai-login-tool/container
|
||||
6= https://mycampus.imp.fu-berlin.de/sakai-login-tool/container
|
||||
+ Cookie: _shibsession_[SESS-NR]: [SESS-VALUE]
|
||||
-> Set-Cookie: JSESSIONID: [JSESSION-KVV]
|
||||
*/
|
||||
private void step6(String shibsessionKey, String shibsessionName, final NetworkCallback<HashMap<String, String>> callback, final NetworkErrorCallback errorCallback) {
|
||||
HashMap<String, String> cookies = new HashMap<>();
|
||||
cookies.put(shibsessionKey, shibsessionName);
|
||||
get("https://kvv.imp.fu-berlin.de/sakai-login-tool/container", cookies, response -> {
|
||||
get("https://mycampus.imp.fu-berlin.de/sakai-login-tool/container", cookies, response -> {
|
||||
String cookies1 = response.getHeaders().get("Set-Cookie");
|
||||
if (cookies1 ==null) {
|
||||
errorCallback.onError(new NetworkError(100161, -1, "Cannot finish login process!"));
|
||||
|
||||
Reference in New Issue
Block a user