public class VpnProfileManagedDataSource implements VpnProfileDataSource
{
private static final String NAME_MANAGED_VPN_PROFILES = "org.strongswan.android.data.VpnProfileManagedDataSource.preferences";
+ private static final String PREFIX_USER_CERT = "usercert:";
private final ManagedConfigurationService mManagedConfigurationService;
private final SharedPreferences mSharedPreferences;
@Override
public void close()
{
- /* remove passwords that are no longer referenced by a VPN profile */
- final Set<String> actualKeys = mManagedConfigurationService.getManagedProfiles().keySet();
-
+ /* remove settings not referenced by a VPN profile */
final Set<String> storedKeys = new HashSet<>(mSharedPreferences.getAll().keySet());
- storedKeys.removeAll(actualKeys);
+
+ for (String uuid : mManagedConfigurationService.getManagedProfiles().keySet())
+ {
+ storedKeys.remove(uuid);
+ storedKeys.remove(PREFIX_USER_CERT + uuid);
+ }
final SharedPreferences.Editor editor = mSharedPreferences.edit();
for (String key : storedKeys)
final SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putString(profile.getUUID().toString(), profile.getPassword());
+ editor.putString(PREFIX_USER_CERT + profile.getUUID().toString(), profile.getUserCertificateAlias());
return editor.commit();
}
private VpnProfile prepareVpnProfile(VpnProfile managedProfile)
{
final String password = mSharedPreferences.getString(managedProfile.getUUID().toString(), managedProfile.getPassword());
+ final String alias = mSharedPreferences.getString(PREFIX_USER_CERT + managedProfile.getUUID().toString(), managedProfile.getUserCertificateAlias());
final VpnProfile vpnProfile = managedProfile.clone();
vpnProfile.setPassword(password);
+ vpnProfile.setUserCertificateAlias(alias);
vpnProfile.setDataSource(this);
return vpnProfile;
}
import android.widget.TextView;
import org.strongswan.android.R;
+import org.strongswan.android.data.ManagedVpnProfile;
import org.strongswan.android.data.VpnProfile;
import org.strongswan.android.data.VpnProfile.SelectedAppsHandling;
import org.strongswan.android.data.VpnProfileDataSource;
alias = mProfile.getCertificateAlias();
getSupportActionBar().setTitle(mProfile.getName());
- setReadOnly(mProfile.isReadOnly());
+ setReadOnly(mProfile);
}
else
{
}
}
- private void setReadOnly(final boolean readOnly)
+ private void setReadOnly(final VpnProfile profile)
{
+ final boolean readOnly = profile.isReadOnly();
+
mManagedProfile.setVisibility(readOnly ? View.VISIBLE : View.GONE);
mName.setEnabled(!readOnly);
if (readOnly)
{
+ ManagedVpnProfile managedProfile = (ManagedVpnProfile)profile;
mSelectCert.setOnClickListener(null);
- mSelectUserCert.setOnClickListener(null);
+ if (managedProfile.getUserCertificate() != null)
+ {
+ mSelectUserCert.setOnClickListener(null);
+ }
}
}
<string name="alert_text_no_subnets">Bitte geben Sie mit Leerzeichen getrennte, gültige Subnetzte und/oder IP-Adressen ein</string>
<string name="alert_text_no_ips">Bitte geben Sie mit Leerzeichen getrennte, gültige IP-Adressen ein</string>
<string name="alert_text_no_proposal">Bitte geben Sie eine mit Bindestrichen getrennte, gültige Liste von Algorithmen ein</string>
- <string name="alert_text_vpn_profile_read_only">Dieses Profil wird von Ihrem Administrator verwaltet und kann nicht bearbeitet werden. Nur das Passwort kann geändert werden</string>
+ <string name="alert_text_vpn_profile_read_only">Dieses Profil wird von Ihrem Administrator verwaltet und kann nicht bearbeitet werden. Nur das Passwort bzw. Benutzer-Zertifikat kann geändert werden</string>
<string name="tnc_notice_title">EAP-TNC kann Ihre Privatsphäre beeinträchtigen</string>
<string name="tnc_notice_subtitle">Gerätedaten werden an den Server-Betreiber gesendet</string>
<string name="tnc_notice_details"><![CDATA[<p>Trusted Network Connect (TNC) erlaubt Server-Betreibern den Gesundheitszustand von Endgeräten zu prüfen.</p><p>Dazu kann der Betreiber Daten verlangen, wie etwa eine eindeutige Identifikationsnummer, eine Liste der installierten Pakete, Systemeinstellungen oder kryptografische Prüfsummen von Dateien.</p><b>Solche Daten werden nur übermittelt nachdem die Identität des Servers geprüft wurde.</b>]]></string>
<string name="alert_text_no_subnets">Please enter valid subnets and/or IP addresses, separated by spaces</string>
<string name="alert_text_no_ips">Please enter valid IP addresses, separated by spaces</string>
<string name="alert_text_no_proposal">Please enter a valid list of algorithms, separated by hyphens</string>
- <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password</string>
+ <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password or user certificate</string>
<string name="tnc_notice_title">EAP-TNC may affect your privacy</string>
<string name="tnc_notice_subtitle">Device data is sent to the server operator</string>
<string name="tnc_notice_details"><![CDATA[<p>Trusted Network Connect (TNC) allows server operators to assess the health of a client device.</p><p>For that purpose the server operator may request data such as a unique identifier, a list of installed packages, system settings, or cryptographic checksums of files.</p><b>Any data will be sent only after verifying the server\'s identity.</b>]]></string>
<string name="alert_text_no_subnets">Please enter valid subnets and/or IP addresses, separated by spaces</string>
<string name="alert_text_no_ips">Please enter valid IP addresses, separated by spaces</string>
<string name="alert_text_no_proposal">Please enter a valid list of algorithms, separated by hyphens</string>
- <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password</string>
+ <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password or user certificate</string>
<string name="tnc_notice_title">EAP-TNC may affect your privacy</string>
<string name="tnc_notice_subtitle">Device data is sent to the server operator</string>
<string name="tnc_notice_details"><![CDATA[<p>Trusted Network Connect (TNC) allows server operators to assess the health of a client device.</p><p>For that purpose the server operator may request data such as a unique identifier, a list of installed packages, system settings, or cryptographic checksums of files.</p><b>Any data will be sent only after verifying the server\'s identity.</b>]]></string>
<string name="alert_text_no_subnets">Please enter valid subnets and/or IP addresses, separated by spaces</string>
<string name="alert_text_no_ips">Please enter valid IP addresses, separated by spaces</string>
<string name="alert_text_no_proposal">Please enter a valid list of algorithms, separated by hyphens</string>
- <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password</string>
+ <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password or user certificate</string>
<string name="tnc_notice_title">EAP-TNC may affect your privacy</string>
<string name="tnc_notice_subtitle">Device data is sent to the server operator</string>
<string name="tnc_notice_details"><![CDATA[<p>Trusted Network Connect (TNC) allows server operators to assess the health of a client device.</p><p>For that purpose the server operator may request data such as a unique identifier, a list of installed packages, system settings, or cryptographic checksums of files.</p><b>Any data will be sent only after verifying the server\'s identity.</b>]]></string>
<string name="alert_text_no_subnets">请输入有效的子网和/或IP地址,用空格分隔</string>
<string name="alert_text_no_ips">请输入有效的IP地址,以空格分隔</string>
<string name="alert_text_no_proposal">请输入用连字符分隔的有效算法列表</string>
- <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password</string>
+ <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password or user certificate</string>
<string name="tnc_notice_title">EAP-TNC可能会影响您的隐私</string>
<string name="tnc_notice_subtitle">设备数据已被发送至服务器管理员</string>
<string name="tnc_notice_details"><![CDATA[<p>可信网络连接t (TNC) 允许服务器管理员评定一个用户设备的状况。</p><p>出于此目的,服务器管理员可能要求以下数据如独立ID、已安装软件列表、系统设置、或加密过的文件校验值。</p><b>任何数据都仅将在验证过服务器的身份ID之后被发出。</b>]]></string>
<string name="alert_text_no_subnets">Please enter valid subnets and/or IP addresses, separated by spaces</string>
<string name="alert_text_no_ips">Please enter valid IP addresses, separated by spaces</string>
<string name="alert_text_no_proposal">Please enter a valid list of algorithms, separated by hyphens</string>
- <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password</string>
+ <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password or user certificate</string>
<string name="tnc_notice_title">EAP-TNC可能會影響您的隱私安全</string>
<string name="tnc_notice_subtitle">裝置資料已經發送給伺服器管理者</string>
<string name="tnc_notice_details"><![CDATA[<p>Trusted Network Connect (TNC) 可以讓伺服器管理者評估用戶裝置的狀況。</p><p>在這個目的下,伺服器管理者可能會要求以下資料,例如ID、已安裝的App項目、系統設定、或加密檔案驗證值。</p><b>任何資料都只有在驗證伺服器的身分ID之後才會被送出。</b>]]></string>
<string name="alert_text_no_subnets">Please enter valid subnets and/or IP addresses, separated by spaces</string>
<string name="alert_text_no_ips">Please enter valid IP addresses, separated by spaces</string>
<string name="alert_text_no_proposal">Please enter a valid list of algorithms, separated by hyphens</string>
- <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password</string>
+ <string name="alert_text_vpn_profile_read_only">This VPN profile is managed by your administrator and can\'t be modified. You can only change the password or user certificate</string>
<string name="tnc_notice_title">EAP-TNC may affect your privacy</string>
<string name="tnc_notice_subtitle">Device data is sent to the server operator</string>
<string name="tnc_notice_details"><![CDATA[<p>Trusted Network Connect (TNC) allows server operators to assess the health of a client device.</p><p>For that purpose the server operator may request data such as a unique identifier, a list of installed packages, system settings, or cryptographic checksums of files.</p><b>Any data will be sent only after verifying the server\'s identity.</b>]]></string>