Prakash,

This sounds more like a java problem.
You could check with instanceOf before casting.

Ray
________________________________
From: [email protected] <[email protected]> on behalf of Prakash Thapa 
<[email protected]>
Sent: September 1, 2025 22:14
To: CAS Community <[email protected]>
Subject: [cas-user] Unable to customize UsernamePasswordCredential class in CAS 
7.2.4

You don't often get email from [email protected]. Learn why this is 
important<https://aka.ms/LearnAboutSenderIdentification>
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'


--
- Website: https://apereo.github.io/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected]<mailto:[email protected]>.
To view this discussion visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/70db0edb-2b5e-4f5d-91b4-f603acae3b01n%40apereo.org<https://groups.google.com/a/apereo.org/d/msgid/cas-user/70db0edb-2b5e-4f5d-91b4-f603acae3b01n%40apereo.org?utm_medium=email&utm_source=footer>.

-- 
- Website: https://apereo.github.io/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/YQBP288MB00811C04BF7F7D31F6335045CE06A%40YQBP288MB0081.CANP288.PROD.OUTLOOK.COM.

Reply via email to