From c27d50c575ff5867aef8f10ccf2b5f2ac43dae08 Mon Sep 17 00:00:00 2001 From: Nino Breuer Date: Fri, 28 Nov 2014 16:07:58 +0100 Subject: • changed implementation of user authentication. • changed position of class file • fixed some little things (not necessary to mention) Important Notes: •organizationID in token returns "wrong" values, therefore university is still set by client. To be fixed someday. • userID is the value with which the user starts his log in. this value is not represented in the token! (as it is not(!) the email). To be implemented someday, as this value is represented in the masterserver. • Feature isn't well tested. --- .../main/java/gui/image/FTPEditDownloader_GUI.java | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java') diff --git a/dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java index a3e4c6cf..34e3efb3 100644 --- a/dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java @@ -49,8 +49,9 @@ import org.ini4j.Wini; import server.generated.Server.Client; import server.generated.User; import thrift.ThriftConnection; -import util.GuiOrganizer; import util.OpenLinks; + + import ftp.DownloadTask; import gui.intro.About_GUI; import gui.intro.MainMenue_GUI; @@ -65,7 +66,7 @@ public class FTPEditDownloader_GUI extends JFrame implements */ private final static Logger LOGGER = Logger .getLogger(FTPEditDownloader_GUI.class); - + @SuppressWarnings("unused") private JPanel contentPane; private final JPanel contentPanel = new JPanel(); @@ -108,12 +109,6 @@ public class FTPEditDownloader_GUI extends JFrame implements */ public FTPEditDownloader_GUI(Component formerGUI) { - try { - client.setTokenForSession(SessionData.session.getAuthToken()); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } final Object[] options = { "Beenden", "Abbrechen" }; @@ -133,8 +128,14 @@ public class FTPEditDownloader_GUI extends JFrame implements // 0=beenden, 1=abbrechen if (choice == 0) { try { - client.DeleteFtpUser(user.userName); + client.DeleteFtpUser(user.userName,SessionData.session.getAuthToken()); con.closeThriftConnection(); + try { + client.setSessionInvalid(SessionData.session.getAuthToken()); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -144,6 +145,12 @@ public class FTPEditDownloader_GUI extends JFrame implements }// end if coice } else { // no download running, close window + try { + client.setSessionInvalid(SessionData.session.getAuthToken()); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } System.exit(0); }// end if taskrun }// end window closing @@ -420,7 +427,7 @@ public class FTPEditDownloader_GUI extends JFrame implements isAborted = true; // set flag try { - client.DeleteFtpUser(user.userName); + client.DeleteFtpUser(user.userName,SessionData.session.getAuthToken()); LOGGER.info("FTP user deleted."); } catch (TException e1) { // TODO Auto-generated catch block @@ -459,7 +466,7 @@ public class FTPEditDownloader_GUI extends JFrame implements if (choice == 0) { task.cancel(true); try { - client.DeleteFtpUser(user.userName); + client.DeleteFtpUser(user.userName,SessionData.session.getAuthToken()); } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -518,12 +525,12 @@ public class FTPEditDownloader_GUI extends JFrame implements // Klick btnDownloadStarten.setText("Bitte warten"); try { - user = client.getFtpUser(); + user = client.getFtpUser(SessionData.session.getAuthToken()); downloadFile = user.path + "/" + client.getPathOfImage(Image.image.getImageId(), - Image.image.getVersion()); + Image.image.getVersion(),SessionData.session.getAuthToken()); } catch (TException e) { // TODO Auto-generated catch block -- cgit v1.2.3-55-g7522