From 8d6cd17c330388aa13fd7c39802c7400d85f972c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 8 Jul 2015 19:39:35 +0200 Subject: [client] Redo package structure, add comments/TODOs, rename GUI classes --- .../java/org/openslx/dozmod/thrift/Session.java | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java') 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; + } + +} -- cgit v1.2.3-55-g7522