[cas-dev] [cas] Java CAS client and error 500 when validating ticket
Romain BOURGUE
romain.bourgue at agriculture.gouv.fr
Wed May 21 09:33:27 EDT 2008
Matthieu,
It's a quite common problem : when you refresh your page after having restarted
your server, your session is blank : you're not authenticated anymore on your
application. But, as you refresh the url with the ticket, you're *re*presenting
the older ticket you used to access your application in the first time.
As a ticket is only valid once, you get this exception.
What you could do when you get this exception is to resfresh (or redirect to)
the url without the /ticket/ parameter. Then, the user will come back with a
fresh ticket from your cas server.
Romain
Matthieu MARC a écrit :
> Hi all,
>
> I am playing with Java CAS client in a J2EE web application (with tomcat).
>
> I am using the basic CASFilter configuration
> (http://www.ja-sig.org/products/cas/client/javaclient/index.html)
>
> It is working well, user is authenticated against CAS server, and I can
> retreive his username from session.
>
> But :-)
>
> I am using eclipse for developing, and when I change a class, tomcat is
> restarting. It is not a problem for me but when I refresh my web browser
> which pointed to my web application, I get an error 500.
>
> example url : http://dev.com/page?ticket=xxxxxx
>
> and the error is :
>
> avax.servlet.ServletException: edu.yale.its.tp.cas.client.CASAuthenticationException: Unable to validate ProxyTicketValidator [[edu.yale.its.tp.cas.client.ProxyTicketValidator proxyList=[null] [edu.yale.its.tp.cas.client.ServiceTicketValidator casValidateUrl=[https://cas-b.ensam.eu/cas/serviceValidate] ticket=[ST-95-ma7fcuthRZYjiXFm65we-cas] service=[http%3A%2F%2Flocalhost%3A8080%2Fholidays%2FdoLogin.action] errorCode=[INVALID_TICKET] errorMessage=[le ticket 'ST-95-ma7fcuthRZYjiXFm65we-cas' est inconnu] renew=false entireResponse=[<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
> <cas:authenticationFailure code='INVALID_TICKET'>
> le ticket 'ST-95-ma7fcuthRZYjiXFm65we-cas' est inconnu
> </cas:authenticationFailure>
> </cas:serviceResponse>
>
>
> I read on a forum that the problem is maybe because It is trying to
> validate the ticket twice.
>
> My question is : what to do to not have this error page ? must I catch
> the exception (how?) and destroy the ticket ? must I catch the exception
> and redirect the user to CAS server to authenticate again ?
>
> Cordialy,
>
> Matthieu MARC
>
More information about the cas-dev
mailing list