Monday, December 18, 2006

bypass authentication in local ofbiz development environment

I must spend 1 hour per day logging into my local ofbiz setup. I never want to be asked again.

To get around this, I edited LoginWorker.java and hard-coded the username and password.

Hard code the credentials in both the login() method and the checkLogin() method to totally bypass the login screen.

hard-code only in the login method and the login screen will still appear, but will accept blank credentials, which might be what you want when testing for application flow.

Code for checkLogin() method:
if (userLogin == null) {
// added to circumvent login:
username = "admin";
password = "ofbiz";
....


Code for login() method:
// comment out existing username and password definition:
// String username = request.getParameter("USERNAME");
// String password = request.getParameter("PASSWORD");
String username = "admin";
String password = "ofbiz";

rebuild ofbiz and enjoy the extra seconds!