Dynamic error messages

64 views
Skip to first unread message

Nicolás

unread,
May 6, 2016, 5:47:51 PM5/6/16
to CAS Community
Hello all,

I need to show a dynamic/custom error message when login fail, currently we are showing the default one: authenticationFailure.AccountNotFoundException=

My dynamic login message comes from my own custom UserPasswordAuthenticationHandler


Example:

       @Override
       protected HandlerResult authenticateUsernamePasswordInternal(UsernamePasswordCredential transformedCredential) throwsGeneralSecurityException, PreventedException {
             try {
                    ……………..

                    } else {

                           throw newAccountNotFoundException(

                                         document.getElementsByTagName("mensaje_usuario").item(0).getFirstChild().getNodeValue());
                    }
                                               ……………..

I'm newbie on with CAS, anybody has an example to do that?

Can anybody help me, please?

Best regards

Dmitriy Kopylenko

unread,
May 6, 2016, 6:07:51 PM5/6/16
to Nicolás, CAS Community
Currently not possible or straightforward to achieve. In CAS v5 (available in SNAPSHOTs versions already) custom error messages based on the custom authentication exceptions would be a trivial feature available out of the box: 

--
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 cas-user+u...@apereo.org.
To post to this group, send email to cas-...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/ef01c846-aa58-4b0a-bf7f-e7db90624698%40apereo.org.
For more options, visit https://groups.google.com/a/apereo.org/d/optout.
https://jasig.github.io/cas/development/installation/Webflow-Customization-Exceptions.html

Best,
D.

Dmitriy Kopylenko

unread,
May 6, 2016, 6:08:55 PM5/6/16
to Nicolás, CAS Community

Nicolás Moreira

unread,
May 6, 2016, 6:50:41 PM5/6/16
to Dmitriy Kopylenko, CAS Community

Perfect. Thanks!

Reply all
Reply to author
Forward
0 new messages