diff options
| author | Simon Rettberg | 2016-10-07 15:00:20 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2016-10-07 15:00:20 +0200 |
| commit | d0fc3ef322fa2a34b4c60123634436864d454ad5 (patch) | |
| tree | 696764564056c4f69c11fc5461371ddbd8d4e8f7 /dozentenmodul/src/main/java | |
| parent | [client] Call .applySettingsForLocalEdit() after downloading a VM (diff) | |
| download | tutor-module-d0fc3ef322fa2a34b4c60123634436864d454ad5.tar.gz tutor-module-d0fc3ef322fa2a34b4c60123634436864d454ad5.tar.xz tutor-module-d0fc3ef322fa2a34b4c60123634436864d454ad5.zip | |
[client] Better error messages if ECP login fails
Diffstat (limited to 'dozentenmodul/src/main/java')
3 files changed, 17 insertions, 5 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/EcpAuthenticator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/EcpAuthenticator.java index 31ac8cc4..5e4238cb 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/EcpAuthenticator.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/EcpAuthenticator.java @@ -54,16 +54,21 @@ public class EcpAuthenticator implements Authenticator { ret = ReturnCode.GENERIC_ERROR; } + ServiceProviderResponse response = ShibbolethEcp.getResponse(); + RuntimeException errEx = null; + if (response != null && response.error != null) { + errEx = new RuntimeException(response.error); + } + // If login succeeded, set up session data AuthenticationData data = null; if (ret == ReturnCode.NO_ERROR) { // we have a token? - ServiceProviderResponse response = ShibbolethEcp.getResponse(); final String token = response.token; if (token == null || token.isEmpty()) { // bad token LOGGER.error("No token received from the service provider!"); - callback.postLogin(ReturnCode.SERVICE_PROVIDER_ERROR, null, null); + callback.postLogin(ReturnCode.SERVICE_PROVIDER_ERROR, null, errEx); } // create the session for the user from the response of the ECP List<Satellite> sats = new ArrayList<>(); @@ -79,6 +84,6 @@ public class EcpAuthenticator implements Authenticator { } data = new AuthenticationData(response.token, response.sessionId, sats); } - callback.postLogin(ret, data, null); + callback.postLogin(ret, data, errEx); } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethEcp.java b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethEcp.java index bf1405bb..dc2215c1 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethEcp.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethEcp.java @@ -165,7 +165,8 @@ public class ShibbolethEcp { return ReturnCode.GENERIC_ERROR; } if (lastResponse.status.equals("anonymous")) { - LOGGER.error("IdP did not forward user account information to SP. Contact developper."); + LOGGER.error("IdP did not forward user account information to SP. Contact developer."); + lastResponse.error = "Ihr Identity-Provider hat dem bwLehrpool-System Ihre E-Mail oder Ihren Namen nicht mitgeteilt"; return ReturnCode.GENERIC_ERROR; } if (lastResponse.status.equals("ok")) { diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java index 9e028041..e42406b0 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java @@ -378,7 +378,13 @@ public class LoginWindow extends LoginWindowLayout { break; case GENERIC_ERROR: default: - Gui.showMessageBox(me, "Internal error!", MessageType.ERROR, LOGGER, null); + if (t == null || !t.getClass().equals(RuntimeException.class)) { + Gui.showMessageBox(me, "Internal error!", MessageType.ERROR, null, t); + } else { + Gui.showMessageBox(me, "Der Master-Server hat den Loginversuch mit der" + + " folgenden Nachricht abgewiesen:\n\n" + + t.getMessage(), MessageType.ERROR, null, null); + } break; } enableLogin(true); |
