diff options
author | Jonathan Bauer | 2015-07-09 10:29:32 +0200 |
---|---|---|
committer | Jonathan Bauer | 2015-07-09 10:29:32 +0200 |
commit | 58668cbdfb301b2aab6b3b6ad43363ac08f7d1fb (patch) | |
tree | 0927a362ffb59a0caeed9e3d7c9ccdcd38cc5c8b /dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethECP.java | |
parent | [client] fix pom.xml after new package structure (diff) | |
download | tutor-module-58668cbdfb301b2aab6b3b6ad43363ac08f7d1fb.tar.gz tutor-module-58668cbdfb301b2aab6b3b6ad43363ac08f7d1fb.tar.xz tutor-module-58668cbdfb301b2aab6b3b6ad43363ac08f7d1fb.zip |
[client] implemented GuiManager.showMessagBox using MessageType and SWT'ed the whole thing
adapted rest of the classes
further improved login error handling a bit
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethECP.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethECP.java | 27 |
1 files changed, 14 insertions, 13 deletions
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 0998c8af..2e249d6b 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethECP.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ShibbolethECP.java @@ -46,12 +46,13 @@ public class ShibbolethECP { * Return codes */ public static enum ReturnCode { + // TODO rework this... NO_ERROR(0, "Authentication against the identity provider and request of the service provider resource worked."), - IDP_ERROR(1, "Authentication against the identity provider failed."), - UNREG_ERROR(2, "User not registered to use bwLehrpool."), - ERROR_SP(3, "Invalid resource of the service provider."), - ERROR_URL(4, "Invalid URL received from master server."), - ERROR_OTHER(5, "Internal error."); + IDENTITY_PROVIDER_ERROR(1, "Authentication against the identity provider failed."), + UNREGISTERED_ERROR(2, "User not registered to use bwLehrpool."), + SERVICE_PROVIDER_ERROR(3, "Invalid resource of the service provider."), + INVALID_URL_ERROR(4, "Invalid URL received from master server."), + GENERIC_ERROR(5, "Internal error."); private final int id; private final String msg; @@ -109,19 +110,19 @@ public class ShibbolethECP { // first lets do some sanity checks if (BWLP_SP == null) { LOGGER.error("URI to service provider is not set. Check the initialization of 'BWLP_SP'."); - return ReturnCode.ERROR_OTHER; + return ReturnCode.GENERIC_ERROR; } if (idpUrl == null) { LOGGER.error("Identity provider is not set, did you initialize this class correctly?"); - return ReturnCode.ERROR_OTHER; + return ReturnCode.GENERIC_ERROR; } if (user == null) { LOGGER.error("No username given, aborting..."); - return ReturnCode.ERROR_OTHER; + return ReturnCode.GENERIC_ERROR; } if (pass == null) { LOGGER.error("No password given, aborting..."); - return ReturnCode.ERROR_OTHER; + return ReturnCode.GENERIC_ERROR; } // now init the authenticator for that idp and our static sp @@ -146,22 +147,22 @@ public class ShibbolethECP { // no errors, meaning everything worked fine. if (lastResponse.status.equals("unregistered")) { registrationUrl = new URL(lastResponse.url); - return ReturnCode.UNREG_ERROR; + return ReturnCode.UNREGISTERED_ERROR; } // TODO the rest of the cases... if (lastResponse.status.equals("error")) { LOGGER.error("Server side error: " + lastResponse.error); - return ReturnCode.ERROR_OTHER; + return ReturnCode.GENERIC_ERROR; } if (lastResponse.status.equals("anonymous")) { LOGGER.error("IdP did not forward user account information to SP. Contact developper."); - return ReturnCode.ERROR_OTHER; + return ReturnCode.GENERIC_ERROR; } if (lastResponse.status.equals("ok")) { return ReturnCode.NO_ERROR; } // still here? then something else went wrong - return ReturnCode.ERROR_OTHER; + return ReturnCode.GENERIC_ERROR; } /** * @return Registration URL given by the SP. |