diff options
| author | unknown | 2014-03-27 11:53:38 +0100 |
|---|---|---|
| committer | unknown | 2014-03-27 11:53:38 +0100 |
| commit | 9464f7fc790cf54760b247681c4cd6417ff8a995 (patch) | |
| tree | ac81342fa852c5440715e897b32b6c9ae256f718 /Dozentenmodul/src/gui/Login_GUI.java | |
| parent | SQL Abfragen auf ID und Version umgestellt (diff) | |
| download | tutor-module-9464f7fc790cf54760b247681c4cd6417ff8a995.tar.gz tutor-module-9464f7fc790cf54760b247681c4cd6417ff8a995.tar.xz tutor-module-9464f7fc790cf54760b247681c4cd6417ff8a995.zip | |
Authentifizierung über Masterserver funktioniert nun
Diffstat (limited to 'Dozentenmodul/src/gui/Login_GUI.java')
| -rw-r--r-- | Dozentenmodul/src/gui/Login_GUI.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Dozentenmodul/src/gui/Login_GUI.java b/Dozentenmodul/src/gui/Login_GUI.java index cc558261..58d1d104 100644 --- a/Dozentenmodul/src/gui/Login_GUI.java +++ b/Dozentenmodul/src/gui/Login_GUI.java @@ -27,7 +27,15 @@ import javax.swing.border.EmptyBorder; import models.person; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; import org.ini4j.Wini; +import thrift.AuthenticationException; +import thrift.ImageServer; +import thrift.SessionData; +import thrift.MasterThriftConnection; +import thrift.ImageServer.Client; import config.config_file; @@ -145,6 +153,25 @@ public class Login_GUI extends JFrame { //Ldap check=new Ldap(); boolean login=true; //boolean login=check.LdapAuth(username.getText(), new String(pass.getPassword())); + MasterThriftConnection thrift=new MasterThriftConnection(); + Client client=thrift.getMasterThriftConnection(); + String token=null; + final thrift.SessionData result; + try { + String passText = new String(pass.getPassword()); + System.out.println(username.getText()+" "+passText); + result = client.authenticate(username.getText(), passText); + } catch (thrift.AuthenticationException e) { + System.out.println("Authentifizierung fehlgeschlagen: " + + e.message); + return; + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } + System.out.println("Konnte mich beim MasterServer authentifizieren. Meine Session-ID ist " + result.sessionId + ", mein Token für den Satelliten " + result.authToken); + token = result.authToken; if(login==true) { |
