Example: Set VPN Configuration
Focus
Focus
GlobalProtect

Example: Set VPN Configuration

Table of Contents
End-of-Life (EoL)

Example: Set VPN Configuration

private static String RESTRICTION_PORTAL
= "portal"; 
private static String RESTRICTION_USERNAME = "username"; 
private static String RESTRICTION_PASSWORD = "password"; 
private static String RESTRICTION_CONNECT_METHOD = "connect_method"; 
private static String RESTRICTION_CLIENT_CERTIFICATE
= "client_certificate"; 
private static String RESTRICTION_CLIENT_CERTIFICATE_PASSPHRASE
= "client_certificate_passphrase"; 
private static String RESTRICTION_APP_LIST = "app_list"; 
private static String RESTRICTION_REMOVE_CONFIG = "remove_vpn_config_via_restriction"; 
 
Bundle config = new Bundle(); 
config.putString(RESTRICTION_PORTAL, "192.168.1.1"); 
config.putString(RESTRICTION_USERNAME, "john"); 
config.putString(RESTRICTION_PASSWORD, "Passwd!234"); 
config.putString(RESTRICTION_CONNECT_METHOD, "user-logon"); 
config.putString(RESTRICTION_CLIENT_CERTIFICATE, "DAFDSaweEWQ23wDSAFD…."); 
config.putString(RESTRICTION_CLIENT_CERTIFICATE_PASSPHRASE,
"PA$$W0RD$123"); 
config.putString(RESTRICTION_APP_LIST, "allow list:com.android.chrome;com.android.calendar"); 
 
DevicePolicyManager dpm = (DevicePolicyManager) 
getSystemService(Context.DEVICE_POLICY_SERVICE); 
dpm.setApplicationRestrictions(EnforcerDeviceAdminReceiver.getComponentName(this), 
"com.paloaltonetworks.globalprotect", config);