I configured the Radius Server on Windows Server 2016 and I want to connect to Enterprise WiFi network using my application. I tried to do the following steps:
Set the profile without credentials using WlanSetProfile (I used imported profile from netsh with some modifications)
Then set the xml profile below with my username and password to WlanSetProfileEapXmlUserData:
<?xml version="1.0" ?>
<EapHostUserCredentials xmlns="http://www.microsoft.com/provisioning/EapHostUserCredentials"
xmlns:eapCommon="http://www.microsoft.com/provisioning/EapCommon"
xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapMethodUserCredentials">
<EapMethod>
<eapCommon:Type>26</eapCommon:Type>
<eapCommon:AuthorId>0</eapCommon:AuthorId>
</EapMethod>
<Credentials xmlns:eapUser="http://www.microsoft.com/provisioning/EapUserPropertiesV1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapUserPropertiesV1"
xmlns:MsPeap="http://www.microsoft.com/provisioning/MsPeapUserPropertiesV1"
xmlns:MsChapV2="http://www.microsoft.com/provisioning/MsChapV2UserPropertiesV1">
<baseEap:Eap>
<baseEap:Type>26</baseEap:Type>
<MsChapV2:EapType>
<MsChapV2:Username>test</MsChapV2:Username>
<MsChapV2:Password>test</MsChapV2:Password>
</MsChapV2:EapType>
</baseEap:Eap>
</Credentials>
</EapHostUserCredentials>
Then I use WlanConnect function and callback function to verify the connection. When connecting I get the following issue:
NotificationCode returns code 8 (wlan_notification_acm_scan_fail) and then 11 (wlan_notification_acm_connection_attempt_fail).
Also, from MS docs:
wlan_notification_acm_scan_fail:
A scan for connectable networks failed.
The pData member of the WLAN_NOTIFICATION_DATA structure points to a WLAN_REASON_CODE data type value that identifies the reason the WLAN operation failed.
So, I checked the pData when this issue occurs and it returns the following reason:
wlan_notification_acm_scan_fail "The operation was successful."
But the network is not connected. Thanks in advance for your help.
I have fixed this issue. The problem was because the PerformServerValidation was set to true and it displayed the notification dialog to verify the certificate on Windows that's why it returned:
wlan_notification_acm_scan_fail "The operation was successful."
Setting the PerformServerValidation to false fixed the issue (WlanSetProfile function).
<PerformServerValidation xmlns=\"http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2\">false</PerformServerValidation>
Also, for WlanSetProfileEapXmlUserData function I provided this profile:
<?xml version="1.0" ?>
<EapHostUserCredentials
xmlns="http://www.microsoft.com/provisioning/EapHostUserCredentials"
xmlns:eapCommon="http://www.microsoft.com/provisioning/EapCommon"
xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapMethodUserCredentials">
<EapMethod>
<eapCommon:Type>25</eapCommon:Type>
<eapCommon:AuthorId>0</eapCommon:AuthorId>
</EapMethod>
<Credentials
xmlns:eapUser="http://www.microsoft.com/provisioning/EapUserPropertiesV1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapUserPropertiesV1"
xmlns:MsPeap="http://www.microsoft.com/provisioning/MsPeapUserPropertiesV1"
xmlns:MsChapV2="http://www.microsoft.com/provisioning/MsChapV2UserPropertiesV1">
<baseEap:Eap>
<baseEap:Type>25</baseEap:Type>
<MsPeap:EapType>
<baseEap:Eap>
<baseEap:Type>26</baseEap:Type>
<MsChapV2:EapType>
<MsChapV2:Username>username</MsChapV2:Username>
<MsChapV2:Password>password</MsChapV2:Password>
</MsChapV2:EapType>
</baseEap:Eap>
</MsPeap:EapType>
</baseEap:Eap>
</Credentials>
</EapHostUserCredentials>
Now it connects successfully to Enterprise network. The issue is resolved. Thank you.