android: Make remote identity configurable in the GUI
This commit is contained in:
+11
-1
@@ -90,6 +90,8 @@ public class VpnProfileDetailActivity extends AppCompatActivity
|
|||||||
private RelativeLayout mTncNotice;
|
private RelativeLayout mTncNotice;
|
||||||
private CheckBox mShowAdvanced;
|
private CheckBox mShowAdvanced;
|
||||||
private ViewGroup mAdvancedSettings;
|
private ViewGroup mAdvancedSettings;
|
||||||
|
private EditText mRemoteId;
|
||||||
|
private TextInputLayoutHelper mRemoteIdWrap;
|
||||||
private EditText mMTU;
|
private EditText mMTU;
|
||||||
private TextInputLayoutHelper mMTUWrap;
|
private TextInputLayoutHelper mMTUWrap;
|
||||||
private EditText mPort;
|
private EditText mPort;
|
||||||
@@ -131,6 +133,8 @@ public class VpnProfileDetailActivity extends AppCompatActivity
|
|||||||
mShowAdvanced = (CheckBox)findViewById(R.id.show_advanced);
|
mShowAdvanced = (CheckBox)findViewById(R.id.show_advanced);
|
||||||
mAdvancedSettings = (ViewGroup)findViewById(R.id.advanced_settings);
|
mAdvancedSettings = (ViewGroup)findViewById(R.id.advanced_settings);
|
||||||
|
|
||||||
|
mRemoteId = (EditText)findViewById(R.id.remote_id);
|
||||||
|
mRemoteIdWrap = (TextInputLayoutHelper) findViewById(R.id.remote_id_wrap);
|
||||||
mMTU = (EditText)findViewById(R.id.mtu);
|
mMTU = (EditText)findViewById(R.id.mtu);
|
||||||
mMTUWrap = (TextInputLayoutHelper) findViewById(R.id.mtu_wrap);
|
mMTUWrap = (TextInputLayoutHelper) findViewById(R.id.mtu_wrap);
|
||||||
mPort = (EditText)findViewById(R.id.port);
|
mPort = (EditText)findViewById(R.id.port);
|
||||||
@@ -151,10 +155,12 @@ public class VpnProfileDetailActivity extends AppCompatActivity
|
|||||||
if (TextUtils.isEmpty(mGateway.getText()))
|
if (TextUtils.isEmpty(mGateway.getText()))
|
||||||
{
|
{
|
||||||
mNameWrap.setHelperText(getString(R.string.profile_name_hint));
|
mNameWrap.setHelperText(getString(R.string.profile_name_hint));
|
||||||
|
mRemoteIdWrap.setHelperText(getString(R.string.profile_remote_id_hint));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mNameWrap.setHelperText(String.format(getString(R.string.profile_name_hint_gateway), mGateway.getText()));
|
mNameWrap.setHelperText(String.format(getString(R.string.profile_name_hint_gateway), mGateway.getText()));
|
||||||
|
mRemoteIdWrap.setHelperText(String.format(getString(R.string.profile_remote_id_hint_gateway), mGateway.getText()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -384,7 +390,8 @@ public class VpnProfileDetailActivity extends AppCompatActivity
|
|||||||
if (!show && mProfile != null)
|
if (!show && mProfile != null)
|
||||||
{
|
{
|
||||||
Integer st = mProfile.getSplitTunneling();
|
Integer st = mProfile.getSplitTunneling();
|
||||||
show = mProfile.getMTU() != null || mProfile.getPort() != null || (st != null && st != 0);
|
show = mProfile.getRemoteId() != null || mProfile.getMTU() != null ||
|
||||||
|
mProfile.getPort() != null || (st != null && st != 0);
|
||||||
}
|
}
|
||||||
mShowAdvanced.setVisibility(!show ? View.VISIBLE : View.GONE);
|
mShowAdvanced.setVisibility(!show ? View.VISIBLE : View.GONE);
|
||||||
mAdvancedSettings.setVisibility(show ? View.VISIBLE : View.GONE);
|
mAdvancedSettings.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||||
@@ -483,6 +490,8 @@ public class VpnProfileDetailActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
String certAlias = mCheckAuto.isChecked() ? null : mCertEntry.getAlias();
|
String certAlias = mCheckAuto.isChecked() ? null : mCertEntry.getAlias();
|
||||||
mProfile.setCertificateAlias(certAlias);
|
mProfile.setCertificateAlias(certAlias);
|
||||||
|
String remote_id = mRemoteId.getText().toString().trim();
|
||||||
|
mProfile.setRemoteId(remote_id.isEmpty() ? null : remote_id);
|
||||||
mProfile.setMTU(getInteger(mMTU));
|
mProfile.setMTU(getInteger(mMTU));
|
||||||
mProfile.setPort(getInteger(mPort));
|
mProfile.setPort(getInteger(mPort));
|
||||||
int st = 0;
|
int st = 0;
|
||||||
@@ -511,6 +520,7 @@ public class VpnProfileDetailActivity extends AppCompatActivity
|
|||||||
mVpnType = mProfile.getVpnType();
|
mVpnType = mProfile.getVpnType();
|
||||||
mUsername.setText(mProfile.getUsername());
|
mUsername.setText(mProfile.getUsername());
|
||||||
mPassword.setText(mProfile.getPassword());
|
mPassword.setText(mProfile.getPassword());
|
||||||
|
mRemoteId.setText(mProfile.getRemoteId());
|
||||||
mMTU.setText(mProfile.getMTU() != null ? mProfile.getMTU().toString() : null);
|
mMTU.setText(mProfile.getMTU() != null ? mProfile.getMTU().toString() : null);
|
||||||
mPort.setText(mProfile.getPort() != null ? mProfile.getPort().toString() : null);
|
mPort.setText(mProfile.getPort() != null ? mProfile.getPort().toString() : null);
|
||||||
mBlockIPv4.setChecked(mProfile.getSplitTunneling() != null ? (mProfile.getSplitTunneling() & VpnProfile.SPLIT_TUNNELING_BLOCK_IPV4) != 0 : false);
|
mBlockIPv4.setChecked(mProfile.getSplitTunneling() != null ? (mProfile.getSplitTunneling() & VpnProfile.SPLIT_TUNNELING_BLOCK_IPV4) != 0 : false);
|
||||||
|
|||||||
@@ -180,10 +180,26 @@
|
|||||||
android:text="@string/profile_advanced_label" />
|
android:text="@string/profile_advanced_label" />
|
||||||
|
|
||||||
<org.strongswan.android.ui.widget.TextInputLayoutHelper
|
<org.strongswan.android.ui.widget.TextInputLayoutHelper
|
||||||
android:id="@+id/mtu_wrap"
|
android:id="@+id/remote_id_wrap"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
app:helper_text="@string/profile_remote_id_hint" >
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputEditText
|
||||||
|
android:id="@+id/remote_id"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:hint="@string/profile_remote_id_label" />
|
||||||
|
|
||||||
|
</org.strongswan.android.ui.widget.TextInputLayoutHelper>
|
||||||
|
|
||||||
|
<org.strongswan.android.ui.widget.TextInputLayoutHelper
|
||||||
|
android:id="@+id/mtu_wrap"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
app:helper_text="@string/profile_mtu_hint" >
|
app:helper_text="@string/profile_mtu_hint" >
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
|
|||||||
@@ -67,6 +67,9 @@
|
|||||||
<string name="profile_ca_select_certificate">Wählen Sie ein bestimmtes CA-Zertifikat</string>
|
<string name="profile_ca_select_certificate">Wählen Sie ein bestimmtes CA-Zertifikat</string>
|
||||||
<string name="profile_advanced_label">Erweiterte Einstellungen</string>
|
<string name="profile_advanced_label">Erweiterte Einstellungen</string>
|
||||||
<string name="profile_show_advanced_label">Erweiterte Einstellungen anzeigen</string>
|
<string name="profile_show_advanced_label">Erweiterte Einstellungen anzeigen</string>
|
||||||
|
<string name="profile_remote_id_label">Server-Identität</string>
|
||||||
|
<string name="profile_remote_id_hint">Standardwert ist der konfigurierte Server. Eigene Werte werden explizit and den Server gesendet und während der Authentifizierung erzwungen</string>
|
||||||
|
<string name="profile_remote_id_hint_gateway">Standardwert ist \"%1$s\". Eigene Werte werden explizit and den Server gesendet und während der Authentifizierung erzwungen</string>
|
||||||
<string name="profile_mtu_label">MTU des VPN Tunnel-Device</string>
|
<string name="profile_mtu_label">MTU des VPN Tunnel-Device</string>
|
||||||
<string name="profile_mtu_hint">Falls der Standardwert in einem bestimmten Netzwerk nicht geeignet ist</string>
|
<string name="profile_mtu_hint">Falls der Standardwert in einem bestimmten Netzwerk nicht geeignet ist</string>
|
||||||
<string name="profile_port_label">Server Port</string>
|
<string name="profile_port_label">Server Port</string>
|
||||||
|
|||||||
@@ -67,6 +67,9 @@
|
|||||||
<string name="profile_ca_select_certificate">Wybierz określony certyfikat CA</string>
|
<string name="profile_ca_select_certificate">Wybierz określony certyfikat CA</string>
|
||||||
<string name="profile_advanced_label">Advanced settings</string>
|
<string name="profile_advanced_label">Advanced settings</string>
|
||||||
<string name="profile_show_advanced_label">Show advanced settings</string>
|
<string name="profile_show_advanced_label">Show advanced settings</string>
|
||||||
|
<string name="profile_remote_id_label">Server identity</string>
|
||||||
|
<string name="profile_remote_id_hint">Defaults to the configured server. Custom values are explicitly sent to the server and enforced during authentication</string>
|
||||||
|
<string name="profile_remote_id_hint_gateway">Defaults to \"%1$s\". Custom values are explicitly sent to the server and enforced during authentication</string>
|
||||||
<string name="profile_mtu_label">MTU of the VPN tunnel device</string>
|
<string name="profile_mtu_label">MTU of the VPN tunnel device</string>
|
||||||
<string name="profile_mtu_hint">In case the default value is unsuitable for a particular network</string>
|
<string name="profile_mtu_hint">In case the default value is unsuitable for a particular network</string>
|
||||||
<string name="profile_port_label">Server port</string>
|
<string name="profile_port_label">Server port</string>
|
||||||
|
|||||||
@@ -64,6 +64,9 @@
|
|||||||
<string name="profile_ca_select_certificate">Выбрать CA сертификат</string>
|
<string name="profile_ca_select_certificate">Выбрать CA сертификат</string>
|
||||||
<string name="profile_advanced_label">Advanced settings</string>
|
<string name="profile_advanced_label">Advanced settings</string>
|
||||||
<string name="profile_show_advanced_label">Show advanced settings</string>
|
<string name="profile_show_advanced_label">Show advanced settings</string>
|
||||||
|
<string name="profile_remote_id_label">Server identity</string>
|
||||||
|
<string name="profile_remote_id_hint">Defaults to the configured server. Custom values are explicitly sent to the server and enforced during authentication</string>
|
||||||
|
<string name="profile_remote_id_hint_gateway">Defaults to \"%1$s\". Custom values are explicitly sent to the server and enforced during authentication</string>
|
||||||
<string name="profile_mtu_label">MTU of the VPN tunnel device</string>
|
<string name="profile_mtu_label">MTU of the VPN tunnel device</string>
|
||||||
<string name="profile_mtu_hint">In case the default value is unsuitable for a particular network</string>
|
<string name="profile_mtu_hint">In case the default value is unsuitable for a particular network</string>
|
||||||
<string name="profile_port_label">Server port</string>
|
<string name="profile_port_label">Server port</string>
|
||||||
|
|||||||
@@ -65,6 +65,9 @@
|
|||||||
<string name="profile_ca_select_certificate">Вибрати спеціальний сертифікат CA</string>
|
<string name="profile_ca_select_certificate">Вибрати спеціальний сертифікат CA</string>
|
||||||
<string name="profile_advanced_label">Advanced settings</string>
|
<string name="profile_advanced_label">Advanced settings</string>
|
||||||
<string name="profile_show_advanced_label">Show advanced settings</string>
|
<string name="profile_show_advanced_label">Show advanced settings</string>
|
||||||
|
<string name="profile_remote_id_label">Server identity</string>
|
||||||
|
<string name="profile_remote_id_hint">Defaults to the configured server. Custom values are explicitly sent to the server and enforced during authentication</string>
|
||||||
|
<string name="profile_remote_id_hint_gateway">Defaults to \"%1$s\". Custom values are explicitly sent to the server and enforced during authentication</string>
|
||||||
<string name="profile_mtu_label">MTU of the VPN tunnel device</string>
|
<string name="profile_mtu_label">MTU of the VPN tunnel device</string>
|
||||||
<string name="profile_mtu_hint">In case the default value is unsuitable for a particular network</string>
|
<string name="profile_mtu_hint">In case the default value is unsuitable for a particular network</string>
|
||||||
<string name="profile_port_label">Server port</string>
|
<string name="profile_port_label">Server port</string>
|
||||||
|
|||||||
@@ -67,6 +67,9 @@
|
|||||||
<string name="profile_ca_select_certificate">Select a specific CA certificate</string>
|
<string name="profile_ca_select_certificate">Select a specific CA certificate</string>
|
||||||
<string name="profile_advanced_label">Advanced settings</string>
|
<string name="profile_advanced_label">Advanced settings</string>
|
||||||
<string name="profile_show_advanced_label">Show advanced settings</string>
|
<string name="profile_show_advanced_label">Show advanced settings</string>
|
||||||
|
<string name="profile_remote_id_label">Server identity</string>
|
||||||
|
<string name="profile_remote_id_hint">Defaults to the configured server. Custom values are explicitly sent to the server and enforced during authentication</string>
|
||||||
|
<string name="profile_remote_id_hint_gateway">Defaults to \"%1$s\". Custom values are explicitly sent to the server and enforced during authentication</string>
|
||||||
<string name="profile_mtu_label">MTU of the VPN tunnel device</string>
|
<string name="profile_mtu_label">MTU of the VPN tunnel device</string>
|
||||||
<string name="profile_mtu_hint">In case the default value is unsuitable for a particular network</string>
|
<string name="profile_mtu_hint">In case the default value is unsuitable for a particular network</string>
|
||||||
<string name="profile_port_label">Server port</string>
|
<string name="profile_port_label">Server port</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user