Merge "wifi: support OCSP in Wifi dialog for certifiate-based EAP type"
This commit is contained in:
@@ -178,6 +178,25 @@
|
|||||||
android:prompt="@string/wifi_eap_ca_cert" />
|
android:prompt="@string/wifi_eap_ca_cert" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/l_ocsp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
style="@style/wifi_item" >
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/wifi_item_label"
|
||||||
|
android:text="@string/wifi_eap_ocsp" />
|
||||||
|
|
||||||
|
<Spinner android:id="@+id/ocsp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/wifi_item_spinner"
|
||||||
|
android:prompt="@string/wifi_eap_ocsp"
|
||||||
|
android:entries="@array/eap_ocsp_type" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/no_ca_cert_warning"
|
<LinearLayout android:id="@+id/no_ca_cert_warning"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@@ -258,6 +258,14 @@
|
|||||||
<item>PWD</item>
|
<item>PWD</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Type of OCSP -->
|
||||||
|
<string-array name="eap_ocsp_type" translatable="true">
|
||||||
|
<item>Do not validate</item>
|
||||||
|
<item>Request certificate status</item>
|
||||||
|
<item>Require certificate status</item>
|
||||||
|
<item>Require all non-trusted certificate statuses</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<!-- Wi-Fi AP band settings. Either Auto, 2.4GHz or 5GHz. -->
|
<!-- Wi-Fi AP band settings. Either Auto, 2.4GHz or 5GHz. -->
|
||||||
<!-- Note that adding/removing/moving the items will need wifi settings code change. -->
|
<!-- Note that adding/removing/moving the items will need wifi settings code change. -->
|
||||||
<string-array translatable="false" name="wifi_ap_band_config_full">
|
<string-array translatable="false" name="wifi_ap_band_config_full">
|
||||||
|
@@ -2137,6 +2137,8 @@
|
|||||||
<string name="please_select_phase2">Phase 2 authentication</string>
|
<string name="please_select_phase2">Phase 2 authentication</string>
|
||||||
<!-- Label for the EAP CA certificate of the network -->
|
<!-- Label for the EAP CA certificate of the network -->
|
||||||
<string name="wifi_eap_ca_cert">CA certificate</string>
|
<string name="wifi_eap_ca_cert">CA certificate</string>
|
||||||
|
<!-- Label for the OCSP type of the network. [CHAR LIMIT=32] -->
|
||||||
|
<string name="wifi_eap_ocsp">Online Certificate Status</string>
|
||||||
<!-- Label for the domain name that the EAP CA certificate(s) can be used to validate. -->
|
<!-- Label for the domain name that the EAP CA certificate(s) can be used to validate. -->
|
||||||
<string name="wifi_eap_domain">Domain</string>
|
<string name="wifi_eap_domain">Domain</string>
|
||||||
<!-- Label for the EAP user certificate of the network -->
|
<!-- Label for the EAP user certificate of the network -->
|
||||||
|
@@ -146,6 +146,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
private Spinner mSecuritySpinner;
|
private Spinner mSecuritySpinner;
|
||||||
private Spinner mEapMethodSpinner;
|
private Spinner mEapMethodSpinner;
|
||||||
private Spinner mEapCaCertSpinner;
|
private Spinner mEapCaCertSpinner;
|
||||||
|
private Spinner mEapOcspSpinner;
|
||||||
private TextView mEapDomainView;
|
private TextView mEapDomainView;
|
||||||
private Spinner mPhase2Spinner;
|
private Spinner mPhase2Spinner;
|
||||||
// Associated with mPhase2Spinner, one of mPhase2FullAdapter or mPhase2PeapAdapter
|
// Associated with mPhase2Spinner, one of mPhase2FullAdapter or mPhase2PeapAdapter
|
||||||
@@ -760,6 +761,14 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
+ ") should not both be non-null");
|
+ ") should not both be non-null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only set OCSP option if there is a valid CA certificate.
|
||||||
|
if (caCert.equals(mUnspecifiedCertString)
|
||||||
|
|| caCert.equals(mDoNotValidateEapServerString)) {
|
||||||
|
config.enterpriseConfig.setOcsp(WifiEnterpriseConfig.OCSP_NONE);
|
||||||
|
} else {
|
||||||
|
config.enterpriseConfig.setOcsp(mEapOcspSpinner.getSelectedItemPosition());
|
||||||
|
}
|
||||||
|
|
||||||
String clientCert = (String) mEapUserCertSpinner.getSelectedItem();
|
String clientCert = (String) mEapUserCertSpinner.getSelectedItem();
|
||||||
if (clientCert.equals(mUnspecifiedCertString)
|
if (clientCert.equals(mUnspecifiedCertString)
|
||||||
|| clientCert.equals(mDoNotProvideEapUserCertString)) {
|
|| clientCert.equals(mDoNotProvideEapUserCertString)) {
|
||||||
@@ -1019,6 +1028,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
mPhase2Spinner.setOnItemSelectedListener(this);
|
mPhase2Spinner.setOnItemSelectedListener(this);
|
||||||
mEapCaCertSpinner = (Spinner) mView.findViewById(R.id.ca_cert);
|
mEapCaCertSpinner = (Spinner) mView.findViewById(R.id.ca_cert);
|
||||||
mEapCaCertSpinner.setOnItemSelectedListener(this);
|
mEapCaCertSpinner.setOnItemSelectedListener(this);
|
||||||
|
mEapOcspSpinner = (Spinner) mView.findViewById(R.id.ocsp);
|
||||||
mEapDomainView = (TextView) mView.findViewById(R.id.domain);
|
mEapDomainView = (TextView) mView.findViewById(R.id.domain);
|
||||||
mEapDomainView.addTextChangedListener(this);
|
mEapDomainView.addTextChangedListener(this);
|
||||||
mEapUserCertSpinner = (Spinner) mView.findViewById(R.id.user_cert);
|
mEapUserCertSpinner = (Spinner) mView.findViewById(R.id.user_cert);
|
||||||
@@ -1060,6 +1070,11 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
mDoNotValidateEapServerString,
|
mDoNotValidateEapServerString,
|
||||||
false,
|
false,
|
||||||
true);
|
true);
|
||||||
|
// To avoid the user connects to a non-secure network unexpectedly,
|
||||||
|
// request using system trusted certificates by default
|
||||||
|
// unless the user explicitly chooses "Do not validate" or other
|
||||||
|
// CA certificates.
|
||||||
|
setSelection(mEapCaCertSpinner, mUseSystemCertsString);
|
||||||
loadCertificates(
|
loadCertificates(
|
||||||
mEapUserCertSpinner,
|
mEapUserCertSpinner,
|
||||||
Credentials.USER_PRIVATE_KEY,
|
Credentials.USER_PRIVATE_KEY,
|
||||||
@@ -1124,6 +1139,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
setSelection(mEapCaCertSpinner, mMultipleCertSetString);
|
setSelection(mEapCaCertSpinner, mMultipleCertSetString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mEapOcspSpinner.setSelection(enterpriseConfig.getOcsp());
|
||||||
mEapDomainView.setText(enterpriseConfig.getDomainSuffixMatch());
|
mEapDomainView.setText(enterpriseConfig.getDomainSuffixMatch());
|
||||||
String userCert = enterpriseConfig.getClientCertificateAlias();
|
String userCert = enterpriseConfig.getClientCertificateAlias();
|
||||||
if (TextUtils.isEmpty(userCert)) {
|
if (TextUtils.isEmpty(userCert)) {
|
||||||
@@ -1169,6 +1185,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
// Defaults for most of the EAP methods and over-riden by
|
// Defaults for most of the EAP methods and over-riden by
|
||||||
// by certain EAP methods
|
// by certain EAP methods
|
||||||
mView.findViewById(R.id.l_ca_cert).setVisibility(View.VISIBLE);
|
mView.findViewById(R.id.l_ca_cert).setVisibility(View.VISIBLE);
|
||||||
|
mView.findViewById(R.id.l_ocsp).setVisibility(View.VISIBLE);
|
||||||
mView.findViewById(R.id.password_layout).setVisibility(View.VISIBLE);
|
mView.findViewById(R.id.password_layout).setVisibility(View.VISIBLE);
|
||||||
mView.findViewById(R.id.show_password_layout).setVisibility(View.VISIBLE);
|
mView.findViewById(R.id.show_password_layout).setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
@@ -1177,6 +1194,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
case WIFI_EAP_METHOD_PWD:
|
case WIFI_EAP_METHOD_PWD:
|
||||||
setPhase2Invisible();
|
setPhase2Invisible();
|
||||||
setCaCertInvisible();
|
setCaCertInvisible();
|
||||||
|
setOcspInvisible();
|
||||||
setDomainInvisible();
|
setDomainInvisible();
|
||||||
setAnonymousIdentInvisible();
|
setAnonymousIdentInvisible();
|
||||||
setUserCertInvisible();
|
setUserCertInvisible();
|
||||||
@@ -1214,6 +1232,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
setPhase2Invisible();
|
setPhase2Invisible();
|
||||||
setAnonymousIdentInvisible();
|
setAnonymousIdentInvisible();
|
||||||
setCaCertInvisible();
|
setCaCertInvisible();
|
||||||
|
setOcspInvisible();
|
||||||
setDomainInvisible();
|
setDomainInvisible();
|
||||||
setUserCertInvisible();
|
setUserCertInvisible();
|
||||||
setPasswordInvisible();
|
setPasswordInvisible();
|
||||||
@@ -1231,6 +1250,10 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
// Domain suffix matching is not relevant if the user hasn't chosen a CA
|
// Domain suffix matching is not relevant if the user hasn't chosen a CA
|
||||||
// certificate yet, or chooses not to validate the EAP server.
|
// certificate yet, or chooses not to validate the EAP server.
|
||||||
setDomainInvisible();
|
setDomainInvisible();
|
||||||
|
// Ocsp is an additional validation step for a server certifidate.
|
||||||
|
// This field is not relevant if the user hasn't chosen a valid
|
||||||
|
// CA certificate yet.
|
||||||
|
setOcspInvisible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1265,6 +1288,11 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
setSelection(mEapCaCertSpinner, mUnspecifiedCertString);
|
setSelection(mEapCaCertSpinner, mUnspecifiedCertString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setOcspInvisible() {
|
||||||
|
mView.findViewById(R.id.l_ocsp).setVisibility(View.GONE);
|
||||||
|
mEapOcspSpinner.setSelection(WifiEnterpriseConfig.OCSP_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
private void setDomainInvisible() {
|
private void setDomainInvisible() {
|
||||||
mView.findViewById(R.id.l_domain).setVisibility(View.GONE);
|
mView.findViewById(R.id.l_domain).setVisibility(View.GONE);
|
||||||
mEapDomainView.setText("");
|
mEapDomainView.setText("");
|
||||||
|
Reference in New Issue
Block a user