diff options
| author | Jonathan Bauer | 2015-03-03 19:02:48 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2015-03-03 19:02:48 +0100 |
| commit | 0447841f3a08890bf746625d0f17976adada6ac8 (patch) | |
| tree | f63bd9f2ac8d77f4732b70cac8e5c0497f4d3a45 /dozentenmodul/src/main/java/util/ShibbolethECP.java | |
| parent | warnings fix (diff) | |
| download | tutor-module-0447841f3a08890bf746625d0f17976adada6ac8.tar.gz tutor-module-0447841f3a08890bf746625d0f17976adada6ac8.tar.xz tutor-module-0447841f3a08890bf746625d0f17976adada6ac8.zip | |
bwIDM - Shibboleth login working for Freiburg's SP - more to come
rework GUI classes to work with GuiManager: use GuiManager.show(<GUI to show>) and GuiManager.openPopup(<popup like About_GUI or ListAllOtherUsers_GUI>) only!
static openlinks class (models/links.java deleted). There are keywords to open links, e.g. OpenLinks.openWebpage("faq"). Please see the class.
Diffstat (limited to 'dozentenmodul/src/main/java/util/ShibbolethECP.java')
| -rw-r--r-- | dozentenmodul/src/main/java/util/ShibbolethECP.java | 29 |
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; } |
