What you can do is set up different authentication methods for different courses. For the courses that need local authentication, you can add the following to course.conf:
$authen{user_module} = {
"*" => "WeBWorK::Authen::Basic_TheLastOption",
};
I don't see a way to use both types of authentication in the same course that doesn't involve making major modifications to the WeBWorK CAS code.