summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java')
-rw-r--r--dozentenmodul/src/main/java/config/Config.java18
-rw-r--r--dozentenmodul/src/main/java/gui/intro/Login_GUI.java44
2 files changed, 60 insertions, 2 deletions
diff --git a/dozentenmodul/src/main/java/config/Config.java b/dozentenmodul/src/main/java/config/Config.java
index e6686a60..97ede10d 100644
--- a/dozentenmodul/src/main/java/config/Config.java
+++ b/dozentenmodul/src/main/java/config/Config.java
@@ -171,6 +171,15 @@ public class Config {
public static int getIdP() {
return Integer.parseInt(getString("main", "IdP", ""));
}
+ /**
+ * Query the authentication method of the configuration file
+ * @return stored IdP
+ */
+ public static String getAuthenticationMethod() {
+ return getString("main", "authMethod", "");
+ }
+
+
/**
* Sets the value of 'BillOfRights' in the configuration file to 'value'
@@ -221,6 +230,13 @@ public class Config {
public static boolean setIdP(String value) {
return setString("main", "IdP", value);
}
+ /**
+ * Sets the value of the selected authentication method in the configuration file to 'value'
+ * @return true if it succeeded, false otherwise
+ */
+ public static boolean setAuthenticationMethod(String value) {
+ return setString("main","authMethod", value);
+ }
/**
* Save the changes to the ini file to actual file on the disk.
@@ -295,4 +311,6 @@ public class Config {
private static boolean setString(String section, String key, String value) {
return ini.put(section, key, value) != null;
}
+
+
}
diff --git a/dozentenmodul/src/main/java/gui/intro/Login_GUI.java b/dozentenmodul/src/main/java/gui/intro/Login_GUI.java
index 57876479..7035f057 100644
--- a/dozentenmodul/src/main/java/gui/intro/Login_GUI.java
+++ b/dozentenmodul/src/main/java/gui/intro/Login_GUI.java
@@ -9,9 +9,11 @@ import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.ExecutionException;
+import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
@@ -233,7 +235,7 @@ public class Login_GUI extends JInternalFrame {
panel_1.add(rdbtnBwIDM);
rdbtnMasterserver = new JRadioButton("Test-Zugang mit festem Benutzer");
- rdbtnMasterserver.setSelected(true);
+ //rdbtnMasterserver.setSelected(true);
rdbtnMasterserver.setActionCommand(LOGIN_TYPE_BWLEHRPOOL);
rdbtnMasterserver.addActionListener(loginTypeActionListener);
rdbtnMasterserver.setBounds(32, 60, 244, 23);
@@ -248,9 +250,12 @@ public class Login_GUI extends JInternalFrame {
bgLoginType.add(rdbtnDirekteVerbindung);
panel_1.add(rdbtnDirekteVerbindung);
+ setSelectedRadioButton();
+
panel.setVisible(true);
panel_1.setVisible(true);
contentPane.setVisible(true);
+
}// end LoginGUI()
@@ -425,17 +430,52 @@ public class Login_GUI extends JInternalFrame {
Config.setUsername(lblusername.getText());
Config.setSaveUsername(true);
Config.setIdP(String.valueOf(idpChoice.getSelectedIndex()));
+ Config.setAuthenticationMethod(getSelectedRadioButton());
} else
{
Config.setUsername("");
Config.setSaveUsername(false);
- Config.setIdP(String.valueOf(0));
}
// save it to local disk
Config.store();
}// end performLogin
+ private String getSelectedRadioButton()
+ {
+ for (Enumeration<AbstractButton> buttons = bgLoginType.getElements(); buttons.hasMoreElements();) {
+ AbstractButton button = buttons.nextElement();
+
+ if (button.isSelected()) {
+ return button.getText();
+ }
+ }
+
+ return null;
+ }
+
+ private void setSelectedRadioButton()
+ {
+ String authMethodByConfig = Config.getAuthenticationMethod();
+
+ if(authMethodByConfig.equals("Test-Zugang mit festem Benutzer"))
+ {
+ rdbtnMasterserver.setSelected(true);
+ }
+ else if(authMethodByConfig.equals("Direkte Verbindung zum Satelliten"))
+ {
+ rdbtnMasterserver.setSelected(true);
+
+ }
+ else
+ {
+ rdbtnBwIDM.setSelected(true);
+ toggleLoginType(LOGIN_TYPE_BWIDM);
+ }
+ }
+
+
+
/**
* Common function for either authentication method
*/