following ADAL webview with websso site webview (with IDP’s cookies)


Based on the IOS sample for ADAL, we amended the initial table controller – setup to show table of todos. We simply overlaid a webview and bound the view’s control to a variable in the controller class.

Then we amended the callback chain – which normally refreshes the listing view having obtained a list from the authenticated API call. Rather than refresh, we populate a page into our web view – a page served by an SP also served by the IDP just used to create an ADAL managed token (for webAPI usage). So the IDP will assert, we injected the IDP-minted cookies – created during the ADAL interaction moments earlier:

Screen Shot 2014-06-12 at 5.15.43 PM

For easy selection, the code is

 

 	else         {             self.taskItems = (NSMutableArray*)tasks;                          // Refresh main thread since we are async             dispatch_async(dispatch_get_main_queue(), ^{       //          [self.tableView reloadData];                 NSString *fullURL = @”https://ssoportal.rapmlsqa.com/SPInitiatedSSOHandler.aspx/BARS/6?wa=wsignin1.0&wtrealm=http://tablet.com/&wreply=http%3A%2F%2Fm.rapmlsqa.com%2FSPHandler.aspx%3FMls%3DBARS”;                 NSURL *url = [NSURL URLWithString:fullURL];                 NSMutableURLRequest *requestObj = [NSMutableURLRequest requestWithURL:url];                                  NSArray *cookiesForDomain = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:@"..."];                                  if (cookieStringToSet.length) {                     [requestObj setValue:cookieStringToSet forHTTPHeaderField:@"Cookie"];                 }                 [_webView loadRequest:requestObj];              });         }  
Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in AAD. Bookmark the permalink.