7 Replies Latest reply: Sep 6, 2012 2:58 AM by lunicon RSS

    Custom login dialog loop on IE

    lunicon
      Good day!
      I create custom login dialog based on fireboxtraining example.
      And faced one problem. Everything works on Chrome/Firefox, but on IE (my 9.0.8112.16421) works unpredictable.
      It can login on the fifth time (without any errors in log). Another observation: if you wait a few seconds between attempts to login it'll work.
      Internet search revealed nothing. I know IE is not your favorite browser, but many users do not use/know other.
      Maybe someone has solution and can share with us?

      adfLogin.7z source on gdocs, Jdeveloper 11.1.2.2.0
        • 1. Re: Custom login dialog loop on IE
          Frank Nimphius-Oracle
          Hi,

          see if this helps: https://blogs.oracle.com/jdevotnharvest/entry/solving_jdeveloper_11gr2_issue_with

          Frank
          • 2. Re: Custom login dialog loop on IE
            lunicon
            Indeed, for my simple form this files are requested:
            GET /adfLogin-ViewController-context-root/afr/ss.gif
            GET /adfLogin-ViewController-context-root/afr/partition/ie/default/opt/core-11.1.2.2.0-2121.js
            GET /adfLogin-ViewController-context-root/adf/jsLibs/Locale2_0_0_beta_2.js
            GET /adfLogin-ViewController-context-root/afr/partition/ie/default/opt/boot-11.1.2.2.0-2121.js
            GET /adfLogin-ViewController-context-root/afr/blank.html
            GET /adfLogin-ViewController-context-root/afr/fusion/info.png
            GET /adfLogin-ViewController-context-root/afr/fusion/dialog-header-middle.png
            GET /adfLogin-ViewController-context-root/afr/fusion/dialog-footer-middle.png
            GET /adfLogin-ViewController-context-root/afr/fusion/dialog-header-left.png
            GET /adfLogin-ViewController-context-root/afr/fusion/dialog-header-right.png
            GET /favicon.ico
            GET /adfLogin-ViewController-context-root/afr/fusion/button_bg_ovr.png

            Many thanks, Frank! I will try...
            • 3. Re: Custom login dialog loop on IE
              lunicon
              it seems it's not that
              • 4. Re: Custom login dialog loop on IE
                lunicon
                  public String doLogin()
                    throws LoginException
                  {
                    String un = _username;
                    byte[] pw = _password.getBytes();
                    FacesContext ctx = FacesContext.getCurrentInstance();
                    HttpServletRequest request = (HttpServletRequest) ctx.getExternalContext().getRequest();
                    Subject mySubject;
                    try
                    {
                      mySubject = Authentication.login(new URLCallbackHandler(un, pw));
                      ServletAuthentication.runAs(mySubject, request);
                      ServletAuthentication.generateNewSessionID(request);
                      String loginUrl = "/adfAuthentication?success_url=/faces/main.jspx";
                      HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
                      RequestDispatcher dispatcher = request.getRequestDispatcher(loginUrl);
                      dispatcher.forward(request, response);
                      ctx.responseComplete();
                      System.out.println("login - ok");
                    }
                    catch (FailedLoginException e)
                    {
                      FacesMessage msg =
                        new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "Invalid username or password");
                      ctx.addMessage(null, msg);
                    }
                    catch (Exception e)
                    {
                      System.err.println(e.getMessage());
                    }
                    return null;
                  }
                I sniff http log:
                HTTP:Request, POST /adfLogin-ViewController-context-root/faces/login.jspx, Query:_adf.ctrl-state=143kztej63_3
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:Response, HTTP/1.1, Status: Ok, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:Request, GET /adfLogin-ViewController-context-root/faces/main.jspx
                HTTP:Response, HTTP/1.1, Status: Moved temporarily, URL: /adfLogin-ViewController-context-root/faces/main.jspx

                HTTP:Request, GET /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:Response, HTTP/1.1, Status: Ok, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx

                i see login - ok, but it loop to login.jspx again
                strange lines in the log redirect to itself.

                successul login log
                HTTP:Request, POST /adfLogin-ViewController-context-root/faces/login.jspx, Query:_adf.ctrl-state=z3ak9idav_3
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:Response, HTTP/1.1, Status: Ok, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                HTTP:Request, GET /adfLogin-ViewController-context-root/faces/main.jspx
                HTTP:Response, HTTP/1.1, Status: Ok, URL: /adfLogin-ViewController-context-root/faces/main.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/main.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/main.jspx
                HTTP:Request, GET /adfLogin-ViewController-context-root/faces/main.jspx, Query:_adf.ctrl-state=z3ak9idav_7
                HTTP:Response, HTTP/1.1, Status: Ok, URL: /adfLogin-ViewController-context-root/faces/main.jspx

                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/main.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/main.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/main.jspx
                HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/main.jspx

                similar to the time of the request it is not authorized yet. and redirect to login
                • 5. Re: Custom login dialog loop on IE
                  Frank Nimphius-Oracle
                  Hi,

                  change the following:

                  String loginUrl = "/adfAuthentication?success_url=/faces/main.jspx";
                  HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
                  RequestDispatcher dispatcher = request.getRequestDispatcher(loginUrl);
                  dispatcher.forward(request, response);
                  ctx.responseComplete();
                  String loginUrl = "/adfAuthentication?success_url=/faces/main.jspx";
                  ctx.getExternaleContext()).redirect(loginUrl);
                  he documentation in the Fusion developer guide is about to change accordingly due to known issues with the serer side forward after authentication. Redirect is the way to go

                  Frank
                  • 6. Re: Custom login dialog loop on IE
                    lunicon
                    HTTP:Request, POST /adfLogin-ViewController-context-root/faces/login.jspx, Query:_adf.ctrl-state=izldp228g_3
                    HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                    HTTP:Response, HTTP/1.1, Status: Ok, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                    HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                    HTTP:Request, GET /adfAuthentication, Query:success_url=/faces/main.jspx
                    <font color="red">HTTP:Response, HTTP/1.1, Status: Not found, URL: /adfAuthentication</font>

                    web.xml
                    <security-constraint>
                        <web-resource-collection>
                          <web-resource-name>Allowed ADF Resources</web-resource-name>
                          <url-pattern>/adf/*</url-pattern>
                          <url-pattern>/afr/*</url-pattern>
                          <url-pattern>/bi/*</url-pattern>
                          <url-pattern>/bi/*</url-pattern>
                          <url-pattern>/favicon.ico</url-pattern>
                          <url-pattern>/servlet/GraphServlet/*</url-pattern>
                          <url-pattern>/servlet/GaugeServlet/*</url-pattern>
                          <url-pattern>/mapproxy/*</url-pattern>
                          <url-pattern>/adflib/*</url-pattern>      
                        </web-resource-collection>
                      </security-constraint>
                      <security-constraint>
                       <web-resource-collection>    
                         <web-resource-name>allPages</web-resource-name>    
                         <url-pattern>/*</url-pattern>
                       </web-resource-collection>
                       <auth-constraint>     
                         <role-name>valid-users</role-name>
                       </auth-constraint>
                      </security-constraint>  
                      <security-constraint>
                        <web-resource-collection>
                          <web-resource-name>adfAuthentication</web-resource-name>
                          <url-pattern>/adfAuthentication</url-pattern>
                        </web-resource-collection>
                        <auth-constraint>
                          <role-name>valid-users</role-name>
                        </auth-constraint>
                      </security-constraint>
                    I'm sad...
                    • 7. Re: Custom login dialog loop on IE
                      lunicon
                      need to use full path
                      String loginUrl = ctx.getExternalContext().getRequestContextPath() +"/adfAuthentication?success_url=/faces/main.jspx";
                      ctx.getExternalContext().redirect(loginUrl);

                      but same error in login
                      HTTP:Request, POST /adfLogin-ViewController-context-root/faces/login.jspx, Query:_adf.ctrl-state=89wtqi5hf_3
                      HTTP:Response, HTTP/1.1, Status: Ok, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                      HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                      HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                      HTTP:Request, GET /adfLogin-ViewController-context-root/adfAuthentication, Query:success_url=/faces/main.jspx
                      HTTP:Response, HTTP/1.1, Status: Moved temporarily, URL: /adfLogin-ViewController-context-root/adfAuthentication

                      HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/adfAuthentication
                      HTTP:Request, GET /adfLogin-ViewController-context-root/faces/login.jspx
                      HTTP:Response, HTTP/1.1, Status: Ok, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                      HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx
                      HTTP:HTTP Payload, URL: /adfLogin-ViewController-context-root/faces/login.jspx