Need Sample Code for Form-based Authentication

Hello.
I'm trying to setup Form-based Authentication. I keep reading the same (limited) documentation about putting this in your server's .xml files:
<form method="POST" action="j_security_check">
        <input type="text" name="j_username">
        <input type="password" name="j_password">
</form>I don't even have a web.xml or sun-web.xml file. I cannot find examples of Sun One WS either.
Any sample coding - including yoru web.xml, sun-web.xml - would be greatly appeciated.
Thanks!
Sam

Refer http://docs.sun.com/source/817-1833-10/pwadeply.html#wp40541

Similar Messages

  • Configuring tomcat for form based authentication-help badly needed

    hi , i want to have form based or some other way of authentication for the users comming to my site , i have access only to web.xml , but in tomcat documentations its giveni need to change server.xml and tomcat-user.xml , can i make these changes on web.xml to implement it or please tell me way out of this please , i tried even jguard but it needs changes in jvm which also not into my access

    Hi,
    I'm a little confused. You wanted to know how to configure Tomcat for form based authentication, and I sent you an article on how to do that. Is there something more you need from me? You had offered 10 duke dollars for this post, and if there is more I can do I will help for the remaining amount, but I can't help you getting access to the Tomcat *.xml file.

  • Manager password in tomcat for form based authentication

    Hi all,
    I have a jsp using form based authentication.I have set up the web.xml,server.xml and created my database with the various users and roles but when i try to deploy the application,it as for the manger username/password and when i enter what i have in the database it refuses to connect.
    Anyone has any idea what i might be doiing wrong?
    Thans in advance

    Hi,
    I'm a little confused. You wanted to know how to configure Tomcat for form based authentication, and I sent you an article on how to do that. Is there something more you need from me? You had offered 10 duke dollars for this post, and if there is more I can do I will help for the remaining amount, but I can't help you getting access to the Tomcat *.xml file.

  • Updating password for Form Based authentication database using code

    Hi,
    We have created FBA(Form Based authentication) for SP2010. We are storing all the usernames and Passwords in FBA database. If any user changes their password needs to be save in FBA Database with latest password.
    can any one suggest me how to do this one.....
    Thanks....

    https://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.changepassword(v=vs.110).aspx
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Window for Form-Based Authentication in web.xml for JAZN.

    Whether probably to make so that the form-authorization in Form-Based Authentication in web.xml for JAZN opened in a separate window?
    Thanks,
    Alexandre

    this is what i have so far...in my web.xml deployment descriptor
    am using Jbuilder 6 with tomcat.....if i run it from IDE, will the featuresi have added to the web.xml file...eg Error page be used ...or only when i deplo the app ???
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <display-name>Java Pet Store</display-name>
    <description>Web Application for Reseach</description>
    <session-config>
    <session-timeout>54</session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>Default.jsp</welcome-file>
    </welcome-file-list>
    <error-page>
    <error-code>500</error-code>
    <location>/</location>
    </error-page>
    <taglib>
    <taglib-uri>PetStoreTagLib</taglib-uri>
    <taglib-location>/WEB-INF/PetStoreTagLib.tld</taglib-location>
    </taglib>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>SecurePages</web-resource-name>
    <url-pattern>Checkout.jsp</url-pattern>
    <url-pattern>OrderList.jsp</url-pattern>
    <url-pattern>OrderDetails.jsp</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>LoggedInUser</role-name>
    </auth-constraint>
    <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/Login.jsp</form-login-page>
    <form-error-page>/ErrorPage.jsp</form-error-page>
    </form-login-config>
    </login-config>
    <security-role>
    <description>Logged In User</description>
    <role-name>LoggedInUser</role-name>
    </security-role>
    </web-app>
    in setting up the tomcat-users.xml file am i to add table to my database, to relate the user to the role.......

  • Need sample code for Using BADI ME_PROCESS_REQ_CUST

    Dear all,
    Initially my requirement is to Validate the Document Type of Purchase Request ion as per material.
    I have created a implementation for BADI : ME_PROCESS_REQ_CUST .
    im new to OOPS-ABAP, so pls send *sample code for how to use these methods PROCESS_ITEM,
    like declarations, assignment of data into internal table  for further validation*.
    Regards,
    NIranjan.G

    Hi,
    get the item data ....
         *DATA : lt_item TYPE MEREQ_ITEM,
                       ls_item liek line of it_item*
             CALL METHOD im_item->GET_DATA
               RECEIVING
                 RE_DATA = lt_item .
    you will get the data in lt_item.. table
    Thanks,
    Shailaja Ainala.

  • Need Sample Code for Vendor creation using JAVA API

    Hi,
    I have a scenario like Vendor creation using <b>Java API</b>.
    1.I have Vendors (Main) Table.
    2.I have <b>look up</b> tables like Account Group.
    3.Also <b>Qualifier table</b>(Phone numbers) too.
    Could you please give me the sample code which helps me to create Vendor records using Java API?
    <b>I need Code samples which should cover all of the above scenario.</b>
    <b>Marks will be given for the relevent answers.</b>
    Best Regards
    PK Devaraj

    Hi Devraj,
    I hope the below code might solve all your problem:-
    //Adding Qualified field
    //Creating empty record in Qualifed table 
    //Adding No Qualifiers
    Record qualified_record = RecordFactory.createEmptyRecord(new TableId(<TableId>));
    try {
    qualified_record.setFieldValue(new FieldId(<fieldId of NoQualifier), new StringValue(<StringValue>));//Adding No Qualifier
    catch (IllegalArgumentException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    catch (MdmValueTypeException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    //Creating Record in Qualified table
    CreateRecordCommand create_command = new CreateRecordCommand(connections);
    create_command.setSession(sessionId);
    create_command.setRecord(qualified_record);
    try
    create_command.execute();
    catch(Exception e)
    System.out.println(e.toString());
    RecordId record_id = create_command.getRecord().getId();
    //Adding the new record to Qualifed Lookup value and setting the Yes Qualifiers
    QualifiedLookupValue lookup_value = new QualifiedLookupValue();
    int link = lookup_value.createQualifiedLink(new QualifiedLinkValue(record_id));
    //Adding Yes Qualifiers
    lookup_value.setQualifierFieldValue(0 , new FieldId(<FieldID of Yes Qualifier>) , new StringValue(<StringValue>));
    //Now adding LookUP values
    //Fetch the RecordID of the value selected by user using the following function
    public RecordId getRecordID(ConnectionPool connections , String sessionID , String value , String Fieldid , String tableid)
    ResultDefinition rsd = new ResultDefinition(new TableId(tableid));
    rsd.addSelectField(new FieldId(Fieldid));
    StringValue [] val = new StringValue[1];
    val[0] = new StringValue(value);
    RetrieveRecordsByValueCommand val_command = new RetrieveRecordsByValueCommand(connections);
    val_command.setSession(sessionID);
    val_command.setResultDefinition(rsd);
    val_command.setFieldId(new FieldId(Fieldid));
    val_command.setFieldValues(val);
    try
         val_command.execute();
    catch(Exception e)
    RecordResultSet result_set = val_command.getRecords();
    RecordId id = null;
    if(result_set.getCount()>0)
         for(int i = 0 ; i < result_set.getCount() ; i++)
         id = result_set.getRecord(i).getId();     
    return id;
    //Finally creating the record in Main table
    com.sap.mdm.data.Record empty_record = RecordFactory.createEmptyRecord(new TableId("T1"));
    try {
         empty_record.setFieldValue(new FieldId(<FieldId of text field in Main table>),new StringValue(<StringValue>));
         empty_record.setFieldValue(new FieldId(<FieldId of lookup field in Main table>), new LookupValue(<RecordID of the value retrieved using the above getRecordID function>));
    empty_record.setFieldValue(new FieldId(<FieldId of Qualified field in Main table>), new QualifiedLookupValue(<lookup_value>));//QualifiedLookUp  value Retrieved above
    } catch (IllegalArgumentException e1) {
    // TODO Auto-generated catch block
         e1.printStackTrace();
    } catch (MdmValueTypeException e1) {
         // TODO Auto-generated catch block
         e1.printStackTrace();
    //Actually creating the record in Main table
    CreateRecordCommand create_main_command = new CreateRecordCommand(connections);
    create_main_command.setSession(sessionId);
    create_main_command.setRecord(empty_record);
    try
         create_main_command.execute();
    catch(Exception e)
         System.out.println(e.toString());
    Thanks
    Namrata

  • Need sample code for component programming

    I see samples page here:
    /docs/DOC-8061#61
    want to download "Web Dynpro Component Interface Definitions in Practice" sample, but only empty folders structure provided in download link.
    ("zip file" link )
    How to get full sample project according whay is written on this page?
    May be someone have this or like this sample ?
    (with some description than)
    I need to develop such type of application
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f07c3625-c971-2910-3a9c-ce131487f82c
    components, component interface usage, also for GP, but do not see code samples for this.
    Can you help with it?
    thanks
    Edited by: Vladimir Grigoryev on Aug 7, 2008 10:01 AM

    Hallo Vladimir,
    sorry me, but I have absolutely no idea what your problem really is. I provided you with all required information to download, import, build, deploy and run my Web Dynpro Java Sample application on "Component Interface Definitions in Practice". This material is enriched with in-depth technical documentation on the underlying concepts (you already linked to all these resources in the initial message of this thread; your second link is pointing to my powerpoint presentation on this sampel) to answer your last message about "but code is not sufficient".
    PLEASE read the [Readme.txt|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0e4528f-c471-2910-66a0-dd459f975dc2] file to successfully install the local Web Dynpro DCs comprising the sample application metadata.
    NOTE: This sample is based on SAP NetWeaver 7.0, NOT on NetWeaver CE 7.1!!!
    I do not want to repeat all my descriptions in this mail thread.
    Regards, Bertram

  • Need sample code for using BCONTACT object in ABAP

    Hello All,
    This is going to be my very first venture into the realm of OO / ABAP programming. And what venture it will be! I've been assigned the task of modifying an ABAP program so that it uses the BCONTACT object in order to create a contact.
    Now, I need to see how it is done in other programs. What data elements or attributes do I need to set? How do I set or populate them? Anything else that goes with it?
    So, any idea where I can find such code?
    Your help is greatly appreciated.

    After much back and forth the following code did the job for me. Obviously, you have to make sure that you have the right objrole and objtype and other values which relate to your screen elements (whatever screen you are using). Hope this helps.
    *&      Form  create contact
    FORM create_contact.
            contact creation
      REFRESH t_objects.
      w_objects-objrole      = 'DEFAULT'.              
      w_objects-OBJTYPE      = 'ISUSMORDER'.
    w_objects-objtype      = 'BUS2007'.
      w_objects-objkey       = t_zisu_let_ot-auftrag.
      APPEND w_objects       TO t_objects.
      w_bcontd-ctype         = '003'.
      w_bcontd-cclass        = '1800'.
      w_bcontd-activity      = '0004'.
      w_bcontd-f_coming      = '2'.
      w_bcontd-origin        = '1'.
      w_bcontd-addinfo       = '  '.
      w_bcontd-priority      = '01'.
      w_bcontd-custinfo      = '  '.
      w_auto-bcontd          = w_bcontd.
      w_auto-bcontd_use      = 'X'.
      w_auto-bcontd_okcode   = 'SAVE'.
      w_auto-iobjects        = t_objects.
      CALL FUNCTION 'BCONTACT_CREATE'
        EXPORTING
          x_upd_online    = 'X'
          x_no_dialog     = 'X'
          x_auto          = w_auto
          x_prgcontext    = sy-repid
          x_subcontext    = ' '
          x_bpcconfig     = ' '
          x_partner       = w_partner
          x_altpartner    = ' '
          x_pcategory     = ' '
        IMPORTING
          y_new_bpcontact = w_bpcontact
        EXCEPTIONS
          existing        = 1
          foreign_lock    = 2
          number_error    = 3
          general_fault   = 4
          input_error     = 5
          not_authorized  = 6
          OTHERS          = 7.
      IF sy-subrc = 0.
        WRITE: / 'Contact ', w_bpcontact, 'a été créé'.
      ELSE.
        CASE sy-subrc.
          WHEN 1.
            WRITE: / '…’.
          WHEN 2.
            WRITE: / '…’.
          WHEN 3.
          WHEN 4.
          WHEN 5.
          WHEN 6.
          WHEN 7.
          WHEN OTHERS.
        ENDCASE.
      ENDIF.
      COMMIT WORK.
    ENDFORM.                    " create_contact

  • J_security_check in form-based authentication - not checking for blank passwords

    I am using the LDAP Security Realm to authenticate against an iPlanet
    Directory Server. All works as expected when a user-id and password
    are entered for form-based authentication.
    However, when a userid is entered but no password, j_security_check
    logs the user in successfully. Aparently, this is correct LDAP
    behaviour as anonymous login to the LDAP server is permitted. It seems
    that the j_security_check servlet should check for blank passwords
    before trying to authenticate against the LDAP server and fail
    authentication if this is the case.
    Has anyone else experienced this problem?

    Hi Brian,
    I do not believe it is j_security_check's job to check for blank
    passwords.
    In many security realms, it is "legal" for a user to have a blank
    password. j_security_check forwards whatever password was entered so that
    even users with blank passwords can be authenticated by the realm on the
    backend. For this reason I believe that j_security_check is "doing the
    right thing" by just forwarding whatever is presented to it, rather than
    having its own logic. It is best if j_security_check just acts as a very
    dumb middle man.
    If behavior was altered, it is true that your particular problem would be
    solved, but then many other people would have a problem with their users
    with blank passwords authenticating properly...
    Try looking into how to disable anonymous logins on the LDAP end of
    things. Hope this helps.
    Cheers,
    Joe Jerry
    brian wrote:
    I am using the LDAP Security Realm to authenticate against an iPlanet
    Directory Server. All works as expected when a user-id and password
    are entered for form-based authentication.
    However, when a userid is entered but no password, j_security_check
    logs the user in successfully. Aparently, this is correct LDAP
    behaviour as anonymous login to the LDAP server is permitted. It seems
    that the j_security_check servlet should check for blank passwords
    before trying to authenticate against the LDAP server and fail
    authentication if this is the case.
    Has anyone else experienced this problem?

  • Any one having idea on Form based authentication ?

    Hi ,
    I need help on configuring web.xml for form based authentication .
    ie if any one clicks or attempts to access any page in application it should redirect to login page.
    Thanks.

    there is no need to write a servlet filter for this any more. It is part of the servlet spec. Web containers should provide it as a matter of course. It will automatically handle the popping up of the login page, and continue to the destination on successful login, all automagically.
    A quick search on Google provides several articles and examples on this very subject. Try http://www.onjava.com/pub/a/onjava/2002/06/12/form.html
    Heres a quick example of web.xml config taken from that article:
    <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/fail_login.html</form-error-page>
    </form-login-config>
    </login-config>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>AdminPages</web-resource-name>
    <description> accessible by authorised users </description>
    <url-pattern>/admin/*</url-pattern>
    <http-method>GET</http-method>
    </web-resource-collection>
    <auth-constraint>
    <description>These are the roles who have access</description>
    <role-name>manager</role-name>
    </auth-constraint>
    </security-constraint>Cheers,
    evnafets

  • Does weblogic 5.1 support form based authentication of servlets

              Hi,
              Does weblogic 5.1 support form based authentication?
              If yes is any setup need to be done?
              <HTML>
              <BODY>
              This is a test for form based authentication
              <FORM action="j_security_check">
              <input type="j_name" value="hi">
              <input type="j_password" value="hi">
                   <input type="submit" value="hi">
              </FORM>
              </BODY>
              </HTML>
              If i submit a form to j_security_check, weblogic throws "404 file not found error".
              thanks
              

              you must add this to yor web.xml file:
              <login-config>
              <auth-method>FORM</auth-method>
              <realm-name>LDAPRealm</realm-name>
              <form-login-config>
              <form-login-page>/logon.jsp</form-login-page>
              <form-error-page>/logonerror.jsp</form-error-page>
              </form-login-config>
              </login-config>
              greetings
              "Cameron Purdy" <[email protected]> wrote:
              >Yes. You have to specify in web.xml per spec.
              >
              >Peace,
              >
              >--
              >Cameron Purdy
              >Tangosol, Inc.
              >http://www.tangosol.com
              >+1.617.623.5782
              >WebLogic Consulting Available
              >
              >
              >"antony" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >>
              >> Hi,
              >>
              >> Does weblogic 5.1 support form based authentication?
              >> If yes is any setup need to be done?
              >>
              >> <HTML>
              >> <BODY>
              >> This is a test for form based authentication
              >> <FORM action="j_security_check">
              >> <input type="j_name" value="hi">
              >> <input type="j_password" value="hi">
              >> <input type="submit" value="hi">
              >> </FORM>
              >> </BODY>
              >> </HTML>
              >>
              >> If i submit a form to j_security_check, weblogic throws "404 file not
              >found error".
              >>
              >> thanks
              >>
              >
              >
              

  • FORM based authentication in UME

    in UME for FORM based authentication we have to specify rsource in terms of <u>html login page or JSP......</u>
    my problem is can i use <u>webdynpro screen</u> for a FORM based authentication in UME.
    i want to create a dynpro project that will have its own login screen base on UME insted of the default WAS login  screen.

    hi snehal kendre,
    create dynpro project in that u use UME api
    like than u can code
    IUserAccount accounts[] = null;
              response.write("<br>*** LOGIN ACCOUNTS:");
              try {
                   accounts = user.getUserAccounts();
              } catch (UMException e) {
                   response.write("<br>Error getting accounts: "
                        + e.getLocalizedMessage());
              if (accounts != null) {
                   response.write("<br>Number of Login Accounts: " + accounts.length);
                   for (int i = 0; i < accounts.length; i++) {
                        response.write(
                             "<br>** Login ID #"    + i
                                  + ": LogonUID="    + accounts<i>.getLogonUid()
                                  + ", AssignedUID=" + accounts<i>.getAssignedUserID());
                        response.write(
                             "<br>Last Login: "
                                  + accounts<i>.getLastSuccessfulLogonDate().toString());
                        response.write(
                             "<br># Logins: " + accounts<i>.getSuccessfulLogonCounts());
    then u can get login based UME
    Jagadish

  • Error re-logging in after session timeout using form-based authentication

    Hello,
    We have a web app configured for form-based authentication. When the session times out, we're redirected to our login page as expected. However, after re-logging in, we are not redirected to the desired page (e.g., /faces/OurMainPage.jspx) but to /afr/page_lev_idle.gif.
    Do we have to do anything special for session timeouts?
    Thanks,
    Rico

    Some extra information that might help:
    After re-logging in and we're in /afr/page_lev_idle.gif, we hit the browser Back button (showing the login page again) and then hit the browser Refresh/Reload button and voila we're at the page we expect to be.
    Rico

  • Form based authentication very slow

    Hi,
    We are facing problem in form based login authentication. Any application having a form based authentication is taking too much time.
    We are running SAP J2EE Server 6.40 with SP16.
    The database and the J2EE server are in a single machine.
    The basic authentication does not show up any problem.
    The form based takes up too much amount of time but does go through.
    What can be the problem?
    Regards,
    Ameya

    Hi Ameya,
    if form based authentication is working fine for you then please send me complete step by step procedure or any document if you have any as i configured everything required for form based authentication and when i provide any of the .jsp page in the url i am not getting the login page. please help me as soon as possible

Maybe you are looking for

  • Connection TimeOut in Websphere App Server.

    Hi, I am using JSF with JNDI and WebSphere to get query details. We have set the Connection Pooling Timeout in JNDI DataSource settings in WebSphere to 60 minutes. I have attached the Exception Stack Trace for your verification. This is a very seriou

  • Unable to sort the content of the jTable

    Hi all , I m using this code for sorting in the Jtable JTable table = new JTable(new MyTable());         table.setPreferredScrollableViewportSize(new Dimension(500,500));         table.setFillsViewportHeight(true);         table.setAutoCreateRowSorte

  • Anybody tried re writing the resource files in chinese ?

    Hello, I am making an existing application multilingual.. now the only part remaining is translation the resources folder into chinese.. simplified.. I have noticed that.., even if i save the file in unicode or UTF-8 format contianing only plain engl

  • How and where to find Adobe Updater in my PC?

    Hi ALL! How and where to find Adobe Updater in my PC? Thanks, Ozzy

  • How to Estimate Profile Values

    Hi Experts, For a particular Senario I need to Estimate the Value of the Particular Profile I have Created. Can I know How to go abt It. From Carry Out Mass Corrections , if I select Extrapolate Or Intrapolate Option it is Giving an Error. Thanx & Re