summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/util/ShibbolethECP.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/util/ShibbolethECP.java')
-rw-r--r--dozentenmodul/src/main/java/util/ShibbolethECP.java29
1 files changed, 23 insertions, 6 deletions
diff --git a/dozentenmodul/src/main/java/util/ShibbolethECP.java b/dozentenmodul/src/main/java/util/ShibbolethECP.java
index b834b1a2..a3e13a38 100644
--- a/dozentenmodul/src/main/java/util/ShibbolethECP.java
+++ b/dozentenmodul/src/main/java/util/ShibbolethECP.java
@@ -33,6 +33,10 @@ public class ShibbolethECP {
private static final Gson GSON = new GsonBuilder().create();
/**
+ *
+ */
+ private static ServiceProviderResponse _lastResponse = null;
+ /**
* URL for bwLehrpool registration
*/
private static URL _registrationUrl = null;
@@ -71,7 +75,7 @@ public class ShibbolethECP {
static {
URI tmp;
try {
- tmp = new URI("https://bwlp-masterserver.ruf.uni-freiburg.de/secure-all/api.php");
+ tmp = new URI("https://bwlp-masterserver.ruf.uni-freiburg.de/webif/shib/api.php");
} catch (URISyntaxException e) {
// should never happen!
LOGGER.error("Bad URI syntax of the service provider, see trace: ", e);
@@ -80,6 +84,9 @@ public class ShibbolethECP {
BWLP_SP = tmp;
}
+ public static ServiceProviderResponse getResponse() {
+ return _lastResponse;
+ }
/**
* Fetches the resource
*
@@ -149,18 +156,18 @@ public class ShibbolethECP {
LOGGER.error("I/O error, see trace: ", e);
return ReturnCode.ERROR_OTHER;
}
- ServiceProviderResponse spr = null;
+ _lastResponse = null;
try {
- spr = GSON.fromJson(responseBody, ServiceProviderResponse.class);
+ _lastResponse = GSON.fromJson(responseBody, ServiceProviderResponse.class);
} catch (JsonSyntaxException e) {
LOGGER.error("Bad JSON syntax, see trace: ", e);
return ReturnCode.ERROR_SP;
}
// TODO: here we will need to parse the answer accordingly.
// no errors, meaning everything worked fine.
- if (spr.status.equals("unregistered")) {
+ if (_lastResponse.status.equals("unregistered")) {
try {
- _registrationUrl = new URL(spr.url);
+ _registrationUrl = new URL(_lastResponse.url);
} catch (MalformedURLException e) {
LOGGER.error("URL returned by masterserver is malformed, see trace: " + e);
return ReturnCode.ERROR_URL;
@@ -168,7 +175,17 @@ public class ShibbolethECP {
return ReturnCode.ERROR_UNREG;
}
// TODO the rest of the cases...
-
+ if (_lastResponse.status.equals("error")) {
+ LOGGER.error("Server side error: " + _lastResponse.error);
+ return ReturnCode.ERROR_OTHER;
+ }
+ if (_lastResponse.status.equals("anonymous")) {
+ LOGGER.error("IdP did not forward user account information to SP. Contact developper.");
+ return ReturnCode.ERROR_OTHER;
+ }
+ if (_lastResponse.status.equals("ok")) {
+ return ReturnCode.NO_ERROR;
+ }
// still here? then something else went wrong
return ReturnCode.ERROR_OTHER;
}