Unable to customize UsernamePasswordCredential class in CAS 7.2.4
133 views
Skip to first unread message
Prakash Thapa
unread,
Sep 2, 2025, 7:03:28 AM (3 days ago) Sep 2
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CAS Community
I am trying to customize the UsernamePasswordCredential class by extending it from the CAS default class. However I am unable to proceed further as I am getting typecast issue in the doAuthentication() of AbstractUsernamePasswordAuthenticationHandler class. I have customized AbstractUsernamePasswordAuthenticationHandler to support the new Custom UsernamePasswordCredential class.
Block of Code:
public abstract class CustomAbstractUsernamePasswordAuthenticationHandler extends AbstractUsernamePasswordAuthenticationHandler {
@Override protected final AuthenticationHandlerExecutionResult doAuthentication(Credential credential, final Service service) throws Throwable { final CustomUsernamePasswordCredential originalUserPass = (CustomUsernamePasswordCredential) credential; ...... ...... } }
Error Message:
Cannot cast 'org.apereo.cas.authentication.handler.support.CustomUsernamePasswordCredential' to 'org.apereo.cas.authentication.handler.support.CustomUsernamePasswordCredential'
Prakash Thapa
unread,
Sep 2, 2025, 8:11:10 AM (3 days ago) Sep 2
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CAS Community, Ray Bon
Hi Ray,
The credential instanceof CustomUsernamePasswordCredential returns false. But the credential.getClass() returns the same class i.e. CustomUsernamePasswordCredential, to which I am trying to typecast.
Ray Bon
unread,
Sep 3, 2025, 3:25:10 PM (2 days ago) Sep 3
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CAS Community
Prakash,
Do the full path hierarchies match?
That is, is it possible there is another CustomUsernamePasswordCredential class?
This strange casting problem can occur with multiple class loaders (cast acting in only one loader). How are you running cas?
Ray
From: Prakash Thapa <thapaprak...@gmail.com> Sent: September 2, 2025 21:01 To: CAS Community <cas-...@apereo.org> Cc: Ray Bon <rb...@uvic.ca> Subject: Re: [cas-user] Unable to customize UsernamePasswordCredential class in CAS 7.2.4