How to prevent login page in same browser when user is already authenticated

Hello,
I am using Jdev 11.1.1.6 with ADF security implemented in my application.
I have Login.jspx that redirects the user to Home.jspx on successful authentication. User can either enter Login or Home Page URL.
Please consider following scenarios:
a) User is not authenticated in current browser session
  a.1) if user enters Home page URL then Login page is displayed and redirected to Home page on authentication
  a.2) if user enters Login page URL then Login page is displayed and redirected to Home page on authentication
b) User is already authenticated in current browser session, a new tab is opened and
  b.1) if user enters Home page URL then it directly shows Home page (already authenticated)
  b.2) if user enters Login page URL then Login page is displayed -- this is the issue, it should either directly take user to Home page or invalidate the existing session and let user proceed with new.
How do I achieve this? Any help is highly appreciated.
Thanks,
Jai

Thanks Frank and everyone for your help.
I am able to achieve what Frank suggested using phase listener. We don't have a custom phase listener but I created one and instead of configuring at global level, just defined the ControllerClass in the pageDef of my login page.  
Code from afterPhase is:
    public void afterPhase(PagePhaseEvent pagePhaseEvent) {
        if (pagePhaseEvent.getPhaseId() == Lifecycle.INIT_CONTEXT_ID) {
            FacesContext fctx = FacesContext.getCurrentInstance();
            String viewRootId = fctx.getViewRoot().getViewId();
            if ("/pages/login.jspx".equalsIgnoreCase(viewRootId) &&
                ADFContext.getCurrent().getSecurityContext().isAuthenticated()) {
                try {
                    String homeViewId = "pages/home.jspx";
                    ControllerContext controllerCtx = null;
                    controllerCtx = ControllerContext.getInstance();
                    String activityURL =
                        controllerCtx.getGlobalViewActivityURL(homeViewId);
                    fctx.getExternalContext().redirect(activityURL);
                } catch (IOException ioe) {
                    _logger.logException(ioe);
My only concern here is that I am hardcoding the login and home page url. Is there a better way to implement this?
Thanks,
Jai

Similar Messages

  • How to send multiple pages to same browser

    I have a JSP that has a form that submits to a servlet to read a file and then return the value of the file in a bean back to the JSP. I want to be able to send "update" pages to the browser so the client knows the progress of the read. Is there any way I can do a sendRedirect() to the page with a value in the bean telling how much has been read and then keep sending updates every few seconds until the file is read? I know some people do this to show the status of a site search but it looks to me like they send the page with an instant refresh back to the servlet. This won't work for me since the servlet is in the middle of reading a file on another server so I don't want the servlet thread to end until the entire file is read. I have tried coding multiple sendRedirects in the read code but the only thing the browser displays is the last value before the servlet returns. If anybody has any ideas I would appreciate it.

    I would recommend not doing an upload monitor. There is, as far as I can tell, no easy way to do it and complicated ways will detract from the power you need to actually perform the process in question. A warning that they will need to wait a few seconds for the server to upload the file should be fine.

  • How to disable login page in an application

    how to disable login page in an application

    Hi Alekh,
    To turn off authentication you must create and make current a No Login Authentication authentication scheme.
    or change Page / Security / Authentication as "Page is Public"
    Regards,
    Benz

  • How to Navigate to Printable Page in 'same browser'

    Dear experts,
    Im using Jdeveloper 11.1.2.2
    I tried the following link to get Printable Page in 'same browser',but it is hard to identify the steps.
    (http://www.oracle.com/technetwork/developer-tools/adf/learnmore/95-printable-pages-1501392.pdf)
    Anyone have simple tutorial to do this work?
    Thanks
    Charith

    Hi,
    if you mean to show a printable page in the same browser window (replacing the current form) then
    1. add command button
    2. add af:showPrintablePageBehavior tag (drag and drop from "OPerations" tag in component palette
    Thats it. See also http://docs.oracle.com/cd/E26098_01/apirefs.1112/e17491/tagdoc/af_showPrintablePageBehavior.html
    Frank

  • How to make Login Page in ADF?

    Hi,
    Can anyone suggest me, how to make Login Page in ADF.
    I am new on ADF, is any sample code or application is there than it will be helpful for me.
    please reply its urgent.
    Thanks,
    Ramit Mathur

    HI,
    Jspx code
    <af:panelFormLayout id="pfl1" binding="#{loginBean.mainForm}">
    <f:facet name="footer"/>
    <af:inputText label="Username" id="it1"
    value="#{loginBean.username}"
    binding="#{loginBean.usernameId}"
    required="true"/>
    <af:inputText label="Password" id="it2" secret="true"
    value="#{loginBean.password}"
    binding="#{loginBean.passwordId}"
    required="true"/>
    <af:spacer width="1px" height="20px" id="s3"/>
    <af:panelGroupLayout id="pgl3">
    <af:commandButton text="Submit" id="cb1"
    action="#{loginBean.doLogin}"/>
    <af:spacer width="85px" height="1px" id="s4"/>
    <af:commandButton text="Cancel" id="cb2"
    action="#{loginBean.clearFields}"/>
    </af:panelGroupLayout>
    </af:panelFormLayout>
    BackingBean code
    public String doLogin() {
    String un = _username;
    String pw = _password;
    // byte[] pw = _password.getBytes();
    FacesContext ctx = FacesContext.getCurrentInstance();
    System.out.println("ctx" + ctx);
    HttpServletRequest request =
    (HttpServletRequest)ctx.getExternalContext().getRequest();
    CallbackHandler handler = new SimpleCallbackHandler(un, pw);
    System.out.println("Handler" + handler);
    try {
    Subject mySubject = Authentication.login(handler);
    System.out.println("mySubject" + mySubject);
    ServletAuthentication.runAs(mySubject, request);
    ServletAuthentication.generateNewSessionID(request);
    String loginUrl =
    "/adfAuthentication?success_url=/faces" + ctx.getViewRoot().getViewId();
    System.out.println("loginUrl---" + loginUrl);
    HttpServletResponse response =
    (HttpServletResponse)ctx.getExternalContext().getResponse();
    System.out.println("response---" + response);
    // loginUrl = "/adfAuthentication?success_url=/faces/WelcomeScreen1.jspx";
    sendForward(request, response, loginUrl);
    System.out.println("---" + response);
    } catch (FailedLoginException fle) {
    FacesMessage msg =
    new FacesMessage(FacesMessage.SEVERITY_ERROR, "Incorrect Username or Password",
    "An incorrect Username or Password" +
    " was specified");
    ctx.addMessage(null, msg);
    } catch (LoginException le) {
    reportUnexpectedLoginError("LoginException", le);
    return null;
    private void sendForward(HttpServletRequest request,
    HttpServletResponse response, String forwardUrl) {
    FacesContext ctx = FacesContext.getCurrentInstance();
    System.out.println("sendForward--ctx--" + ctx);
    RequestDispatcher dispatcher =
    request.getRequestDispatcher(forwardUrl);
    System.out.println("sendForward--dispatcher--" + dispatcher);
    try {
    dispatcher.forward(request, response);
    } catch (ServletException se) {
    reportUnexpectedLoginError("ServletException", se);
    } catch (IOException ie) {
    reportUnexpectedLoginError("IOException", ie);
    ctx.responseComplete();
    // 12.Implement a reportUnexpectedLoginError() method:
    private void reportUnexpectedLoginError(String errType, Exception e) {
    FacesMessage msg =
    new FacesMessage(FacesMessage.SEVERITY_ERROR, "Unexpected error during login ",
    "An incorrect Username or Password" +
    " was specified");
    FacesContext.getCurrentInstance().addMessage(null, msg);
    e.printStackTrace();
    }

  • How to create Login page in Jdev11.1.1.4

    Hi All,
    can anyone please share how to create Login Page in Jdev11.1.1.4
    TIA,
    Bob
    Edited by: Bob on Feb 18, 2011 12:40 AM

    Bob,
    [url http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/adding_security.htm#BABDEICH]The documentation tells you how.
    John

  • Open PDF in same browser when the preference is set to open in new window.

    The corporate policy for all applications is to open the PDF document in new browser/reader but our application needs the reader to open in the same browser even the preference "Display PDF in Browser" is unchecked.... The setPreference from javascript (html) doesn't seemed to work... How do i make this work?
    Also, I need the links the browser to open in new browser once the PDF is loaded... do I need to reset the preference once it is loaded for the links to open in new browser?
    thanks,
    - Ray

    There is no way to override that from your application.   And if the Links in the PDF have an explicit "open in new window" setting, that is respected over the preference.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Wed, 19 Oct 2011 22:02:53 -0700
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Open PDF in same browser when the preference is set to open in new window.
    Open PDF in same browser when the preference is set to open in new window.
    created by h_ray<http://forums.adobe.com/people/h_ray> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/3981167#3981167

  • How to prevent Oracle from using an index when joining two tables ...

    How to prevent Oracle from using an index when joining two tables to get an inline view which is used in an update statement?
    O.K. I think I have to explain what I mean:
    When joining two tables which have many entries sometimes it es better not to use an index on the column used as join criteria.
    I have two tables: table A and table B.
    Table A has 4.000.000 entries and table B has 700.000 entries.
    I have a join of both tables with a numeric column as join criteria.
    There is an index on this column in table A.
    So I instead of
      where (A.col = B.col)I want to use
      where (A.col+0 = B.col)in order to prevent Oracle from using the index.
    When I use the join in a select statement it works.
    But when I use the join as inline view in an update statement I get the error ORA-01779.
    When I remove the "+0" the update statement works. (The column col is unique in table B).
    Any ideas why this happens?
    Thank you very much in advance for any help.
    Regards Hartmut

    I think you should post an properly formatted explain plan output using DBMS_XPLAN.DISPLAY including the "Predicate Information" section below the plan to provide more details regarding your query resp. update statement. Please use the \[code\] and \[code\] tags to enhance readability of the output provided:
    In SQL*Plus:
    SET LINESIZE 130
    EXPLAIN PLAN FOR <your statement>;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);Usually if you're using the CBO (cost based optimizer) and have reasonable statistics gathered on the database objects used the optimizer should be able to determine if it is better to use the existing index or not.
    Things look different if you don't have statistics, you have outdated/wrong statistics or deliberately still use the RBO (rule based optimizer). In this case you would have to use other means to prevent the index usage, the most obvious would be the already mentioned NO_INDEX or FULL hint.
    But I strongly recommend to check in first place why the optimizer apparently seems to choose an inappropriate index access path.
    Regards,
    Randolf
    Oracle related stuff:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle:
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • How can I tell if a user has already authenticated against AD?

    Sorry to begin with if this has been dealt with in another thread already. Ive taken a look around and cant see something that answers my questions exactly. If such a thread exists, please point me in that direction.
    We have a product that needs to be installed on a customer site. Its a windows based, web fronted application with a client program on the user's pc and a server side component that handles requests for data. What I need to do is to check if the user has already authenticated against active directory. If so then I dont need to ask for authentication (single sign on).
    This is my first look at jndi so Im in the dark about how this should be done. Is there a way to use the user's credentials (is there a token?) to check or do I need a specific login for my application to access the customer AD?
    Any tips would be very welcome,
    Mark

    You may want to refer to the Java Security forum at http://forum.java.sun.com/forum.jspa?forumID=545 for information on Kerberos & JAAS.
    There is a also a post in this forum, outlining how to utilise Kerberos, JAAS with JNDI to access Active Directory. JNDI, Active Directory and Authentication (Part 1) (Kerberos)
    at http://forum.java.sun.com/thread.jspa?threadID=579829&tstart=300
    Possibly the part you are looking for is the functionality included in the class that implements java.security.PrivilegedAction
    Good luck.

  • How to get login page when user clicks on browser's back button

    Hi,
    I am using struts framework.
    I have set property nochache=true in response header of all pages.
    So, browser does not caches my pages.
    Now,when I am clicking on browser's back button, I am getting following message..generated by browser.
    Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.
    To resubmit your information and view this Web page, click the Refresh button.
    Instead of that I want to show user a login page, when it clicks on back button.
    Can anyone help me?

    Hi,
    I agree with your suggestion.But my query is,
    If you have seen many credit card or banking websites,generally when user clicks on browser's back button,its redirectly user to login page of it for security reasons.
    I want to implement that kind of functionality.So need help on that point

  • Transfer winform data to yahoo login page inside CHROME browser

    My Winform contails
    Two TextBoxes
    1)txtUserName
    2)txtPassword
    and 1 Button object
    1)btnLogin
    I just want to transfer winform txtUserName and txtPassword data to My Yahoo login page while click on btnLogin.
    I achived this thing for IE but now I want to do for other Web Browser like CHROME
    I search it on google but i didnt get any help for this. please if you know how to do this so please guide me.
    Thankx in Advance

    Hello,
    >> I achived this thing for IE but now I want to do for other Web Browser
    like CHROME
    Sorry to tell you that Web Browser like CHROME is already beyond the scope of our support. I suggest you posting this issue to the corresponding browser web sites, they may have APIs for this.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to create login page for application with jheadstart

    Is there a how to section for jheadstart?
    After reviewing the jheadstart developer's guide. I am still left with lot of questions:
    1. how to create a login page to allow access to an application using username/password from a database table
    2. how to change the title graphic (jheadstart demo) to (my application)
    3. how to execute a query by hitting enter instead of a mouse clicking a button
    Any suggestion to search for such practical questions in this forum or other blogs and such is appreciated.

    Mahin,
    You can set Authentication Schemes for your applications. If you are using Application Express Authentication, you can create additional users from here:
    1. From Application Express home, click Manage Application Express users.
    2. Click Create to create users. To create end user, select "no" to developer and admin.
    - Christina

  • How to modify login page

    Hello,
    I am using Oracle Applications 11.5.10 and I need to modify the login page by adding a custom message.
    How can I do that?
    I have also tried to personalize the FND_SSO_SARBANES OXLEYTEXT, but my message is too long and if I put it there the message don't wrap in multiple lines (is it possibile to wrap this message?).
    Thanks in advance.
    Bye
    Raffaella

    there is a profile option FND_SSO_LOGIN_MASK that u can use. U can set this value:
    Bitmap values for optional Login Page attributes
    To show these attributes, just add the numeric values of all desired
    attributes. So, for example to show PASSWORD_HINT and FORGOT_PASSWORD_URL
    set the profile option, FND_SSO_LOGIN_MASK to 18 (2 + 16)
    Converting decimal 512 to hexadecimal
    512 / 16 = 32, 0 (remainder in hex)
    32 / 16 = 2, 0
    2 / 16 = 0, 2
    So decimal 512 is 0X200 in hexadecimal
    128 = 0X80, 256 = 0X100
    final int USERNAME_HINT = 0x01; // 1
    final int PASSWORD_HINT = 0x02; // 2
    final int CANCEL_BUTTON = 0x04; // 4
    final int FORGOT_PASSWORD_URL = 0x08; // 08
    final int REGISTER_URL = 0x10; // 16
    final int LANGUAGE_IMAGES = 0x20; // 32
    final int SARBANES_OXLEY_TEXT = 0x40; // 64
    Also u can use the Framework to change some picture
    Mike

  • How to avoid login page in List Tree

    Hi group,
    I am new to APEX and I have added a tree list to my application.
    The problem is when I click into the link of the tree list, it always redirects me to the login page.
    Is any setting that I am missing?
    This tree list was created into the page "0".
    Thanks in advance.
    Kind regards,
    Francisco

    Hi
    jyothi
    thanks for the response
    i was following yours thread of Tree the same problem is thr in my tree its also nt retaining the current possition after collapsing it and this is my code can you please help me in this and i have try your javascript also but were to put it i m not getting the solution was gien to u by andyand vee, please please help me
    this my code
    select
      case
        when connect_by_isleaf = 1 then
          0
        when level = 1 then
          1
        else
          -1
      end as status,
      level,
      case
        when PAGE_NUMBER is null then
          MENU_ITEM_NAME
        else
          MENU_ITEM_NAME || ' (' || PAGE_NUMBER || ')'
      end as title,
      null as icon,
      MENU_ITEM_ID as value,
      null as tooltip,
      case
        when PAGE_NUMBER IS NULL then
          NULL
        else
         'f?p=&APP_ID.:' || PAGE_NUMBER || ':&APP_SESSION.'
      end as link
    from   #OWNER#.D_MENU_ITEM
    start with IS_ROOT = 'Y'
    connect by prior MENU_ITEM_ID = PARENT_ITEM_ID
    order siblings by SEQUENCE_NUMBEREdited by: shadab550 on Mar 15, 2012 10:09 AM

  • How to make login page navigate to last visited page?

    Hi,
    In our application, there are many public pages. In certain page, users need to login and then add or edit something. But login page will navigate to page 1 by default. Uses need to click some times to locate the last visited page.
    I defined a new applicate item "LASTPAGE", and a new application process "setpage":
    begin
    if :APP_PAGE_ID!=101 then
    select :APP_PAGE_ID into :LASTPAGE from dual;
    else
    select 1 into :LASTPAGE from dual;
    end if;
    end;
    "setpage"'s process point is "On Load: Before Header(page template header)"
    In login page 101, log in process is like following:
    wwv_flow_custom_auth_std.login(
    P_UNAME => :P101_USERNAME,
    P_PASSWORD => :P101_PASSWORD,
    P_SESSION_ID => v('APP_SESSION'),
    P_FLOW_PAGE => :APP_ID||':'||:LASTPAGE
    But the thing is it does not work. Log in page still go to page 1.
    Best regards,
    Qiang.
    Message was edited by:
    user535779

    Hi Scott,
    I would like to branch at the page that I am trying to get to from page 101.
    Let say page 12 Requires Authentication
    When I am not logged in , and I try to access Page 12 , I get branched to page 101 (login page).
    Now , from page 101 , I would like to branch to the page I was trying to access , in this case Page 12
    wwv_flow_custom_auth_std.login(
    P_UNAME => :P101_USERNAME,
    P_PASSWORD => :P101_PASSWORD,
    P_SESSION_ID => v('APP_SESSION'),
    P_FLOW_PAGE => :APP_ID||:APP_PAGE_ID
    The problem is that APP_PAGE_ID contains 101 and not 12
    Francis.

Maybe you are looking for

  • Error in UTL_HTTP

    Hello, When i give http_req := utl_http.begin_request(url, 'POST','HTTP/1.1'); I get this Error -------utl_http.get_response--------------------- http_resp.status_code is :500 http_resp.reason_phrase is :Internal Server Error http_resp.http_version i

  • RAW thumbnails missing after iPhoto library rebuild

    iPhoto would not open for me shortly after upgrading to Lion. I rebuilt the library using command + option with all checkboxes checked. All JPEG thumbnails were present, but all RAW thumbnails just showed a black box with a dashed line. When I double

  • Painting in applets

    I ran into a problem using AWT in applets. Sometimes in IE the animated applets repaints in a random place. Sometimes it's taskbar area, sometimes browsers toolbar. I don't know if it's JRE 1.3.1_08's bug or it may be code's fault. Anyone ran into si

  • Tables for BOM Header and Components

    Dear Friends, Please let me know which tables provide a link between the header Material and corresponding Component Materials of a BOM? I have seen STKO and STPO but couldn't find such a link in them. STPO gives the component material but I couldn't

  • SAFARI COMPLETELY LOST ABILITY TO LOAD IMAGES

    .... no idea what happened but all the images from all sites just won't load anymore .... this is what Safari looks like http://grab.by/nAog Chrome works fine. I have never seen anything like this before. It's the latest 6.05 on a brand new iMac with