mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-11-04 04:27:59 +00:00 
			
		
		
		
	WIFI-626: Integration of Captive Portal Profile with AP (embedded portal, 1 SSID)
This commit is contained in:
		@@ -12,7 +12,7 @@
 | 
				
			|||||||
        "headerContent": "Captive Portal",
 | 
					        "headerContent": "Captive Portal",
 | 
				
			||||||
        "userAcceptancePolicy": "Use this network at your own risk. No warranty of any kind.",
 | 
					        "userAcceptancePolicy": "Use this network at your own risk. No warranty of any kind.",
 | 
				
			||||||
        "successPageMarkdownText": "Welcome to the network",
 | 
					        "successPageMarkdownText": "Welcome to the network",
 | 
				
			||||||
        "redirectURL": "",
 | 
					        "redirectURL": "www.google.com",
 | 
				
			||||||
        "externalCaptivePortalURL": null,
 | 
					        "externalCaptivePortalURL": null,
 | 
				
			||||||
        "sessionTimeoutInMinutes": 60,
 | 
					        "sessionTimeoutInMinutes": 60,
 | 
				
			||||||
        "logoFile": {
 | 
					        "logoFile": {
 | 
				
			||||||
@@ -35,8 +35,8 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        "walledGardenAllowlist": [
 | 
					        "walledGardenAllowlist": [
 | 
				
			||||||
          "1.2.3.4",
 | 
					          "1.2.3.4",
 | 
				
			||||||
          "1.2.3.4-2.3.4.5",
 | 
					          "1.2.3.6-2.3.4.5",
 | 
				
			||||||
          "connectus.ai"
 | 
					          "netexperience.com"
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        "usernamePasswordFile": null,
 | 
					        "usernamePasswordFile": null,
 | 
				
			||||||
        "authenticationType": "guest",
 | 
					        "authenticationType": "guest",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,6 +53,7 @@ import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiStatsConfigInf
 | 
				
			|||||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiVifConfigInfo;
 | 
					import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiVifConfigInfo;
 | 
				
			||||||
import com.telecominfraproject.wlan.profile.bonjour.models.BonjourGatewayProfile;
 | 
					import com.telecominfraproject.wlan.profile.bonjour.models.BonjourGatewayProfile;
 | 
				
			||||||
import com.telecominfraproject.wlan.profile.bonjour.models.BonjourServiceSet;
 | 
					import com.telecominfraproject.wlan.profile.bonjour.models.BonjourServiceSet;
 | 
				
			||||||
 | 
					import com.telecominfraproject.wlan.profile.captiveportal.models.CaptivePortalAuthenticationType;
 | 
				
			||||||
import com.telecominfraproject.wlan.profile.captiveportal.models.CaptivePortalConfiguration;
 | 
					import com.telecominfraproject.wlan.profile.captiveportal.models.CaptivePortalConfiguration;
 | 
				
			||||||
import com.telecominfraproject.wlan.profile.captiveportal.models.ManagedFileInfo;
 | 
					import com.telecominfraproject.wlan.profile.captiveportal.models.ManagedFileInfo;
 | 
				
			||||||
import com.telecominfraproject.wlan.profile.models.Profile;
 | 
					import com.telecominfraproject.wlan.profile.models.Profile;
 | 
				
			||||||
@@ -2342,15 +2343,21 @@ public class OvsdbDao {
 | 
				
			|||||||
            DatabaseSchema dbSchema = ovsdbClient.getSchema(ovsdbName).join();
 | 
					            DatabaseSchema dbSchema = ovsdbClient.getSchema(ovsdbName).join();
 | 
				
			||||||
            TableSchema tableSchema = dbSchema.getTables().get(wifiVifConfigDbTable);
 | 
					            TableSchema tableSchema = dbSchema.getTables().get(wifiVifConfigDbTable);
 | 
				
			||||||
            if (tableSchema.getColumns().containsKey("captive_portal")) {
 | 
					            if (tableSchema.getColumns().containsKey("captive_portal")) {
 | 
				
			||||||
                @SuppressWarnings("unchecked")
 | 
					            	@SuppressWarnings("unchecked")
 | 
				
			||||||
                com.vmware.ovsdb.protocol.operation.notation.Map<String, String> captivePortalMap = com.vmware.ovsdb.protocol.operation.notation.Map
 | 
					                com.vmware.ovsdb.protocol.operation.notation.Map<String, String> captivePortalMap = com.vmware.ovsdb.protocol.operation.notation.Map
 | 
				
			||||||
                        .of(captiveMap);
 | 
					                        .of(captiveMap);
 | 
				
			||||||
                updateColumns.put("captive_portal", captivePortalMap);
 | 
					                updateColumns.put("captive_portal", captivePortalMap);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (tableSchema.getColumns().containsKey("captive_allowlist")) {
 | 
					            if (tableSchema.getColumns().containsKey("captive_allowlist")) {
 | 
				
			||||||
                com.vmware.ovsdb.protocol.operation.notation.Set captiveAllowList = com.vmware.ovsdb.protocol.operation.notation.Set
 | 
					            	if (walledGardenAllowlist != null && !walledGardenAllowlist.isEmpty()) {
 | 
				
			||||||
                        .of(walledGardenAllowlist);
 | 
					                    Set<Atom<String>> atomMacList = new HashSet<>();
 | 
				
			||||||
                updateColumns.put("captive_allowlist", captiveAllowList);
 | 
					                    walledGardenAllowlist.stream().forEach(allow -> atomMacList.add(new Atom<>(allow)));
 | 
				
			||||||
 | 
					                    com.vmware.ovsdb.protocol.operation.notation.Set allowListSet = com.vmware.ovsdb.protocol.operation.notation.Set
 | 
				
			||||||
 | 
					                            .of(atomMacList);
 | 
				
			||||||
 | 
					                    updateColumns.put("captive_allowlist", allowListSet);
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    updateColumns.put("captive_allowlist", new com.vmware.ovsdb.protocol.operation.notation.Set());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // TODO: when AP support for Bonjour Gateway set values
 | 
					            // TODO: when AP support for Bonjour Gateway set values
 | 
				
			||||||
@@ -2927,6 +2934,7 @@ public class OvsdbDao {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    captiveMap.put("acceptance_policy", captiveProfileDetails.getUserAcceptancePolicy());
 | 
					                    captiveMap.put("acceptance_policy", captiveProfileDetails.getUserAcceptancePolicy());
 | 
				
			||||||
                    captiveMap.put("login_success_text", captiveProfileDetails.getSuccessPageMarkdownText());
 | 
					                    captiveMap.put("login_success_text", captiveProfileDetails.getSuccessPageMarkdownText());
 | 
				
			||||||
 | 
					                    captiveMap.put("authentication", getCaptiveAuthentication(captiveProfileDetails.getAuthenticationType()));
 | 
				
			||||||
                    // captiveMap.put("externalCaptivePortalURL",
 | 
					                    // captiveMap.put("externalCaptivePortalURL",
 | 
				
			||||||
                    // captiveProfileDetails.getExternalCaptivePortalURL());
 | 
					                    // captiveProfileDetails.getExternalCaptivePortalURL());
 | 
				
			||||||
                    // captiveMap.put("backgroundPosition",
 | 
					                    // captiveMap.put("backgroundPosition",
 | 
				
			||||||
@@ -2945,6 +2953,20 @@ public class OvsdbDao {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    private String getCaptiveAuthentication(CaptivePortalAuthenticationType authentication) {
 | 
				
			||||||
 | 
					        switch (authentication) {
 | 
				
			||||||
 | 
					            case guest:
 | 
				
			||||||
 | 
					                    return "None";
 | 
				
			||||||
 | 
					            case username:
 | 
				
			||||||
 | 
					                    return "Captive Portal User List";
 | 
				
			||||||
 | 
					            case radius:
 | 
				
			||||||
 | 
					                    return "RADIUS";
 | 
				
			||||||
 | 
					            default:
 | 
				
			||||||
 | 
					                    LOG.error("Unsupported captive portal authentication {}", authentication);
 | 
				
			||||||
 | 
					                    return "None";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void getBonjourGatewayConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
 | 
					    private void getBonjourGatewayConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
 | 
				
			||||||
            Map<Short, Set<String>> bonjourServiceMap) {
 | 
					            Map<Short, Set<String>> bonjourServiceMap) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user