From 3c6bec4207524c295908a573b7ed5663298ec885 Mon Sep 17 00:00:00 2001 From: Kevin Harwood Date: Tue, 16 Apr 2013 10:31:41 +0300 Subject: [PATCH] Added runtime check to disable pinning in the example Signed-off-by: Mattt Thompson --- Example/Classes/AFAppDotNetAPIClient.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Example/Classes/AFAppDotNetAPIClient.m b/Example/Classes/AFAppDotNetAPIClient.m index 7859d90..213a71a 100644 --- a/Example/Classes/AFAppDotNetAPIClient.m +++ b/Example/Classes/AFAppDotNetAPIClient.m @@ -48,8 +48,11 @@ static NSString * const kAFAppDotNetAPIBaseURLString = @"https://alpha-api.app.n // Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 [self setDefaultHeader:@"Accept" value:@"application/json"]; - - [self setDefaultSSLPinningMode:AFSSLPinningModePublicKey]; + + // By default, the example ships with SSL pinning enabled for the app.net API pinned against the public key of adn.cer file included with the example. In order to make it easier for developers who are new to AFNetworking, SSL pinning is automatically disabled if the base URL has been changed. This will allow developers to hack around with the example, without getting tripped up by SSL pinning. + if ([[url scheme] isEqualToString:@"https"] && [[url host] isEqualToString:@"alpha-api.app.net"]) { + [self setDefaultSSLPinningMode:AFSSLPinningModePublicKey]; + } return self; }