Xcode login with security questions

413 views Asked by At

I am trying to implement the following code:

NSURL *url = [NSURL URLWithString:@"https://login.XXX.com/security/xxxforms//
logonchalnp.fcc?TYPE=33554433&REALMOID=06-95b0f0c8-198a-1039-b583
83b02659fd47&GUID=&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=owa5&TARGET=-SM- 
HTTPS%3a%2f%2fowa%2exxx%2ecom%2f"];

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setDelegate:self];
[request setPostValue:@"XXX" forKey:@"USER"];
[request setPostValue:@"XXX" forKey:@"PASSWORD"];
[request startSynchronous];

NSURLResponse *response;
NSError *error;
NSData *urlData = [NSURLConnection sendSynchronousRequest:request
                                        returningResponse:&response 
                                                    error:&error];
NSString *str=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
NSLog(@"Login response: is %@", str);

The pertinent contents of the website are:

<form NAME="Login" METHOD="POST" action="/forms/logonchal_l10question.jsp">
<INPUT TYPE=HIDDEN NAME="SMENC" VALUE="ISO-8859-1">
<INPUT type=HIDDEN name="SMLOCALE" value="US-EN">
<center>

<!-- outer table with border -->
<table width="50%" border="1" cellpadding="0" cellspacing="0" align=center>
<tr> 
<td>    
<!-- Login table -->          
<table WIDTH="100%" HEIGHT=200 class="platportletLightBg" border=0 cellpadding=0
cellspacing=0 >

<tr HEIGHT="30" class="platportletHeaderBg">
<td valign=center height=40 align=center colspan=4 >
        <b class="d_banHeader">Please Login</b>
      </td>
    </tr>

    <tr> <td colspan=4 height=20> <font size=1> &nbsp; </font> </td> </tr>

    <tr align="center">
      <td WIDTH=20 >&nbsp;</td>
      <td ALIGN="LEFT" > 
            <b class="customappSubhead"> Username: </b>
      </td>
      <td align=center >
            <input type="text" name="USER" size="30" AUTOCOMPLETE=OFF>
          </td>
      <td WIDTH=20 >&nbsp;</td>
    </tr>

    <tr> <td colspan=4 height=5> <font size=1> &nbsp; </font> </td> </tr>

    <tr align="center" >
      <td WIDTH=20 >&nbsp;</td>
      <td align=left>
            <b class="customappSubhead"> Password: </b>
      </td>
      <td>
        <input type="password" name="PASSWORD" size="30">
      </td>
      <td WIDTH=20 >&nbsp;</td>
    </tr>

    <tr> <td colspan=4 height=20> <font size=1> &nbsp; </font> </td> </tr>

    <tr>
      <td colspan=4 NOWRAP WIDTH="50%" HEIGHT="25" align="CENTER">
          <input type=hidden name=target value="HTTPS://owa.xxx.com/">
          <input type=hidden name=smquerydata value="">
          <input type=hidden name=smauthreason value="0">
          <input type=hidden name=smagentname value="owa5">
          <input type=hidden name=postpreservationdata value="">
          <input type="button" value="Login" onClick="submitForm();">
      </td>
    </tr>

The intended response: When logging in manually and directly from the browser with the appropriate username/password, the webpage will redirect to a security question page. If the question is successfully answered it will proceed to another login page for a web based application.

As the code stands, it successfully logs-in to the initial page, but by-passes the security question page and goes directly to the secondary login page. From there, the web based application login will be (obviously?) unsuccessful. I know that it is at least taking the initial USER and PASSWORD correctly in that it fails if wrong values are entered (wrong credentials notice). The UIWebView will also accurately display the secondary login page if correct values are entered. As a side note: This secondary log-in page is not accessible when the URL is directly entered into a browser.

Question: Request to know if there is any redirection that I'm missing here? How do I trigger action="/forms/logonchal_l10question.jsp" which is where I believe the log-in questions are generated and presented?

Any help is greatly appreciated.

1

There are 1 answers

0
Niketh Kumar On

Could you please let me know where i can find the file where

below NSURL*url is configured

 NSURL *url = [NSURL URLWithString:@"https://login.XXX.com/security/xxxforms//
 logonchalnp.fcc?TYPE=33554433&REALMOID=06-95b0f0c8-198a-1039-b583
 83b02659fd47&GUID=&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=owa5&
 TARGET=-SM-HTTPS%3a%2f%2fowa%2exxx%2ecom%2f"];

We are using Sun One WebServer.

Could you please give me the location and name of the file where I can find the file. I dont have idea which OS they are using(Solaris/Unix).