I believe what you want to do, is to start with using 'cas-overlay-template', checkout branch 4.1
I have done similar, overriding a single class, using CAS version 4.1.3
From there, you modify pom.xml to your needs, using mvnw to build the war file.
To override, simply add your *.java file to the directory in src/main/java/*
In your case, add the UsernamePasswordCredential.java file to the directory src/main/java/org/jasig/cas/authentication/
Then build and deploy war file.
I think this is the correct way.