diff options
author | Jonathan Bauer | 2015-07-10 14:05:52 +0200 |
---|---|---|
committer | Jonathan Bauer | 2015-07-10 14:05:52 +0200 |
commit | f44b17421b4c891273471649e072df49f419f172 (patch) | |
tree | b88b1ed2db2e89f8360868cff34f6fa2bff2eb7a /dozentenmodul/src/main/java/org/openslx/dozmod/authentication | |
parent | [client] close popups a bit safer (diff) | |
download | tutor-module-f44b17421b4c891273471649e072df49f419f172.tar.gz tutor-module-f44b17421b4c891273471649e072df49f419f172.tar.xz tutor-module-f44b17421b4c891273471649e072df49f419f172.zip |
[client] create session from the ServiceProviderResponse
added getters for Session class members
use getShell to dispose LoginWindow
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/authentication')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/authentication/EcpAuthenticator.java | 25 | ||||
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ServiceProviderResponse.java | 2 |
2 files changed, 15 insertions, 12 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 fbc26c5d..288a4cbc 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/EcpAuthenticator.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/EcpAuthenticator.java @@ -6,6 +6,7 @@ import org.openslx.bwlp.thrift.iface.TAuthenticationException; import org.openslx.bwlp.thrift.iface.TInvalidTokenException; import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.dozmod.authentication.ShibbolethEcp.ReturnCode; +import org.openslx.dozmod.thrift.Session; import org.openslx.thrifthelper.ThriftManager; /** @@ -58,18 +59,18 @@ public class EcpAuthenticator implements Authenticator { LOGGER.error("No token received from the service provider!"); callback.postLogin(ReturnCode.SERVICE_PROVIDER_ERROR, null, null); } - try { - // valid token? - userInfo = ThriftManager.getMasterClient().getUserFromToken(token); - } catch (TInvalidTokenException e) { - LOGGER.error("Masterserver does not accepts the token received from the Service Provider. See trace: ", e); - callback.postLogin(ReturnCode.SERVICE_PROVIDER_ERROR, null, e); - return; - } catch (TException e) { - LOGGER.error("Thrift transport error, see trace: ", e); - callback.postLogin(ReturnCode.GENERIC_ERROR, null, e); - return; - } + + // create the session for the user from the response of the ECP + Session.fromEcpLogin(ShibbolethEcp.getResponse()); + + // build userInfo from the information received + userInfo = new UserInfo(Session.getUserId(), + Session.getFirstName(), + Session.getLastName(), + Session.getEMail(), + Session.getOrganizationId()); + + // send it back to the GUI callback.postLogin(ReturnCode.NO_ERROR, userInfo, null); } else { // else just return the ReturnCode to the GUI diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ServiceProviderResponse.java b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ServiceProviderResponse.java index f222efb7..c8ff5a2c 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ServiceProviderResponse.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/authentication/ServiceProviderResponse.java @@ -10,6 +10,8 @@ public class ServiceProviderResponse { public HashMap<String, String> satellites; public String token; public String sessionId; + public String userId; + public String organizationId; public String url; public String error; } |