I need to programatically connect to a Enterprise Network with security type EAP-PEAP.
NEHotspotEAPSettings *eapSettings = [[NEHotspotEAPSettings alloc] init];
eapSettings.username = username;
eapSettings.password = password;
eapSettings.supportedEAPTypes = [NSArray arrayWithObjects:[NSNumber numberWithInteger:NEHotspotConfigurationEAPTypeEAPPEAP], nil];
//Inner authentication
eapSettings.ttlsInnerAuthenticationType = NEHotspotConfigurationEAPTTLSInnerAuthenticationMSCHAPv2;
eapSettings.outerIdentity = @"";
//Server name of the network
eapSettings.trustedServerNames = @[@"servername"];
if (@available(iOS 11.0, *)) {
// Create Hotspot Configuration
NEHotspotConfiguration *configuration = [[NEHotspotConfiguration alloc] initWithSSID:ssid eapSettings:eapSettings];
NSLog(@"WIFIManager, NEHotspotConfiguration initialized");
[[NEHotspotConfigurationManager sharedManager] applyConfiguration:configuration completionHandler:^(NSError * _Nullable error) {
NSLog(@"WIFIManager, NEHotspotConfiguration Configured");
if (error != nil) {
NSLog(@"WIFIManager, NEHotspotConfiguration Error: %@", error);
if (error.code == NEHotspotConfigurationErrorAlreadyAssociated) {
resolve(@(YES));
} else {
reject(@"connection_error", @"Failed to connect to Wi-Fi", error);
}
} else {
resolve(@(YES));
NSLog(@"WIFIManager, NEHotspotConfiguration Success");
}
}];
}else {
reject(@"ios_error", @"Not supported in iOS<11.0", nil);
} }
This is the code I have tried to connect to the network. It is always giving a true-negative result.
As the documentation states, does NEHotspotConfigurationManager supports EAP-PEAP with MSCHAPv2 inner authentication? If it does, is it the correct way of implementing it?
Is there any other way to connect to EAP-PEAP networks using Swift or Objective C?
Post
Replies
Boosts
Views
Activity
Can we download a file directly into a connected external storage like a pendrive without downloading it into App Sandbox environment first and then copying the file to external storage, in case of larger files.