Skip to content

Commit

Permalink
Added filtering of WPA3 on hotspot scans
Browse files Browse the repository at this point in the history
Signed-off-by: pierantoniomerlino <[email protected]>
  • Loading branch information
pierantoniomerlino authored and MMaiero committed Dec 16, 2024
1 parent 8bdcede commit acee329
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion kura/org.eclipse.kura.web2/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Import-Package: com.eclipsesource.json;version="0.9.5",
org.eclipse.kura.security.keystore;version="1.0.0",
org.eclipse.kura.security.tamper.detection;version="[1.0,2.0)",
org.eclipse.kura.ssl;version="[2.0,3.0)",
org.eclipse.kura.system;version="[1.3,2.0)",
org.eclipse.kura.system;version="[1.9,2.0)",
org.eclipse.kura.type;version="[1.0,2.0)",
org.eclipse.kura.usb;version="[1.0,2.0)",
org.eclipse.kura.util.base;version="[1.0,2.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger;

import org.eclipse.kura.system.SystemService;
Expand Down Expand Up @@ -166,6 +167,7 @@ interface TabWirelessUiUiBinder extends UiBinder<Widget, TabWirelessUi> {
private GwtWifiNetInterfaceConfig selectedNetIfConfig;
private String tcp4Status;
private String tcp6Status;
private AtomicBoolean isWPA3Supported = new AtomicBoolean(false);

GwtWifiConfig activeConfig;
GwtWifiChannelModel previousSelection;
Expand Down Expand Up @@ -922,7 +924,7 @@ private void initForm() {
});

// Wireless Security
initWifiSecurityListBox(false);
initWifiSecurityListBox();

// Password
this.labelPassword.setText(MSGS.netWifiWirelessPassword());
Expand Down Expand Up @@ -1499,9 +1501,16 @@ public void onFailure(Throwable caught) {
@Override
public void onSuccess(List<GwtWifiHotspotEntry> result) {
TabWirelessUi.this.ssidDataProvider.getList().clear();

for (GwtWifiHotspotEntry pair : result) {
TabWirelessUi.this.ssidDataProvider.getList().add(pair);
if (pair.getSecurity().equals(GwtWifiSecurity.netWifiSecurityWPA3.value())
|| pair.getSecurity()
.equals(GwtWifiSecurity.netWifiSecurityWPA2_WPA3.value())) {
if (TabWirelessUi.this.isWPA3Supported.get()) {
TabWirelessUi.this.ssidDataProvider.getList().add(pair);
}
} else {
TabWirelessUi.this.ssidDataProvider.getList().add(pair);
}
}
TabWirelessUi.this.ssidDataProvider.flush();
if (!TabWirelessUi.this.ssidDataProvider.getList().isEmpty()) {
Expand Down Expand Up @@ -1885,28 +1894,30 @@ public void onSuccess(List<GwtGroupedNVPair> result) {
.findFirst();
if (wpa3SupportPair.isPresent()
&& Boolean.parseBoolean(wpa3SupportPair.get().getValue())) {
initWifiSecurityListBox(true);
TabWirelessUi.this.isWPA3Supported.set(true);
initWifiSecurityListBox();
}
}
});
}
});
}

private void initWifiSecurityListBox(boolean isWPA3WifiSecuritySupported) {
private void initWifiSecurityListBox() {
this.labelSecurity.setText(MSGS.netWifiWirelessSecurity());
this.security.addMouseOverHandler(event -> {
if (TabWirelessUi.this.security.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(composeNetWifiToolTipSecurity(isWPA3WifiSecuritySupported)));
TabWirelessUi.this.helpText
.add(new Span(composeNetWifiToolTipSecurity(TabWirelessUi.this.isWPA3Supported.get())));
}
});
this.security.addMouseOutHandler(event -> resetHelp());
this.security.clear();
for (GwtWifiSecurity mode : GwtWifiSecurity.values()) {
if (mode.equals(GwtWifiSecurity.netWifiSecurityWPA3)
|| mode.equals(GwtWifiSecurity.netWifiSecurityWPA2_WPA3)) {
if (isWPA3WifiSecuritySupported) {
if (TabWirelessUi.this.isWPA3Supported.get()) {
this.security.addItem(MessageUtils.get(mode.name()));
}
} else {
Expand Down

0 comments on commit acee329

Please sign in to comment.