New KVV login working

This commit is contained in:
Caesar2011
2019-01-09 14:58:08 +01:00
parent 21d247052d
commit 7cc0709133

View File

@@ -80,11 +80,11 @@ public class Login extends HTTPService {
} }
/* /*
1= GET https://kvv.imp.fu-berlin.de/Shibboleth.sso/Login?entityID=https://identity.fu-berlin.de/idp-fub-qa 1= GET https://kvv.imp.fu-berlin.de/Shibboleth.sso/Login?entityID=https://identity.fu-berlin.de/idp-fub
-> Location-Header: https://identity.fu-berlin.de:9443/idp-fub-qa/profile/SAML2/Redirect/SSO?SAMLResponse=[SAMLResponse]&RelayState=[RelayState] -> Location-Header: https://identity.fu-berlin.de:9443/idp-fub-qa/profile/SAML2/Redirect/SSO?SAMLResponse=[SAMLResponse]&RelayState=[RelayState]
*/ */
private void step1(final NetworkCallback<HashMap<String, String>> callback, final NetworkErrorCallback errorCallback) { 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-qa", null, response -> { get("https://kvv.imp.fu-berlin.de/Shibboleth.sso/Login?entityID=https://identity.fu-berlin.de/idp-fub", null, response -> {
String location = response.getHeaders().get("Location"); String location = response.getHeaders().get("Location");
if (location==null) { if (location==null) {
errorCallback.onError(new NetworkError(100111, -1, "Error on getting SAML request!")); errorCallback.onError(new NetworkError(100111, -1, "Error on getting SAML request!"));
@@ -126,7 +126,7 @@ public class Login extends HTTPService {
private void step3(String JSESSIONID_FU, final NetworkCallback<Boolean> callback, final NetworkErrorCallback errorCallback) { private void step3(String JSESSIONID_FU, final NetworkCallback<Boolean> callback, final NetworkErrorCallback errorCallback) {
HashMap<String, String> cookies = new HashMap<>(); HashMap<String, String> cookies = new HashMap<>();
cookies.put("JSESSIONID", JSESSIONID_FU); cookies.put("JSESSIONID", JSESSIONID_FU);
get("https://identity.fu-berlin.de:9443/idp-fub-qa/profile/SAML2/Redirect/SSO?execution=e1s1", cookies, response -> { get("https://identity.fu-berlin.de/idp-fub/profile/SAML2/Redirect/SSO?execution=e1s1", cookies, response -> {
callback.onResponse(true); callback.onResponse(true);
}, error -> errorCallback.onError(new NetworkError(100130, error.networkResponse.statusCode, "Error starting login page!"))); }, error -> errorCallback.onError(new NetworkError(100130, error.networkResponse.statusCode, "Error starting login page!")));
} }
@@ -147,7 +147,7 @@ public class Login extends HTTPService {
body.put("j_username", username); body.put("j_username", username);
body.put("j_password", password); body.put("j_password", password);
body.put("_eventId_proceed", ""); body.put("_eventId_proceed", "");
post("https://identity.fu-berlin.de:9443/idp-fub-qa/profile/SAML2/Redirect/SSO?execution=e1s1", cookies, body, response -> { post("https://identity.fu-berlin.de/idp-fub/profile/SAML2/Redirect/SSO?execution=e1s1", cookies, body, response -> {
String cookies1 = response.getHeaders().get("Set-Cookie"); String cookies1 = response.getHeaders().get("Set-Cookie");
if (cookies1 ==null) { if (cookies1 ==null) {
errorCallback.onError(new NetworkError(100141, -1, "Error on logging in to FU Identity Server!")); errorCallback.onError(new NetworkError(100141, -1, "Error on logging in to FU Identity Server!"));