Ben Copsey

Start auth dialog work

//
// ASIAuthenticationDialog.h
// iPhone
//
// Created by Ben Copsey on 21/08/2009.
// Copyright 2009 All-Seeing Interactive. All rights reserved.
//
#import <Foundation/Foundation.h>
@class ASIHTTPRequest;
typedef enum _ASIAuthenticationType {
ASIStandardAuthenticationType = 0,
ASIProxyAuthenticationType = 1
} ASIAuthenticationType;
@interface ASIAuthenticationDialog : NSObject <UIActionSheetDelegate, UITableViewDelegate, UITableViewDataSource> {
ASIHTTPRequest *request;
UIActionSheet *loginDialog;
ASIAuthenticationType type;
}
+ (void)presentAuthenticationDialogForRequest:(ASIHTTPRequest *)request;
+ (void)presentProxyAuthenticationDialogForRequest:(ASIHTTPRequest *)request;
@property (retain) ASIHTTPRequest *request;
@property (retain) UIActionSheet *loginDialog;
@property (assign) ASIAuthenticationType type;
@end
... ...
//
// ASIAuthenticationDialog.m
// iPhone
//
// Created by Ben Copsey on 21/08/2009.
// Copyright 2009 All-Seeing Interactive. All rights reserved.
//
#import "ASIAuthenticationDialog.h"
#import "ASIHTTPRequest.h"
ASIAuthenticationDialog *sharedDialog = nil;
NSLock *dialogLock = nil;
@interface ASIAuthenticationDialog ()
- (void)show;
@end
@implementation ASIAuthenticationDialog
+ (void)initialize
{
if (self == [ASIAuthenticationDialog class]) {
dialogLock = [[NSLock alloc] init];
}
}
+ (void)presentProxyAuthenticationDialogForRequest:(ASIHTTPRequest *)request
{
[dialogLock lock];
[sharedDialog release];
sharedDialog = [[self alloc] init];
[sharedDialog setRequest:request];
[sharedDialog setType:ASIProxyAuthenticationType];
[sharedDialog show];
[dialogLock unlock];
}
+ (void)presentAuthenticationDialogForRequest:(ASIHTTPRequest *)request
{
[dialogLock lock];
[sharedDialog release];
sharedDialog = [[self alloc] init];
[sharedDialog setRequest:request];
[sharedDialog show];
[dialogLock unlock];
}
- (void)show
{
// Create an action sheet to show the login dialog
[self setLoginDialog:[[[UIActionSheet alloc] init] autorelease]];
[[self loginDialog] setActionSheetStyle:UIActionSheetStyleBlackOpaque];
[[self loginDialog] setDelegate:self];
// We show the login form in a table view, similar to Safari's authentication dialog
UITableView *table = [[[UITableView alloc] initWithFrame:CGRectMake(0,50,320,480) style:UITableViewStyleGrouped] autorelease];
[table setDelegate:self];
[table setDataSource:self];
[[self loginDialog] addSubview:table];
[[self loginDialog] showInView:[[[UIApplication sharedApplication] windows] objectAtIndex:0]];
[[self loginDialog] setFrame:CGRectMake(0,0,320,480)];
UIToolbar *toolbar = [[[UIToolbar alloc] initWithFrame:CGRectMake(0,0,320,80)] autorelease];
//[toolbar setFrame:CGRectMake(0,20,320,50)];
NSMutableArray *items = [[[NSMutableArray alloc] init] autorelease];
UIBarButtonItem *backButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelAuthenticationFromDialog:)] autorelease];
//[backButton setContentEdgeInsets:UIEdgeInsetsMake(0,20,0,0)];
[items addObject:backButton];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,170,50)];
[label setText:[[[self request] url] host]];
[label setTextColor:[UIColor whiteColor]];
[label setFont:[UIFont boldSystemFontOfSize:22.0]];
[label setShadowColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.5]];
[label setShadowOffset:CGSizeMake(0, -1.0)];
[label setOpaque:NO];
[label setBackgroundColor:nil];
[label setTextAlignment:UITextAlignmentCenter];
[toolbar addSubview:label];
UIBarButtonItem *labelButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:nil action:nil] autorelease];
//[labelButton setCustomView:label];
//[items addObject:labelButton];
[items addObject:[[[UIBarButtonItem alloc] initWithTitle:@"Login" style:UIBarButtonItemStyleDone target:self action:@selector(loginWithCredentialsFromDialog:)] autorelease]];
[toolbar setItems:items];
[[self loginDialog] addSubview:toolbar];
}
- (void)cancelAuthenticationFromDialog:(id)sender
{
[[self request] cancelAuthentication];
[[self loginDialog] dismissWithClickedButtonIndex:0 animated:YES];
}
- (void)loginWithCredentialsFromDialog:(id)sender
{
[[self request] setUsername:[[[[[[[self loginDialog] subviews] objectAtIndex:0] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] subviews] objectAtIndex:2] text]];
[[self request] setPassword:[[[[[[[self loginDialog] subviews] objectAtIndex:0] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]] subviews] objectAtIndex:2] text]];
[[self loginDialog] dismissWithClickedButtonIndex:1 animated:YES];
[[self request] retryWithAuthentication];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSString *scheme = ([self type] == ASIStandardAuthenticationType) ? [[self request] authenticationScheme] : [[self request] proxyAuthenticationScheme];
if ([scheme isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeNTLM]) {
return 3;
}
return 2;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
if (section == [self numberOfSectionsInTableView:tableView]-1) {
return 30;
}
return 0;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if (section == 0) {
return 30;
}
return 0;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
if (section == 0) {
return [[self request] authenticationRealm];
}
return nil;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
UITextField *textField = [[[UITextField alloc] initWithFrame:CGRectMake(20,12,260,25)] autorelease];
if ([indexPath section] == 0) {
[textField setPlaceholder:@"User"];
} else if ([indexPath section] == 1) {
[textField setPlaceholder:@"Password"];
} else if ([indexPath section] == 2) {
[textField setPlaceholder:@"Domain"];
}
[cell addSubview:textField];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
if (section == [self numberOfSectionsInTableView:tableView]-1) {
if ([[[[self request] url] scheme] isEqualToString:@"https"]) {
return @"Password will be sent securely.";
} else {
return @"Password will be sent in the clear.";
}
}
return nil;
}
@synthesize request;
@synthesize loginDialog;
@synthesize type;
@end
... ...
... ... @@ -160,8 +160,8 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// Used during NTLM authentication
int authenticationRetryCount;
// Authentication method (Basic, Digest, NTLM)
NSString *authenticationMethod;
// Authentication scheme (Basic, Digest, NTLM)
NSString *authenticationScheme;
// Realm for authentication when credentials are required
NSString *authenticationRealm;
... ... @@ -169,6 +169,16 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// And now, the same thing, but for authenticating proxies
BOOL needsProxyAuthentication;
// When YES, ASIHTTPRequest will present a dialog allowing users to enter credentials when no-matching credentials were found for a server that requires authentication
// The dialog will not be shown if your delegate responds to authenticationNeededForRequest:
// Default is NO.
BOOL shouldPresentAuthenticationDialog;
// When YES, ASIHTTPRequest will present a dialog allowing users to enter credentials when no-matching credentials were found for a proxy server that requires authentication
// The dialog will not be shown if your delegate responds to proxyAuthenticationNeededForRequest:
// Default is YES (basically, because most people won't want the hassle of adding support for authenticating proxies to their apps)
BOOL shouldPresentProxyAuthenticationDialog;
// Used for proxy authentication
CFHTTPAuthenticationRef proxyAuthentication;
NSMutableDictionary *proxyCredentials;
... ... @@ -176,8 +186,8 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// Used during authentication with an NTLM proxy
int proxyAuthenticationRetryCount;
// Authentication method for the proxy (Basic, Digest, NTLM)
NSString *proxyAuthenticationMethod;
// Authentication scheme for the proxy (Basic, Digest, NTLM)
NSString *proxyAuthenticationScheme;
// Realm for proxy authentication when credentials are required
NSString *proxyAuthenticationRealm;
... ... @@ -378,6 +388,9 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// Should be called by delegates when they have populated the authentication information after an authentication challenge
- (void)retryWithAuthentication;
// Should be called by delegates when they wish to cancel authentication and stop
- (void)cancelAuthentication;
// Apply authentication information and resume the request after an authentication challenge
- (void)attemptToApplyCredentialsAndResume;
- (void)attemptToApplyProxyCredentialsAndResume;
... ... @@ -484,6 +497,10 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
+ (void)reachabilityChanged:(NSNotification *)note;
#endif
- (BOOL)showProxyAuthenticationDialog;
- (BOOL)showAuthenticationDialog;
+ (unsigned long)maxUploadReadLength;
@property (retain) NSString *username;
... ... @@ -546,4 +563,8 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
@property (assign) BOOL shouldCompressRequestBody;
@property (assign) BOOL needsProxyAuthentication;
@property (retain) NSURL *PACurl;
@property (retain) NSString *authenticationScheme;
@property (retain) NSString *proxyAuthenticationScheme;
@property (assign) BOOL shouldPresentAuthenticationDialog;
@property (assign) BOOL shouldPresentProxyAuthenticationDialog;
@end
... ...
... ... @@ -18,6 +18,7 @@
#import <SystemConfiguration/SystemConfiguration.h>
#endif
#import "ASIInputStream.h"
#import "ASIAuthenticationDialog.h"
// We use our own custom run loop mode as CoreAnimation seems to want to hijack our threads otherwise
static CFStringRef ASIHTTPRequestRunMode = CFSTR("ASIHTTPRequest");
... ... @@ -77,6 +78,8 @@ BOOL shouldThrottleBandwithForWWANOnly = NO;
static NSLock *sessionCookiesLock = nil;
UIActionSheet *loginDialog = nil;
// Private stuff
@interface ASIHTTPRequest ()
... ... @@ -196,14 +199,14 @@ static NSLock *sessionCookiesLock = nil;
[password release];
[domain release];
[authenticationRealm release];
[authenticationMethod release];
[authenticationScheme release];
[requestCredentials release];
[proxyHost release];
[proxyUsername release];
[proxyPassword release];
[proxyDomain release];
[proxyAuthenticationRealm release];
[proxyAuthenticationMethod release];
[proxyAuthenticationScheme release];
[proxyCredentials release];
[url release];
[authenticationLock release];
... ... @@ -1401,24 +1404,44 @@ static NSLock *sessionCookiesLock = nil;
return nil;
}
// Called by delegate to resume loading once authentication info has been populated
// Called by delegate or authentication dialog to resume loading once authentication info has been populated
- (void)retryWithAuthentication
{
[[self authenticationLock] lockWhenCondition:1];
[[self authenticationLock] unlockWithCondition:2];
}
// Called by delegate or authentication dialog to cancel authentication
- (void)cancelAuthentication
{
[self failWithError:ASIAuthenticationError];
[[self authenticationLock] lockWhenCondition:1];
[[self authenticationLock] unlockWithCondition:2];
}
- (BOOL)showProxyAuthenticationDialog
{
if ([self shouldPresentProxyAuthenticationDialog]) {
[ASIAuthenticationDialog performSelectorOnMainThread:@selector(presentProxyAuthenticationDialogForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
[[self authenticationLock] lockWhenCondition:2];
[[self authenticationLock] unlockWithCondition:1];
return YES;
}
return NO;
}
- (BOOL)askDelegateForProxyCredentials
{
// If we have a delegate, we'll see if it can handle proxyAuthorizationNeededForRequest:.
// If we have a delegate, we'll see if it can handle proxyAuthenticationNeededForRequest:.
// Otherwise, we'll try the queue (if this request is part of one) and it will pass the message on to its own delegate
id authorizationDelegate = [self delegate];
if (!authorizationDelegate) {
authorizationDelegate = [self queue];
id authenticationDelegate = [self delegate];
if (!authenticationDelegate) {
authenticationDelegate = [self queue];
}
if ([authorizationDelegate respondsToSelector:@selector(proxyAuthorizationNeededForRequest:)]) {
[authorizationDelegate performSelectorOnMainThread:@selector(proxyAuthorizationNeededForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
if ([authenticationDelegate respondsToSelector:@selector(proxyAuthenticationNeededForRequest:)]) {
[authenticationDelegate performSelectorOnMainThread:@selector(proxyAuthenticationNeededForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
[[self authenticationLock] lockWhenCondition:2];
[[self authenticationLock] unlockWithCondition:1];
... ... @@ -1430,12 +1453,16 @@ static NSLock *sessionCookiesLock = nil;
- (void)attemptToApplyProxyCredentialsAndResume
{
if ([self error]) {
return;
}
// Read authentication data
if (!proxyAuthentication) {
CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty(readStream,kCFStreamPropertyHTTPResponseHeader);
proxyAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader);
CFRelease(responseHeader);
proxyAuthenticationMethod = (NSString *)CFHTTPAuthenticationCopyMethod(proxyAuthentication);
[self setProxyAuthenticationScheme:[(NSString *)CFHTTPAuthenticationCopyMethod(proxyAuthentication) autorelease]];
}
// If we haven't got a CFHTTPAuthenticationRef by now, something is badly wrong, so we'll have to give up
... ... @@ -1472,11 +1499,11 @@ static NSLock *sessionCookiesLock = nil;
if (proxyCredentials) {
// We use startRequest rather than starting all over again in load request because NTLM requires we reuse the request
if (((proxyAuthenticationMethod != (NSString *)kCFHTTPAuthenticationSchemeNTLM) || proxyAuthenticationRetryCount < 2) && [self applyCredentials:proxyCredentials]) {
if ((([self proxyAuthenticationScheme] != (NSString *)kCFHTTPAuthenticationSchemeNTLM) || proxyAuthenticationRetryCount < 2) && [self applyCredentials:proxyCredentials]) {
[self startRequest];
// We've failed NTLM authentication twice, we should assume our credentials are wrong
} else if (proxyAuthenticationMethod == (NSString *)kCFHTTPAuthenticationSchemeNTLM && proxyAuthenticationRetryCount == 2) {
} else if ([self proxyAuthenticationScheme] == (NSString *)kCFHTTPAuthenticationSchemeNTLM && proxyAuthenticationRetryCount == 2) {
[self failWithError:ASIAuthenticationError];
// Something went wrong, we'll have to give up
... ... @@ -1505,24 +1532,39 @@ static NSLock *sessionCookiesLock = nil;
return;
}
// The delegate isn't interested, we'll have to give up
if ([self showProxyAuthenticationDialog]) {
[self attemptToApplyProxyCredentialsAndResume];
}
// The delegate isn't interested and we aren't showing the authentication dialog, we'll have to give up
[self failWithError:ASIAuthenticationError];
return;
}
}
- (BOOL)showAuthenticationDialog
{
if ([self shouldPresentAuthenticationDialog]) {
[ASIAuthenticationDialog performSelectorOnMainThread:@selector(presentAuthenticationDialogForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
[[self authenticationLock] lockWhenCondition:2];
[[self authenticationLock] unlockWithCondition:1];
return YES;
}
return NO;
}
- (BOOL)askDelegateForCredentials
{
// If we have a delegate, we'll see if it can handle proxyAuthorizationNeededForRequest:.
// If we have a delegate, we'll see if it can handle proxyAuthenticationNeededForRequest:.
// Otherwise, we'll try the queue (if this request is part of one) and it will pass the message on to its own delegate
id authorizationDelegate = [self delegate];
if (!authorizationDelegate) {
authorizationDelegate = [self queue];
id authenticationDelegate = [self delegate];
if (!authenticationDelegate) {
authenticationDelegate = [self queue];
}
if ([authorizationDelegate respondsToSelector:@selector(authorizationNeededForRequest:)]) {
[authorizationDelegate performSelectorOnMainThread:@selector(authorizationNeededForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
if ([authenticationDelegate respondsToSelector:@selector(authenticationNeededForRequest:)]) {
[authenticationDelegate performSelectorOnMainThread:@selector(authenticationNeededForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
[[self authenticationLock] lockWhenCondition:2];
[[self authenticationLock] unlockWithCondition:1];
... ... @@ -1533,6 +1575,10 @@ static NSLock *sessionCookiesLock = nil;
- (void)attemptToApplyCredentialsAndResume
{
if ([self error]) {
return;
}
if ([self needsProxyAuthentication]) {
[self attemptToApplyProxyCredentialsAndResume];
return;
... ... @@ -1543,7 +1589,7 @@ static NSLock *sessionCookiesLock = nil;
CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty(readStream,kCFStreamPropertyHTTPResponseHeader);
requestAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader);
CFRelease(responseHeader);
authenticationMethod = (NSString *)CFHTTPAuthenticationCopyMethod(requestAuthentication);
[self setAuthenticationScheme:[(NSString *)CFHTTPAuthenticationCopyMethod(requestAuthentication) autorelease]];
}
if (!requestAuthentication) {
... ... @@ -1570,6 +1616,9 @@ static NSLock *sessionCookiesLock = nil;
[self attemptToApplyCredentialsAndResume];
return;
}
if ([self showAuthenticationDialog]) {
[self attemptToApplyCredentialsAndResume];
}
}
[self cancelLoad];
[self failWithError:ASIAuthenticationError];
... ... @@ -1580,11 +1629,11 @@ static NSLock *sessionCookiesLock = nil;
if (requestCredentials) {
if (((authenticationMethod != (NSString *)kCFHTTPAuthenticationSchemeNTLM) || authenticationRetryCount < 2) && [self applyCredentials:requestCredentials]) {
if ((([self authenticationScheme] != (NSString *)kCFHTTPAuthenticationSchemeNTLM) || authenticationRetryCount < 2) && [self applyCredentials:requestCredentials]) {
[self startRequest];
// We've failed NTLM authentication twice, we should assume our credentials are wrong
} else if (authenticationMethod == (NSString *)kCFHTTPAuthenticationSchemeNTLM && authenticationRetryCount == 2) {
} else if ([self authenticationScheme] == (NSString *)kCFHTTPAuthenticationSchemeNTLM && authenticationRetryCount == 2) {
[self failWithError:ASIAuthenticationError];
} else {
... ... @@ -1612,8 +1661,9 @@ static NSLock *sessionCookiesLock = nil;
return;
}
// The delegate isn't interested, we'll have to give up
[self failWithError:ASIAuthenticationError];
if ([self showAuthenticationDialog]) {
[self attemptToApplyCredentialsAndResume];
}
return;
}
... ... @@ -2498,6 +2548,7 @@ static NSLock *sessionCookiesLock = nil;
return toRead;
}
@synthesize username;
@synthesize password;
@synthesize domain;
... ... @@ -2572,6 +2623,10 @@ static NSLock *sessionCookiesLock = nil;
@synthesize proxyHost;
@synthesize proxyPort;
@synthesize PACurl;
@synthesize authenticationScheme;
@synthesize proxyAuthenticationScheme;
@synthesize shouldPresentAuthenticationDialog;
@synthesize shouldPresentProxyAuthenticationDialog;
@end
... ...
... ... @@ -13,6 +13,7 @@
@interface AuthenticationViewController : UIViewController {
ASINetworkQueue *networkQueue;
IBOutlet UISwitch *useKeychain;
IBOutlet UISwitch *useBuiltInDialog;
IBOutlet UILabel *topSecretInfo;
ASIHTTPRequest *requestRequiringAuthentication;
ASIHTTPRequest *requestRequiringProxyAuthentication;
... ...
... ... @@ -27,6 +27,7 @@
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/top_secret/"]];
[request setUseKeychainPersistance:[useKeychain isOn]];
[request setShouldPresentAuthenticationDialog:[useBuiltInDialog isOn]];
[networkQueue addOperation:request];
[networkQueue go];
... ... @@ -44,28 +45,31 @@
[topSecretInfo setFont:[UIFont boldSystemFontOfSize:12]];
}
- (void)authorizationNeededForRequest:(ASIHTTPRequest *)request
{
// Why oh why is there no contextInfo for alertView like on Mac OS ?!
[self setRequestRequiringProxyAuthentication:nil];
[self setRequestRequiringAuthentication:request];
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"Please Login" message:[request authenticationRealm] delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil] autorelease];
// These are undocumented, use at your own risk!
// A better general approach would be to subclass UIAlertView
[alertView addTextFieldWithValue:@"" label:@"Username"];
[alertView addTextFieldWithValue:@"" label:@"Password"];
[alertView show];
}
- (void)proxyAuthorizationNeededForRequest:(ASIHTTPRequest *)request
{
[self setRequestRequiringAuthentication:nil];
[self setRequestRequiringProxyAuthentication:request];
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"Please Login to proxy" message:[request authenticationRealm] delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil] autorelease];
[alertView addTextFieldWithValue:@"" label:@"Username"];
[alertView addTextFieldWithValue:@"" label:@"Password"];
[alertView show];
}
//- (void)authorizationNeededForRequest:(ASIHTTPRequest *)request
//{
// // Why oh why is there no contextInfo for alertView like on Mac OS ?!
// [self setRequestRequiringProxyAuthentication:nil];
// [self setRequestRequiringAuthentication:request];
//
// [ASIHTTPRequest showAuthenticationDialogForRequest:request];
//
// //UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"Please Login" message:[request authenticationRealm] delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil] autorelease];
// // These are undocumented, use at your own risk!
// // A better general approach would be to subclass UIAlertView
// //[alertView addTextFieldWithValue:@"" label:@"Username"];
// //[alertView addTextFieldWithValue:@"" label:@"Password"];
//
//}
//
//- (void)proxyAuthorizationNeededForRequest:(ASIHTTPRequest *)request
//{
// [self setRequestRequiringAuthentication:nil];
// [self setRequestRequiringProxyAuthentication:request];
// UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"Please Login to proxy" message:[request authenticationRealm] delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil] autorelease];
// [alertView addTextFieldWithValue:@"" label:@"Username"];
// [alertView addTextFieldWithValue:@"" label:@"Password"];
// [alertView show];
//}
... ...
... ... @@ -2,9 +2,9 @@
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">9J61</string>
<string key="IBDocument.SystemVersion">9L30</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.AppKitVersion">949.46</string>
<string key="IBDocument.AppKitVersion">949.54</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
... ... @@ -39,19 +39,18 @@
<object class="IBUISwitch" id="507102015">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{112, 102}, {94, 27}}</string>
<string key="NSFrame">{{190, 96}, {94, 27}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<bool key="IBUIOn">YES</bool>
</object>
<object class="IBUILabel" id="346611327">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 105}, {75, 21}}</string>
<string key="NSFrame">{{20, 102}, {75, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
... ... @@ -65,10 +64,36 @@
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">1.000000e+01</float>
</object>
<object class="IBUISwitch" id="695921521">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{190, 131}, {94, 27}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<bool key="IBUIOn">YES</bool>
</object>
<object class="IBUILabel" id="969114697">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 134}, {144, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">Use built-in dialog:</string>
<reference key="IBUITextColor" ref="631936984"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">1.000000e+01</float>
</object>
<object class="IBUIButton" id="637796288">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 273}, {72, 37}}</string>
<string key="NSFrame">{{20, 313}, {72, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
... ... @@ -117,15 +142,15 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
<float key="IBUIMinimumFontSize">1.000000e+01</float>
<int key="IBUINumberOfLines">7</int>
</object>
<object class="IBUILabel" id="462043479">
<object class="IBUILabel" id="32387468">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 145}, {280, 120}}</string>
<string key="NSFrame">{{20, 349}, {280, 28}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">If you turn on keychain support, successful authentication will result in the username and password you provided being stored in your keychain. The application will use these details rather than prompt you the next time.</string>
<string key="IBUIText">Top secret information will not appear here</string>
<reference key="IBUIFont" ref="60494463"/>
<reference key="IBUITextColor" ref="631936984"/>
<nil key="IBUIHighlightedColor"/>
... ... @@ -134,16 +159,38 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
<float key="IBUIMinimumFontSize">1.000000e+01</float>
<int key="IBUINumberOfLines">7</int>
</object>
<object class="IBUILabel" id="32387468">
<object class="IBUILabel" id="322899213">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 318}, {280, 28}}</string>
<string key="NSFrame">{{20, 163}, {280, 84}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">Top secret information will not appear here</string>
<reference key="IBUIFont" ref="60494463"/>
<string key="IBUIText">If you turn on keychain support, successful authentication will result in the username and password you provided being stored in your keychain. The application will use these details rather than prompt you the next time.</string>
<object class="NSFont" key="IBUIFont" id="976390510">
<string key="NSName">Helvetica</string>
<double key="NSSize">1.300000e+01</double>
<int key="NSfFlags">16</int>
</object>
<reference key="IBUITextColor" ref="631936984"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
<float key="IBUIMinimumFontSize">1.000000e+01</float>
<int key="IBUINumberOfLines">7</int>
</object>
<object class="IBUILabel" id="725434414">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 252}, {280, 54}}</string>
<reference key="NSSuperview" ref="191373211"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string type="base64-UTF8" key="IBUIText">VG9nZ2xlICdVc2UgYnVpbHQtaW4gZGlhbG9nJyB0byBzd2l0Y2ggYmV0d2VlbiBBU0lIVFRQUmVxdWVz
dCdzIGJ1aWx0LWluIGRpYWxvZywgYW5kIG9uZSBjcmVhdGVkIGJ5IHRoZSBkZWxlZ2F0ZS4</string>
<reference key="IBUIFont" ref="976390510"/>
<reference key="IBUITextColor" ref="631936984"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
... ... @@ -200,6 +247,14 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
</object>
<int key="connectionID">17</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">useBuiltInDialog</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="695921521"/>
</object>
<int key="connectionID">25</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
... ... @@ -217,12 +272,15 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
<reference key="object" ref="191373211"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="346611327"/>
<reference ref="507102015"/>
<reference ref="521884665"/>
<reference ref="462043479"/>
<reference ref="637796288"/>
<reference ref="969114697"/>
<reference ref="695921521"/>
<reference ref="507102015"/>
<reference ref="346611327"/>
<reference ref="322899213"/>
<reference ref="725434414"/>
<reference ref="32387468"/>
<reference ref="637796288"/>
</object>
<reference key="parent" ref="317526666"/>
</object>
... ... @@ -258,13 +316,28 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">15</int>
<reference key="object" ref="462043479"/>
<int key="objectID">16</int>
<reference key="object" ref="32387468"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">16</int>
<reference key="object" ref="32387468"/>
<int key="objectID">21</int>
<reference key="object" ref="695921521"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">22</int>
<reference key="object" ref="969114697"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">23</int>
<reference key="object" ref="322899213"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">24</int>
<reference key="object" ref="725434414"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
... ... @@ -279,8 +352,11 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
<string>14.IBPluginDependency</string>
<string>15.IBPluginDependency</string>
<string>16.IBPluginDependency</string>
<string>21.IBPluginDependency</string>
<string>22.IBPluginDependency</string>
<string>23.IBPluginDependency</string>
<string>24.IBPluginDependency</string>
<string>6.IBPluginDependency</string>
<string>7.IBPluginDependency</string>
</object>
... ... @@ -288,7 +364,10 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>AuthenticationViewController</string>
<string>UIResponder</string>
<string>{{723, 372}, {320, 480}}</string>
<string>{{358, 231}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
... ... @@ -318,7 +397,7 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">17</int>
<int key="maxID">25</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
... ... @@ -335,17 +414,19 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>topSecretInfo</string>
<string>useBuiltInDialog</string>
<string>useKeychain</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UILabel</string>
<string>UISwitch</string>
<string>UISwitch</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">AuthenticationViewController.h</string>
<string key="minorKey">iPhone Sample/AuthenticationViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
... ... @@ -358,7 +439,7 @@ c3N3b3JkLCBlbnRlciAndG9wc2VjcmV0JyBmb3IgYm90aC4</string>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.LastKnownRelativeProjectPath">iPhone.xcodeproj</string>
<string key="IBDocument.LastKnownRelativeProjectPath">../../iPhone.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3.0</string>
</data>
... ...
This diff was suppressed by a .gitattributes entry.