blob: c4e6bb6bfd93b13ce8e42fbdbf4b7d849a7cb218 (
plain) (
tree)
|
|
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 organizationId = 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;
organizationId = response.organizationId;
masterToken = response.sessionId;
satelliteToken = response.token;
}
/**
* @return the first name
*/
public static String getFirstName() {
return firstName;
}
/**
* @return the last name
*/
public static String getLastName() {
return lastName;
}
/**
* @return the eMail
*/
public static String getEMail() {
return eMail;
}
/**
* @return the user id
*/
public static String getUserId() {
return userId;
}
/**
* @return the organization id
*/
public static String getOrganizationId() {
return organizationId;
}
/**
* @return the satellite token
*/
public static String getSatelliteToken() {
return satelliteToken;
}
/**
* @return the master token
*/
public static String getMasterToken() {
return masterToken;
}
}
|