Fixing Basic authentication

This commit is contained in:
Alexis Delhaie
2020-12-10 10:37:10 +01:00
parent 12456e3474
commit bb16995dbb
2 changed files with 9 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ public class AboutDialog extends JDialog {
public static final int WIDTH = 740; public static final int WIDTH = 740;
public static final int HEIGHT = 500; public static final int HEIGHT = 500;
public static final String VERSION = "0.1.5"; public static final String VERSION = "0.1.5.1";
private JPanel contentPane; private JPanel contentPane;
private JLabel version; private JLabel version;

View File

@@ -66,12 +66,15 @@ public class AuthorizationDialog extends JDialog {
private void onOK() { private void onOK() {
String type = (String) typeBox.getSelectedItem(); String type = (String) typeBox.getSelectedItem();
switch (Objects.requireNonNull(type)) { switch (Objects.requireNonNull(type)) {
case "Basic" -> finalValue = Tools.toBase64( case "Basic" -> finalValue = String.format(
"Basic %s",
Tools.toBase64(
String.format( String.format(
"%s:%s", "%s:%s",
usernameBasicField.getText(), usernameBasicField.getText(),
passwordBasicField.getText() passwordBasicField.getText()
) )
)
); );
case "Bearer" -> finalValue = String.format("Bearer %s", bearerTokenField.getText()); case "Bearer" -> finalValue = String.format("Bearer %s", bearerTokenField.getText());
} }