diff options
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) { |