CAS 4.1.x, how to override class in cas-server-core?

18 views
Skip to first unread message

Yan Zhou

unread,
Jul 24, 2019, 9:55:29 AM7/24/19
to CAS Community
Hello,

CAS 4.1.x, I want to override org.jasig.cas.authentication.UsernamePasswordCredential so that I can customize the validation logic.

This class is part of cas-server-core jar, If I simply recreate this class in my overlay, I end up with two classes, one in WEB-INF/classes and the other WEB-INF/lib/cas-server-core.jar. On tomcat8, it is the one in cas-server-core.jar that is loaded, so that does not work for me. 

If I create a derived class extending org.jasig.cas.authentication.UsernamePasswordCredential, it is a bit odd, because the data fields  username and password are private members. 

Any idea?

Thx!
Yan

Warren White

unread,
Aug 12, 2019, 5:33:32 PM8/12/19
to CAS Community
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.
Reply all
Reply to author
Forward
0 new messages