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;
}