Right way of login form...

Hello
I am a really newbie in web programming. I want to write a web application with JSF. I wonder what is the rgiht way of creating the login form. I tried to write a page segment file for it but page segments do not have prerender method so it cannot be fully controlled...I want something like that:
login control will be two parts..
if login info is not found in session, than it will show the login form.
if the user is found in session, than it will show the menu for the user...
but i couldnt do that because prerender methos is not available in page segments..
what is the right way for doing that kind of thing?

Indeed implement a Filter.
Once an user logs in, put the User object in the HttpSession. Let the filter check on this User object. If this User object is null and you're not in the login page, then redirect to the login page.
Do a Google search on "LoginFilter implements Filter" or "UserFilter implements Filter" and you'll find lot of examples.
http://www.google.com/search?q=%22LoginFilter implements Filter%22
http://www.google.com/search?q=%22UserFilter implements Filter%22
Here is an advanced one which actually doesn't redirect if the User object doesn't exist, but this might give you some new insights: http://balusc.xs4all.nl/srv/dev-jep-usf.html

Similar Messages

  • Right way to validate form fields !!

    Hi,
    I am having a form with many fields including TextFields, Dropdowns, DateFields, Checkboxes, Radiobuttons etc.
    I am validating the most fields by making them REQUIRED. But I didn't found way to make Checkbox field required. So I am doing it by script by making its MANADATORY property to true. I am validating fields at the Form's preSubmit event.
    All I want to know that whether it is the right way to validation i.e.
    Making field.mandatory = true; (for checkboxes or may be some other field too)
    Check it at preSubmit event of the form;
    I want to code it according to best practices. That's why this question bounces up in the mind.
    Thanks.
    Abhinav

    Thank you for your replies!
    I understand how to get data into a JCombobox,
    but what about my bigger, general question?
    "I am confused because in other parts of my program I get a database connection and am not sure if you just form a query each time you need data or store the results somewhere (vector, array, collection)and use it this way." when the data or parts need to be used again.
    This is the help I need.
    Thanks again1
    Alan

  • OAM In Custom Login Form: Is there a way to get the user that was blocked?

    Hi
    I'm creating a custom login form and I need to capture which user was blocked if I get an OAM-5 error code. There is no parameter that specifies which user was filled and I can't capture it before because the login page post directly to the OAM Server.

    Hi
    I'm creating a custom login form and I need to capture which user was blocked if I get an OAM-5 error code. There is no parameter that specifies which user was filled and I can't capture it before because the login page post directly to the OAM Server.

  • OAM 10g - access to resource is not authorized, but no login form displayed

    Hi,
    Here's another one. Let's say I access some (protected) page which redirected me to login form page. Login form page immediately creates a obssocooke (for user obanonymous). Instead of logging in, I just change URL to my protected application (I actually did it because I changed my mind and not while purposely testing).
    I am getting "not authorized" error, instead of being redirected to login page. This is very confusing and bad user experience. The obssocookie appears to point to a valid session (I checked status in my app for user session and it appears to be ObUserSession.LOGGEDIN) but obviously the user anonymous is not authorized.
    So the question is - Is there any way OAM would not create a valid session cookie for anonymous user when I just load login form page? How do you guys solve this issue? Should I somehow use auth level?
    Thanks,
    Alex

    Hi Sagar,
    What you've described is exactly my intention. I want only users with auth level > 0 to access the protected application. Plus for the resource I define my form based login as default authentication scheme (which has level=1). I think that the issue is that I protect the application with my own access gate (not a web gate). And there I have the following logic:
    if(sso cookie is present and status of the session = "logged in") then validate whether user has access to the requested resource. So in my case the sso cookie is found, and belongs to anonymous user, session state = logged in, and I fail at authorization check. I think I need to implement some kind of auth level check, or compare actual user's auth scheme with the one required for the resource, right?
    Thanks,
    Alex

  • Login Form - pass parameters to remote site

    Hi,
    I need to create a login form on site A which passes parameters (username;company; password) to site B. The user will then be logged into site B in a new window.
    I guess this can be done in php on site A but my php skills are sketchy to say the least.
    What I understand I need to do is send a GET request to http://site_b/login.asp?username=XXXX&company=XXXX&password=XXXX where the XXXX values come from the form on site A.
    This is what I have (which is probably way out)...
    <form method="get" action="http://site_b/login.asp?username=$username&company=$company&password=$password">
            Username: <input type="text" name="username"  <?php {echo "value=''username";}?>   /><br />
            Company: <input type="text" name="company" <?php {echo "value='$company'";}?>/><br />
            Password: <input type="password" name="password" <?php {echo "value='$password'";}?>/><br />
        <input type="submit" value="Login" /><br />
        </form>
    ....of course it doesn't work.
    I would be grateful if someone could point me in the right direction, thanks.
    Mick

    Mick3496 wrote:
    bregent - they were very clear about the form fields:
    username   (alpha/numeric)
    company   (numeric only)
    password  (alpha/numeric)
    Note that the fields are all lower case.
    Are you saying the form code I posted should work?
    Mick
    It looks fine to me. For testing purposes you might want to change the password field to a text field so that you can be sure it is being populated correctly. And again, make sure that they are not checking referrers in their ASP script.

  • How to refresh the Expired Login Form on the onChange event of the password

    Hi,
    In the Expired Login Form I have places a custom label. My requirement is that on the onchange event of the password field the label color should change to orange if the entered password meets the password policy else red.
    I am trying the following code :
    Custom label:
    <Field name='Custom Label'>
    <Display class='Label'>
    <Property name='value' value='Custom label 1'/>
    <Property name='noNewRow'>
    <Boolean>true</Boolean>
    </Property>
    <Property name='color'>
    <block>
    <cond>
    <isTrue>
    <invoke name='checkStringQualityPolicy' class='com.waveset.ui.FormUtil'>
    <rule name='EndUserRuleLibrary:getCallerSession'/>
    <s>Default Password Policy</s>
    <invoke name='decryptToString'>
    <ref>resourceAccounts.password</ref>
    </invoke>
    <map/>
    <list/>
    <s>Configurator</s>
    </invoke>
    </isTrue>
    <s>orange</s>
    <s>red</s>
    </cond>
    </block>
    </Property>
    </Display>
    </Field>
    And on the password field i gave following in the onChange event:
    submitCommand(this.form, "Recalculate")
    But the above command is not refreshing the page. Instead on the onChange event its going back to the login.jsp.
    Any idea how to resolve the above issue.
    Thanks.

    I got it working as below but i dont know is this best practices?
    <%
        if(session.getAttribute("afterSet") != null){
             %>
        <div style="visibility:hidden">
          <iframe NAME="iframe1" src="/WebApplication2/TestController?fileDownload=test.pdf" WIDTH="40" HEIGHT="40"></iframe>
        </div>
        <%}       basically first time user visit the jsp page session attribute "afterSet" will be null so it wont create the hidden iframe tag . after it dispatched to the servlet controller and successfully processing the record it will set "afterSet" properties to some value and dispatch to itself
    after that it will popup/dialog box for user to save the pdf.
    this way the page already refreshes itself and wont have problem double clicking thing and so on

  • The "right" way to handle multiple devices, accounts and the cloud?

    Perhaps a bit premature, but I figure it's never too early to start planning. 
    Here's our current setup - I currently have four iDevices in the faily (three iPhones and one iPod Touch.  All are syncing to the same Mac Mini, albeit with different logins (and different iTunes store ids).  All four of these are kept in sync via Home Sharing so we have access to the music/apps/etc acquired by the others.
    Enter the iCloud - how does this fit in?  What's the *right* way to do this? 
    I can see two options:
    1)     Continue to utilize four iTunes store ids, sync them via Home Sharing and add four iClouds
         Advantages
              totally independent devices, users, etc.
         Disadvantages
              must pay for four "iTunes Match" services to access non-iTunes music on each of the four devices
              will iTunes-purchased music automaticaly sync to iCloud if it is shared via Home Sharing (or only by the original purchaser)?
    2)     Use one iTunes Store id for all iDevices
         Advantages
              single point of acquisition and distribution for all devices
         Disadvantages
              need to find a way to merge IDs (is this even possible?)
    Are there other advantages/disadvantages to these options?  Are there other options?  What's the easiest to set up and support?  Any other thoughts?
    Thanks in advance for your input.

    Well it seems like the first thing you should do is consolidate your iTunes libraries so that you don't have 4 copies of everything, one for each user logged in to your Mac Mini. How you do that is consolidate all 4 iTunes folders to one folder located in the /Users/Shared/ folder and update each of your iTunes to point to that folder accordingly. That way you have one iTunes library, only one copy of your media, but accessible from multiple users.
    One caveat is that if somebody is logged on and has iTunes open, you can't fast switch to another user and open iTunes. Apple made it so that only one user and one instance of iTunes can open a iTunes library at a time.
    For your iTunes match situation, it does sound like you would be much better off sharing a single Apple ID with one iTunes Match. For consolidating, make sure you have everything everybody has shared via Home Sharing to the main account you'd like to move over to, and then simply go to each device Settings, Store, and the sign out of the original Apple ID and logon using the shared main Apple ID. I just looked at it and the automatic downloading is already live in iOS! You can specify if you want to do music, apps, and books separately in case you may want to automatically download music but not apps or books.

  • What is the right  way to display a table in Java web dynpro using a node.

    Hi experts,
      I am trying to show a node of cardinality 0...n as a table in an adobe form in Java web dynpro. But its not showing it properly. Can anybody please tell me what is the right way to display a table on adobe form using a node of cardinality 0...n or 1...n in Java Webdynpro.  In ABAP webdynpro, we can drag and drop a node of cardianlity 0...n or 1...n to  show as a table and it works fine. Is the same possible in Java webdynpro also. Please help.
    Thanks and Regards.
    Vaibhav Tiwari.

    Please refer to my post.. you will get the answer
    Dynamic Table -  same data repeating in all rows
    Special care should be taken in designing the context for table attribute.
    The attribute type singletone also plays a important role. I have this doubt from the beginning when you have reported this problem for the first time but finally you marked it as solved so i thought there might be some other issues but again when you reported that again i did some analysis.
    Now coming to final solution :
    For designing a table in adobe interactive form you have consider following
    You have to design the view context upto three level, I am explaining you the properties
    PDFDataSource (Parent Level1) - Cardinality 1:1 - Signetone -True - This is assigned to datasource
    TableList (Parent Level2) - Cardinality (1:1) - Signetone -True
    TableWrapper(Parent Level3) - Cardinality (0:n) - Signetone -True
    TableData (Parent Level4) - Cardinality (0:1) - Signetone - false (This is the main point)
    Then under TableData value node, you have to put all your table attributes.
    This Value Node name can be anything but hierarchy should be same as I have mentioned above.
    Please try out these steps and get back to me if you have any doubt.

  • Help with Login Form (JSP DB Java Beans Session Tracking)

    Hi, I need some help with my login form.
    The design of my authetication system is as follows.
    1. Login.jsp sends login details to validation.jsp.
    2. Validation.jsp queries a DB against the parameters received.
    3. If the query result is good, I retrieve some information (login id, name, etc.) from the DB and store it into a Java Bean.
    4. The bean itself is referenced with the current session.
    5. Once all that's done, validation.jsp forwards to main.jsp.
    6. As a means to maintain state, I prefer to use url encoding instead of cookies for obvious reasons.I need some help from step 3 onwards please! Some code snippets will do as well!
    If you think this approach is not a good practice, pls let me know and advice on better practices!
    Thanks a lot!

    Alright,here is an example for you.
    Assume a case where you don't want to give access to any JSP View/HTML Page/Servlet/Backing Bean unless user logging system and let assume you are creating a View Object with the name.
    checkout an example (Assuming the filter is being applied to a pattern * which means when a resource is been accessed by webapplication using APP_URL the filter would be called)
    public doFilter(ServletRequest req,ServletResponse res,FilterChain chain){
         if(req instanceof HttpServletRequest){
                HttpServletRequest request = (HttpServletRequest) req;
                HttpSession session = request.getSession();
                String username = request.getParameter("username");
                String password = request.getParameter("password");
                String method = request.getMethod();
                String auth_type  = request.getAuthType();
                if(session.getAttribute("useInfoBean") != null)
                    request.getRequestDispatcher("/dashBoard").forward(req,res);
                else{
                        if(username != null && password != null && method.equaIsgnoreCase("POST") && (auth_type.equalsIgnoreCase("FORM_AUTH") ||  auth_type.equalsIgnoreCase("CLIENT_CERT_AUTH")) )
                             chain.doFilter(req,res);
                        else 
                          request.getRequestDispatcher("/Login.jsp").forward(req,res);
    }If carefully look at the code the autherization is given only if either user is already logged in or making an attempt to login in secured way.
    to know more insights about where these can used and how these can be used and how ?? the below links might help you.
    http://javaboutique.internet.com/tutorials/Servlet_Filters/
    http://e-docs.bea.com/wls/docs92/dvspisec/servlet.html
    http://livedocs.adobe.com/jrun/4/Programmers_Guide/filters3.htm
    http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters.html
    http://www.servlets.com/soapbox/filters.html
    http://www.onjava.com/pub/a/onjava/2001/05/10/servlet_filters.html
    and coming back to DAO Pattern hope the below link might help you.
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
    http://java.sun.com/blueprints/patterns/DAO.html
    http://www.javapractices.com/Topic66.cjp
    http://www.ibm.com/developerworks/java/library/j-dao/
    http://www.javaworld.com/javaworld/jw-03-2002/jw-0301-dao.html
    On the whole(:D) it is always a good practice to get back to Core Java/J2EE Patterns.and know answers to the question Why are they used & How do i implement them and where do i use it ??
    http://www.fluffycat.com/java-design-patterns/
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
    http://www.cmcrossroads.com/bradapp/javapats.html
    Hope that might help :)
    REGARDS,
    RaHuL

  • How to Develop a Login Form In Developer 6i

    Hi to everyone,
    I have developed some forms in Developer 6i. Now i want to deploy these Forms to client side. I want to design a Login Form for the end users to Use the Database Application. But the problem is, I don't know how to Develop a Login Form with the permission for the End Users to access the application.
    Also please tell me how to configure the FORMS Developer 6i to Run the Forms by the end users.
    Please help me to solve out the problem.
    Thank you in advance.

    If you are using ADFBC, the easiest way is
    - drop the data control as ADF form
    - add CreateInsert method binding to the pagedef
    - add an invokeAction for the createInsert with a refresh property set to renderModel so that an empty creation form will be shown on page load
    for insertion
    - Finally, add the commit action as button
    Sireesha

  • Additional field in login form

    I have a problem with customer authentication provider.
    I have successfully configured the SimplaSampleAuthentication provider
    in my realm.
    I have a form-based authentication with three parameters username, password and myParameterString (SSN etc..).
    My problem is passing the third parameter from LOGIN-FORM to my class
    which implements LoginModule.
    The weblogic default callbackHandler (in the loginModule initialize method) reads only username and password, it's right?
    If i write my callbackHandler server side in loginModule implementation,
    how can i read the username, password and
    myparameter for setting NameCallback, PasswordCallback and TextInputCallback?
    What can i do?
    Anyone can help me?

    at location
    http://e-docs.bea.com/wls/docs81/secintro/concepts.html#1055570
    you can read "..
    When used, there should be one TextInputCallback per additional form field, and the prompt string of each TextInputCallback must match the field name in the form. WebLogic Server only uses the TextInputCallback for form-based Web application login. " I have my TextInputCallback in method getCallbacks() of SimpleSampleLoginModuleImpl.java
    callbacks[2] = new TextInputCallback("j_app");
    and i have a field named "j_app" in login.jsp

  • Login form using Access... (in JSP )

    I have written the following code in JSP and connected to Access Database.
    Aftre i run the JSP from browser the Login form is displayed. but aftre i enter the "userid" and "password" nothing hapens. the application is STUCK !!
    <HTML>
    <HEAD>
    <TITLE> Login </TITLE>
    <script language="Javascript">
    function giveFocus()
         document.login.user.focus()
    function submitForm()
         document.login.submit()
    function resetForm()
         document.login.reset()
         document.passwd.reset()
         document.login.user.focus()
    </script>
    </HEAD>
    <BODY onload="giveFocus()">
    <form name="login" method="post" action="http://localhost//dcs/forward.jsp">
    <table border="0" cellpadding="2" cellspacing="0" width="80%"> <tr><td bgcolor="#ffffff" align="center">
    <table border="0" cellspacing="6" cellpadding="6" bgcolor="ffffff" width="80%" height="280">
    <tr bgcolor="#ADADAD">
    <td align="center"><font face="Verdana" SIZE="5">LOGIN FOR DDM</font><br>
    <table border=0 cellpadding=4 cellspacing=0>
    <tr> <td align="right">
    <P ALIGN="LEFT"><font face="Verdana" size="3"><BR>Please enter your ID and password
    <table border=0 cellpadding=10 cellspacing=10>
    <tr>
         <td align="right" ><font face="Verdana" size="4">User Id   :</font></td>
         <td><font face="arial" size="-1"><b></b></font><input name="user" type="text" length="9" maxlength="9"></td>
    </tr>
    <tr>
         <td align="right" ><font face="Verdana" size="4">Password  :</font></td>
         <td><input name="passwd" type="password" length="8" maxlength="8"></td>
    </tr>
    <tr>
         <td align=center valign=bottom>
         <input type="submit" name="login" value="     LOGIN     "  ></td>
    <td align=center valign=bottom><input type="button" name="cancel" value="   Cancel    " ></td>
    <td align=center valign=bottom><input type="submit"  name="chgp" value="Change Password"></td>
    </tr>
    </table>
    </table>
    </table>
    </table>
    </form>
    </body>
    </html> Kindly tell me wht is the problem with my code ? ?

    http://forum.java.sun.com/thread.jspa?threadID=599315&tstart=0
    Cross-post

  • Login form using Access(JSP)....

    I have written the following code in JSP and connected to Access Database.
    Aftre i run the JSP from browser the Login form is displayed. but aftre i enter the "userid" and "password" nothing hapens. the application is STUCK !!
    <HTML>
    <HEAD>
    <TITLE> Login </TITLE>
    <script language="Javascript">
    function giveFocus()
         document.login.user.focus()
    function submitForm()
         document.login.submit()
    function resetForm()
         document.login.reset()
         document.passwd.reset()
         document.login.user.focus()
    </script>
    </HEAD>
    <BODY onload="giveFocus()">
    <form name="login" method="post" action="http://localhost//dcs/forward.jsp">
    <table border="0" cellpadding="2" cellspacing="0" width="80%"> <tr><td bgcolor="#ffffff" align="center">
    <table border="0" cellspacing="6" cellpadding="6" bgcolor="ffffff" width="80%" height="280">
    <tr bgcolor="#ADADAD">
    <td align="center"><font face="Verdana" SIZE="5">LOGIN FOR DDM</font><br>
    <table border=0 cellpadding=4 cellspacing=0>
    <tr> <td align="right">
    <P ALIGN="LEFT"><font face="Verdana" size="3"><BR>Please enter your ID and password
    <table border=0 cellpadding=10 cellspacing=10>
    <tr>
         <td align="right" ><font face="Verdana" size="4">User Id   :</font></td>
         <td><font face="arial" size="-1"><b></b></font><input name="user" type="text" length="9" maxlength="9"></td>
    </tr>
    <tr>
         <td align="right" ><font face="Verdana" size="4">Password  :</font></td>
         <td><input name="passwd" type="password" length="8" maxlength="8"></td>
    </tr>
    <tr>
         <td align=center valign=bottom>
         <input type="submit" name="login" value="     LOGIN     "  ></td>
    <td align=center valign=bottom><input type="button" name="cancel" value="   Cancel    " ></td>
    <td align=center valign=bottom><input type="submit"  name="chgp" value="Change Password"></td>
    </tr>
    </table>
    </table>
    </table>
    </table>
    </form>
    </body>
    </html> Kindly tell me wht is the problem with the code ? ? ?

    the code for doing the connection between JSP and Access is as follows :
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection("jdbc:odbc:rupa","system","manager");rupa is DSN which i created for MS ACCESS
    is this ok?

  • Customize expired password login form

    Hi,
    On the expired login form I don't want to display the resource accounts table so the user can change only Lighthouse password if the password is expired.
    since expired login form uses User Form Library, I copied the default one and renamed it and modified the customized User Form Library accordingly. I managed to removed the resource accounts table so that it displays only 2 text boxes Confirm Password and Confirm New Password. After entering the password and when I click on the Change Password button it displays error "Must Select Atleast one resource account".
    The Change Password button is doing some validation, and I am not sure in which form library this button is defined. I checked in Change Password Form it contains buttons but I don't see any validation on these buttons.
    Where exactly the Change Password button is defined?
    Is there any other way to customize the expire login form?
    Any ideas please..
    Thanks
    Edited by: idmus on May 19, 2010 1:24 PM

    What you describe should work, you just need to simulate the user selecting one or more resources.
    So somewhere on the form put code like:
        <Field name='resourceAccounts.currentResourceAccounts[RESOURCE].selected'>
            <Expansion>
                <s>true</s>
            </Expansion>
        </Field>This acts as if the user has selected a resource. Kind of a weird way to do it, but there you go.
    Edited by: etech on May 24, 2010 4:38 PM
    Edited by: etech on May 24, 2010 4:39 PM

  • Login form of Discoverer 10g Plus/Viewer

    Hi all,
    can you tell me if there is a way to get the login form of Discoverer 10g Plus/Viewer to remember the last login credentials (except password) like the Desktop version do? Have I missed a setting in preferences file or AS Control?
    OK I can create an own HTML page which looks exactly the same as the login page and saves the values in a cookie but time is money and I think this feature should be solved by Oracle itself.
    Thanks in advance,
    Uwe

    Hi all,
    can you tell me if there is a way to get the login form of Discoverer 10g Plus/Viewer to remember the last login credentials (except password) like the Desktop version do? Have I missed a setting in preferences file or AS Control?
    OK I can create an own HTML page which looks exactly the same as the login page and saves the values in a cookie but time is money and I think this feature should be solved by Oracle itself.
    Thanks in advance,
    Uwe

Maybe you are looking for

  • How can I improve optimizers poor cardinality estimates?

    Hi all, I have a query that is taking too long and it looks like the cardinality estimates are way off. It seems particulary bas with the hash joins and I don't know how to get the optimizer to get a better estimate. The tables in the query were last

  • BAPI FOR DELETE BILLING DOCUMENT

    Hi to all, do you know a BAPI to cancel a billing document? I have tried the BAPI_BILLINGDOC_CANCEL1 but it doesn't work. Thanks!! Silvia

  • PO Archived but Delivery Still Open

    Hi, I have one peculiar issue, one of my PO is Archived but its related Delivery is still open. Now when i run VL06, these deliveries are appearing but i am not able to delete these deliveries as i am not able to go in to VL02n. Please let me know if

  • From Billing plan invoice raised automatically

    Hi, We create a sales order, copy a billing plan from project plan financial milestones, then as soon as we confirm an activity of financial milestone in project plan automatically invoice get raised in the system and shows in the vf04 finance. But n

  • When moving from a list of threads view to a thread would be nice to jump to last thread read.

    When moving from a list of threads being viewed to a thread, it would be nice to jump to last thread read or first unread thread. Sometimes the threads get rather long.  Sometimes I haven't read a thread in awhile & I forget where I have left off rea