Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

SecurityManagerProtocol Example

$
0
0

I would like to implement a very basic example of the SecurityManagerProtocol within the httpClientsecurityManager property to accept a self-signed certificate using HTTPS:

var xhr = Ti.Network.createHTTPClient({
    timeout : 30000,
    securityManager : {
        connectionDelegateForUrl : function(url){
            return {
                willSendRequestForAuthenticationChallenge : function(){
                    return true
                }
            }
        },
        getKeyManagers : function(proxy){
            return [null];
        },
        getTrustManagers : function(proxy){
            return [null];
        },
        willHandleURL : function(url){
            if(url.indexOf('https://someserver.com') !== -1){
                return true;
            }
        }
    }
});
However, I'm always receiving the error
message = "Invalid argument passed to securityManager property";
nativeLocation = "-[TiNetworkHTTPClientProxy _initWithProperties:] (TiNetworkHTTPClientProxy.m:42)";
nativeReason = "Does not conform to SecurityManagerProtocol";
Is there any example of how to implement the securityManager protocol?

Viewing all articles
Browse latest Browse all 8068

Trending Articles