summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-07-08 19:39:35 +0200
committerSimon Rettberg2015-07-08 19:39:35 +0200
commit8d6cd17c330388aa13fd7c39802c7400d85f972c (patch)
tree5f2c5856f58b1454e24dc16fad10751dfe9d087b /dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
parentoops (diff)
downloadtutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.tar.gz
tutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.tar.xz
tutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.zip
[client] Redo package structure, add comments/TODOs, rename GUI classes
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
new file mode 100644
index 00000000..33612746
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
@@ -0,0 +1,47 @@
+package org.openslx.dozmod.thrift;
+
+import org.openslx.bwlp.thrift.iface.ClientSessionData;
+import org.openslx.dozmod.authentication.ServiceProviderResponse;
+
+public class Session {
+
+ private static String firstName = null;
+
+ private static String lastName = null;
+
+ private static String eMail = null;
+
+ private static String userId = null;
+
+ private static String satelliteToken = null;
+
+ private static String masterToken = null;
+
+ public static void fromClientSessionData(ClientSessionData session) {
+ if (userId != null && !userId.equals(session.userInfo.userId))
+ throw new IllegalArgumentException("Cannot set new session data with different user id!");
+ firstName = session.userInfo.firstName;
+ lastName = session.userInfo.lastName;
+ eMail = session.userInfo.eMail;
+ userId = session.userInfo.userId;
+ masterToken = session.sessionId;
+ satelliteToken = session.authToken;
+ }
+
+ public static void fromEcpLogin(ServiceProviderResponse response) {
+ // TODO
+ //if (userId != null && !userId.equals(response.userId))
+ // throw new IllegalArgumentException("Cannot set new session data with different user id!");
+ firstName = response.firstName;
+ lastName = response.lastName;
+ eMail = response.mail;
+ //userId = response.userId; TODO
+ masterToken = response.token;
+ satelliteToken = response.sessionId;
+ }
+
+ public static String getSatelliteToken() {
+ return satelliteToken;
+ }
+
+}