iOS keep showing “Proxy Authentication Required” dialog even after passing username and password using NetworkExtension

蓝咒 提交于 2019-12-23 03:43:23

问题


I am using NETunnelProviderManager for implementing VPN with HTTP/HTTPS proxy.

I have Basic Authentication from the Proxy server to authenticate with it, and I need to update password at regular time interval.

So to set credentials for Proxy Server I have implemented somethink like below:

self.vpnManager.protocolConfiguration.proxySettings.HTTPSServer = [[NEProxyServer alloc] initWithAddress:proxyServer port:proxyPort];
self.vpnManager.protocolConfiguration.proxySettings.HTTPSServer.authenticationRequired = YES;
self.vpnManager.protocolConfiguration.proxySettings.HTTPSServer.username = proxyUser;
self.vpnManager.protocolConfiguration.proxySettings.HTTPSServer.password = proxyPassword;

After setting this detail I am saving preferences, and on next launch, if I load preferences I can find the value which I set there. But, when I start VPN and start accessing anything via VPN(Proxy) Proxy it immediately shows dialog Proxy Authentication Required. Just to double check, if I check the log of self.vpnManager.protocolConfiguration I can clearly see my password and username but still, It shows a dialog box for manual entry of user Credentials for Proxy.

It would be really helpful if anyone can give me an idea on why my already configured proxy password and username is not considered if I set it programmatically in properties of NEProxyServer

Can anyone suggest something which can help me in updating the Credentials automatically in the background without asking a user to enter the Proxy credentials, something like delegate that we have in NSURLSession's case?

Any response and help would be appreciable.

来源:https://stackoverflow.com/questions/53852899/ios-keep-showing-proxy-authentication-required-dialog-even-after-passing-usern

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!