protected int authenticateInternal(Context context, String username, String password, String realm, HttpServletRequest request, boolean implicitOnly) { // better is lowest, so start with the highest. int bestRet = AuthenticationMethod.BAD_ARGS; // return on first success, otherwise "best" outcome. for (AuthenticationMethod aMethodStack : getAuthenticationMethodStack()) { if (!implicitOnly || aMethodStack.isImplicit()) { int ret = 0; try { ret = aMethodStack.authenticate(context, username, password, realm, request); } catch (SQLException e) { ret = AuthenticationMethod.NO_SUCH_USER; } if (ret == AuthenticationMethod.SUCCESS) { updateLastActiveDate(context); return ret; } if (ret < bestRet) { bestRet = ret; } } } return bestRet; }