DBPrism Servlet Engine
Slide 20 of 25
Common usage (wwwIndex.sqlj fragment):

/**
 * authorize function used by perPackage authorization mode
 * sets user's credentials with the username/password
 * entered by the browser pop up
 */
  public static int authorize(
                          // Uncomment this line if you are using Oracle Lite
                          //Connection cn
                          )
  {
    String username,password;
    username = JowaSec.GETUSERID();
    password = JowaSec.GETPASSWORD();
    JowaSec.SETPROTECTIONREALM("Enter user name and password for the CMS");
    wwwIndex thisPage =
          new wwwIndex();
    return thisPage.authorize(username,password);
  }

  private int authorize(String usr, String pass
                          // Uncomment this line if you are using Oracle Lite
                          //Connection cn
                          )
  {
    // Sanity checks
    if (usr==null || pass==null)
      return 0;
    try { // checks user's credential
      #sql { call cms_ctx.set_user_ctx( :usr, :pass )};
    } catch (SQLException sqe) {
      // problem when validating user's credential
      return 0;
    }
    // everything ok
    return 1;
  }

Notes

next in this section Packages - Context (cont.)

This work is licensed under a Creative Commons License . Creative Commons License
(C) 1999-2008 - DBPrism ~ DBPrism CMS | Marcelo F. Ochoa | TANDIL ~ Argentina | 2008-10-07T20:18:03
DBPrism at SourceForgeBuilt with Cocoon2